PageSourceSearch

https://limitedlevelups.com/assets/index-D-Sh4UVD.js

js limitedlevelups.com collected 2026-10-04 06:34:26 UTC 1,516,185 bytes, 519 lines download raw bytes

vendor: 6,122 bytes, lines 1-9
1var zw=e=>{throw TypeError(e)};var bx=(e,t,s)=>t.has(e)||zw("Cannot "+s);var R=(e,t,s)=>(bx(e,t,"read from private field"),s?s.call(e):t.get(e)),he=(e,t,s)=>t.has(e)?zw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),ne=(e,t,s,r)=>(bx(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s),Te=(e,t,s)=>(bx(e,t,"access private method"),s);var jf=(e,t,s,r)=>({set _(a){ne(e,t,a,s)},get _(){return R(e,t,r)}});function wL(e,t){for(var s=0;s<t.length;s++){const r=t[s];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const o=Object.getOwnPropertyDescriptor(r,a);o&&Object.defineProperty(e,a,o.get?o:{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 o of a)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function s(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=s(a);fetch(a.href,o)}})();function Y4(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Q4={exports:{}},sm={},J4={exports:{}},Ye={};/**
2 * @license React
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var Gu=Symbol.for("react.element"),jL=Symbol.for("react.portal"),kL=Symbol.for("react.fragment"),SL=Symbol.for("react.strict_mode"),NL=Symbol.for("react.profiler"),CL=Symbol.for("react.provider"),_L=Symbol.for("react.context"),TL=Symbol.for("react.forward_ref"),EL=Symbol.for("react.suspense"),RL=Symbol.for("react.memo"),AL=Symbol.for("react.lazy"),Bw=Symbol.iterator;function PL(e){return e===null||typeof e!="object"?null:(e=Bw&&e[Bw]||e["@@iterator"],typeof e=="function"?e:null)}var X4={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},e5=Object.assign,t5={};function yc(e,t,s){this.props=e,this.context=t,this.refs=t5,this.updater=s||X4}yc.prototype.isReactComponent={};yc.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")};yc.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function s5(){}s5.prototype=yc.prototype;function kb(e,t,s){this.props=e,this.context=t,this.refs=t5,this.updater=s||X4}var Sb=kb.prototype=new s5;Sb.constructor=kb;e5(Sb,yc.prototype);Sb.isPureReactComponent=!0;var Fw=Array.isArray,n5=Object.prototype.hasOwnProperty,Nb={current:null},r5={key:!0,ref:!0,__self:!0,__source:!0};function a5(e,t,s){var r,a={},o=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)n5.call(t,r)&&!r5.hasOwnProperty(r)&&(a[r]=t[r]);var l=arguments.length-2;if(l===1)a.children=s;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:Gu,type:e,key:o,ref:i,props:a,_owner:Nb.current}}function OL(e,t){return{$$typeof:Gu,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Cb(e){return typeof e=="object"&&e!==null&&e.$$typeof===Gu}function LL(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(s){return t[s]})}var Ww=/\/+/g;function yx(e,t){return typeof e=="object"&&e!==null&&e.key!=null?LL(""+e.key):t.toString(36)}function bh(e,t,s,r,a){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(o){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case Gu:case jL:i=!0}}if(i)return i=e,a=a(i),e=r===""?"."+yx(i,0):r,Fw(a)?(s="",e!=null&&(s=e.replace(Ww,"$&/")+"/"),bh(a,t,s,"",function(d){return d})):a!=null&&(Cb(a)&&(a=OL(a,s+(!a.key||i&&i.key===a.key?"":(""+a.key).replace(Ww,"$&/")+"/")+e)),t.push(a)),1;if(i=0,r=r===""?".":r+":",Fw(e))for(var l=0;l<e.length;l++){o=e[l];var c=r+yx(o,l);i+=bh(o,t,s,c,a)}else if(c=PL(e),typeof c=="function")for(e=c.call(e),l=0;!(o=e.next()).done;)o=o.value,c=r+yx(o,l++),i+=bh(o,t,s,c,a);else if(o==="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 i}function kf(e,t,s){if(e==null)return e;var r=[],a=0;return bh(e,r,"","",function(o){return t.call(s,o,a++)}),r}function DL(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(s){(e._status===0||e._status===-1)&&(e._status=1,e._result=s)},function(s){(e._status===0||e._status===-1)&&(e._status=2,e._result=s)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ts={current:null},yh={transition:null},IL={ReactCurrentDispatcher:Ts,ReactCurrentBatchConfig:yh,ReactCurrentOwner:Nb};function o5(){throw Error("act(...) is not supported in production builds of React.")}Ye.Children={map:kf,forEach:function(e,t,s){kf(e,function(){t.apply(this,arguments)},s)},count:function(e){var t=0;return kf(e,function(){t++}),t},toArray:function(e){return kf(e,function(t){return t})||[]},only:function(e){if(!Cb(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ye.Component=yc;Ye.Fragment=kL;Ye.Profiler=NL;Ye.PureComponent=kb;Ye.StrictMode=SL;Ye.Suspense=EL;
vendor: 9,001 bytes, lines 9-33
9Ye.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=IL;Ye.act=o5;Ye.cloneElement=function(e,t,s){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=e5({},e.props),a=e.key,o=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,i=Nb.current),t.key!==void 0&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)n5.call(t,c)&&!r5.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=s;else if(1<c){l=Array(c);for(var d=0;d<c;d++)l[d]=arguments[d+2];r.children=l}return{$$typeof:Gu,type:e.type,key:a,ref:o,props:r,_owner:i}};Ye.createContext=function(e){return e={$$typeof:_L,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:CL,_context:e},e.Consumer=e};Ye.createElement=a5;Ye.createFactory=function(e){var t=a5.bind(null,e);return t.type=e,t};Ye.createRef=function(){return{current:null}};Ye.forwardRef=function(e){return{$$typeof:TL,render:e}};Ye.isValidElement=Cb;Ye.lazy=function(e){return{$$typeof:AL,_payload:{_status:-1,_result:e},_init:DL}};Ye.memo=function(e,t){return{$$typeof:RL,type:e,compare:t===void 0?null:t}};Ye.startTransition=function(e){var t=yh.transition;yh.transition={};try{e()}finally{yh.transition=t}};Ye.unstable_act=o5;Ye.useCallback=function(e,t){return Ts.current.useCallback(e,t)};Ye.useContext=function(e){return Ts.current.useContext(e)};Ye.useDebugValue=function(){};Ye.useDeferredValue=function(e){return Ts.current.useDeferredValue(e)};Ye.useEffect=function(e,t){return Ts.current.useEffect(e,t)};Ye.useId=function(){return Ts.current.useId()};Ye.useImperativeHandle=function(e,t,s){return Ts.current.useImperativeHandle(e,t,s)};Ye.useInsertionEffect=function(e,t){return Ts.current.useInsertionEffect(e,t)};Ye.useLayoutEffect=function(e,t){return Ts.current.useLayoutEffect(e,t)};Ye.useMemo=function(e,t){return Ts.current.useMemo(e,t)};Ye.useReducer=function(e,t,s){return Ts.current.useReducer(e,t,s)};Ye.useRef=function(e){return Ts.current.useRef(e)};Ye.useState=function(e){return Ts.current.useState(e)};Ye.useSyncExternalStore=function(e,t,s){return Ts.current.useSyncExternalStore(e,t,s)};Ye.useTransition=function(){return Ts.current.useTransition()};Ye.version="18.3.1";J4.exports=Ye;var p=J4.exports;const wt=Y4(p),_b=wL({__proto__:null,default:wt},[p]);/**
10 * @license React
11 * react-jsx-runtime.production.min.js
12 *
13 * Copyright (c) Facebook, Inc. and its affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var ML=p,$L=Symbol.for("react.element"),UL=Symbol.for("react.fragment"),zL=Object.prototype.hasOwnProperty,BL=ML.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,FL={key:!0,ref:!0,__self:!0,__source:!0};function i5(e,t,s){var r,a={},o=null,i=null;s!==void 0&&(o=""+s),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)zL.call(t,r)&&!FL.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:$L,type:e,key:o,ref:i,props:a,_owner:BL.current}}sm.Fragment=UL;sm.jsx=i5;sm.jsxs=i5;Q4.exports=sm;var n=Q4.exports,Gg={},l5={exports:{}},an={},c5={exports:{}},d5={};/**
18 * @license React
19 * scheduler.production.min.js
20 *
21 * Copyright (c) Facebook, Inc. and its affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */(function(e){function t(O,H){var B=O.length;O.push(H);e:for(;0<B;){var D=B-1>>>1,L=O[D];if(0<a(L,H))O[D]=H,O[B]=L,B=D;else break e}}function s(O){return O.length===0?null:O[0]}function r(O){if(O.length===0)return null;var H=O[0],B=O.pop();if(B!==H){O[0]=B;e:for(var D=0,L=O.length,$=L>>>1;D<$;){var V=2*(D+1)-1,z=O[V],K=V+1,W=O[K];if(0>a(z,B))K<L&&0>a(W,z)?(O[D]=W,O[K]=B,D=K):(O[D]=z,O[V]=B,D=V);else if(K<L&&0>a(W,B))O[D]=W,O[K]=B,D=K;else break e}}return H}function a(O,H){var B=O.sortIndex-H.sortIndex;return B!==0?B:O.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var c=[],d=[],u=1,f=null,h=3,m=!1,y=!1,b=!1,w=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(O){for(var H=s(d);H!==null;){if(H.callback===null)r(d);else if(H.startTime<=O)r(d),H.sortIndex=H.expirationTime,t(c,H);else break;H=s(d)}}function k(O){if(b=!1,v(O),!y)if(s(c)!==null)y=!0,I(S);else{var H=s(d);H!==null&&q(k,H.startTime-O)}}function S(O,H){y=!1,b&&(b=!1,x(_),_=-1),m=!0;var B=h;try{for(v(H),f=s(c);f!==null&&(!(f.expirationTime>H)||O&&!A());){var D=f.callback;if(typeof D=="function"){f.callback=null,h=f.priorityLevel;var L=D(f.expirationTime<=H);H=e.unstable_now(),typeof L=="function"?f.callback=L:f===s(c)&&r(c),v(H)}else r(c);f=s(c)}if(f!==null)var $=!0;else{var V=s(d);V!==null&&q(k,V.startTime-H),$=!1}return $}finally{f=null,h=B,m=!1}}var N=!1,C=null,_=-1,T=5,E=-1;function A(){return!(e.unstable_now()-E<T)}function P(){if(C!==null){var O=e.unstable_now();E=O;var H=!0;try{H=C(!0,O)}finally{H?M():(N=!1,C=null)}}else N=!1}var M;if(typeof g=="function")M=function(){g(P)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,F=U.port2;U.port1.onmessage=P,M=function(){F.postMessage(null)}}else M=function(){w(P,0)};function I(O){C=O,N||(N=!0,M())}function q(O,H){_=w(function(){O(e.unstable_now())},H)}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(O){O.callback=null},e.unstable_continueExecution=function(){y||m||(y=!0,I(S))},e.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<O?Math.floor(1e3/O):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return s(c)},e.unstable_next=function(O){switch(h){case 1:case 2:case 3:var H=3;break;default:H=h}var B=h;h=H;try{return O()}finally{h=B}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(O,H){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var B=h;h=O;try{return H()}finally{h=B}},e.unstable_scheduleCallback=function(O,H,B){var D=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?D+B:D):B=D,O){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=B+L,O={id:u++,callback:H,priorityLevel:O,startTime:B,expirationTime:L,sortIndex:-1},B>D?(O.sortIndex=B,t(d,O),s(c)===null&&O===s(d)&&(b?(x(_),_=-1):b=!0,q(k,B-D))):(O.sortIndex=L,t(c,O),y||m||(y=!0,I(S))),O},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(O){var H=h;return function(){var B=h;h=H;try{return O.apply(this,arguments)}finally{h=B}}}})(d5);c5.exports=d5;var WL=c5.exports;/**
26 * @license React
27 * react-dom.production.min.js
28 *
29 * Copyright (c) Facebook, Inc. and its affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var HL=p,nn=WL;function se(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s]);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 u5=new Set,Gd={};function Ri(e,t){ql(e,t),ql(e+"Capture",t)}function ql(e,t){for(Gd[e]=t,e=0;e<t.length;e++)u5.add(t[e])}var Kr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vg=Object.prototype.hasOwnProperty,GL=/^[: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]*$/,Hw={},Gw={};function VL(e){return Vg.call(Gw,e)?!0:Vg.call(Hw,e)?!1:GL.test(e)?Gw[e]=!0:(Hw[e]=!0,!1)}function KL(e,t,s,r){if(s!==null&&s.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function qL(e,t,s,r){if(t===null||typeof t>"u"||KL(e,t,s,r))return!0;
vendor: 5,200 bytes, lines 33-34
33if(r)return!1;if(s!==null)switch(s.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 Es(e,t,s,r,a,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=s,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var us={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){us[e]=new Es(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];us[t]=new Es(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){us[e]=new Es(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){us[e]=new Es(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){us[e]=new Es(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){us[e]=new Es(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){us[e]=new Es(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){us[e]=new Es(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){us[e]=new Es(e,5,!1,e.toLowerCase(),null,!1,!1)});var Tb=/[\-:]([a-z])/g;function Eb(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(Tb,Eb);us[t]=new Es(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(Tb,Eb);us[t]=new Es(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(Tb,Eb);us[t]=new Es(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){us[e]=new Es(e,1,!1,e.toLowerCase(),null,!1,!1)});us.xlinkHref=new Es("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){us[e]=new Es(e,1,!1,e.toLowerCase(),null,!0,!0)});function Rb(e,t,s,r){var a=us.hasOwnProperty(t)?us[t]:null;(a!==null?a.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(qL(t,s,a,r)&&(s=null),r||a===null?VL(t)&&(s===null?e.removeAttribute(t):e.setAttribute(t,""+s)):a.mustUseProperty?e[a.propertyName]=s===null?a.type===3?!1:"":s:(t=a.attributeName,r=a.attributeNamespace,s===null?e.removeAttribute(t):(a=a.type,s=a===3||a===4&&s===!0?"":""+s,r?e.setAttributeNS(r,t,s):e.setAttribute(t,s))))}var na=HL.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Sf=Symbol.for("react.element"),sl=Symbol.for("react.portal"),nl=Symbol.for("react.fragment"),Ab=Symbol.for("react.strict_mode"),Kg=Symbol.for("react.profiler"),f5=Symbol.for("react.provider"),h5=Symbol.for("react.context"),Pb=Symbol.for("react.forward_ref"),qg=Symbol.for("react.suspense"),Zg=Symbol.for("react.suspense_list"),Ob=Symbol.for("react.memo"),va=Symbol.for("react.lazy"),p5=Symbol.for("react.offscreen"),Vw=Symbol.iterator;function Qc(e){return e===null||typeof e!="object"?null:(e=Vw&&e[Vw]||e["@@iterator"],typeof e=="function"?e:null)}var Tt=Object.assign,vx;function hd(e){if(vx===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);vx=t&&t[1]||""}return`
34`+vx+e}var wx=!1;function jx(e,t){if(!e||wx)return"";wx=!0;var s=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: 16,734 bytes, lines 34-37
34catch(d){if(d&&r&&typeof d.stack=="string"){for(var a=d.stack.split(`
35`),o=r.stack.split(`
36`),i=a.length-1,l=o.length-1;1<=i&&0<=l&&a[i]!==o[l];)l--;for(;1<=i&&0<=l;i--,l--)if(a[i]!==o[l]){if(i!==1||l!==1)do if(i--,l--,0>l||a[i]!==o[l]){var c=`
37`+a[i].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=i&&0<=l);break}}}finally{wx=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?hd(e):""}function ZL(e){switch(e.tag){case 5:return hd(e.type);case 16:return hd("Lazy");case 13:return hd("Suspense");case 19:return hd("SuspenseList");case 0:case 2:case 15:return e=jx(e.type,!1),e;case 11:return e=jx(e.type.render,!1),e;case 1:return e=jx(e.type,!0),e;default:return""}}function Yg(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 nl:return"Fragment";case sl:return"Portal";case Kg:return"Profiler";case Ab:return"StrictMode";case qg:return"Suspense";case Zg:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case h5:return(e.displayName||"Context")+".Consumer";case f5:return(e._context.displayName||"Context")+".Provider";case Pb:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ob:return t=e.displayName||null,t!==null?t:Yg(e.type)||"Memo";case va:t=e._payload,e=e._init;try{return Yg(e(t))}catch{}}return null}function YL(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 Yg(t);case 8:return t===Ab?"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 so(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function m5(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function QL(e){var t=m5(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var a=s.get,o=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Nf(e){e._valueTracker||(e._valueTracker=QL(e))}function x5(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),r="";return e&&(r=m5(e)?e.checked?"true":"false":e.value),e=r,e!==s?(t.setValue(e),!0):!1}function Vh(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 Qg(e,t){var s=t.checked;return Tt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Kw(e,t){var s=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;s=so(t.value!=null?t.value:s),e._wrapperState={initialChecked:r,initialValue:s,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function g5(e,t){t=t.checked,t!=null&&Rb(e,"checked",t,!1)}function Jg(e,t){g5(e,t);var s=so(t.value),r=t.type;if(s!=null)r==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Xg(e,t.type,s):t.hasOwnProperty("defaultValue")&&Xg(e,t.type,so(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function qw(e,t,s){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,s||t===e.value||(e.value=t),e.defaultValue=t}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function Xg(e,t,s){(t!=="number"||Vh(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var pd=Array.isArray;function bl(e,t,s,r){if(e=e.options,t){t={};for(var a=0;a<s.length;a++)t["$"+s[a]]=!0;for(s=0;s<e.length;s++)a=t.hasOwnProperty("$"+e[s].value),e[s].selected!==a&&(e[s].selected=a),a&&r&&(e[s].defaultSelected=!0)}else{for(s=""+so(s),t=null,a=0;a<e.length;a++){if(e[a].value===s){e[a].selected=!0,r&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function e0(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(se(91));return Tt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Zw(e,t){var s=t.value;if(s==null){if(s=t.children,t=t.defaultValue,s!=null){if(t!=null)throw Error(se(92));if(pd(s)){if(1<s.length)throw Error(se(93));s=s[0]}t=s}t==null&&(t=""),s=t}e._wrapperState={initialValue:so(s)}}function b5(e,t){var s=so(t.value),r=so(t.defaultValue);s!=null&&(s=""+s,s!==e.value&&(e.value=s),t.defaultValue==null&&e.defaultValue!==s&&(e.defaultValue=s)),r!=null&&(e.defaultValue=""+r)}function Yw(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function y5(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 t0(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?y5(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Cf,v5=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,s,r,a){MSApp.execUnsafeLocalFunction(function(){return e(t,s,r,a)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Cf=Cf||document.createElement("div"),Cf.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Cf.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Vd(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var Nd={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},JL=["Webkit","ms","Moz","O"];Object.keys(Nd).forEach(function(e){JL.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Nd[t]=Nd[e]})});function w5(e,t,s){return t==null||typeof t=="boolean"||t===""?"":s||typeof t!="number"||t===0||Nd.hasOwnProperty(e)&&Nd[e]?(""+t).trim():t+"px"}function j5(e,t){e=e.style;for(var s in t)if(t.hasOwnProperty(s)){var r=s.indexOf("--")===0,a=w5(s,t[s],r);s==="float"&&(s="cssFloat"),r?e.setProperty(s,a):e[s]=a}}var XL=Tt({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 s0(e,t){if(t){if(XL[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(se(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(se(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(se(61))}if(t.style!=null&&typeof t.style!="object")throw Error(se(62))}}function n0(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 r0=null;function Lb(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var a0=null,yl=null,vl=null;function Qw(e){if(e=qu(e)){if(typeof a0!="function")throw Error(se(280));var t=e.stateNode;t&&(t=im(t),a0(e.stateNode,e.type,t))}}function k5(e){yl?vl?vl.push(e):vl=[e]:yl=e}function S5(){if(yl){var e=yl,t=vl;if(vl=yl=null,Qw(e),t)for(e=0;e<t.length;e++)Qw(t[e])}}function N5(e,t){return e(t)}function C5(){}var kx=!1;function _5(e,t,s){if(kx)return e(t,s);kx=!0;try{return N5(e,t,s)}finally{kx=!1,(yl!==null||vl!==null)&&(C5(),S5())}}function Kd(e,t){var s=e.stateNode;if(s===null)return null;var r=im(s);if(r===null)return null;s=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(s&&typeof s!="function")throw Error(se(231,t,typeof s));return s}var o0=!1;if(Kr)try{var Jc={};Object.defineProperty(Jc,"passive",{get:function(){o0=!0}}),window.addEventListener("test",Jc,Jc),window.removeEventListener("test",Jc,Jc)}catch{o0=!1}function eD(e,t,s,r,a,o,i,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(s,d)}catch(u){this.onError(u)}}var Cd=!1,Kh=null,qh=!1,i0=null,tD={onError:function(e){Cd=!0,Kh=e}};function sD(e,t,s,r,a,o,i,l,c){Cd=!1,Kh=null,eD.apply(tD,arguments)}function nD(e,t,s,r,a,o,i,l,c){if(sD.apply(this,arguments),Cd){if(Cd){var d=Kh;Cd=!1,Kh=null}else throw Error(se(198));qh||(qh=!0,i0=d)}}function Ai(e){var t=e,s=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(s=t.return),e=t.return;while(e)}return t.tag===3?s:null}function T5(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 Jw(e){if(Ai(e)!==e)throw Error(se(188))}function rD(e){var t=e.alternate;if(!t){if(t=Ai(e),t===null)throw Error(se(188));return t!==e?null:e}for(var s=e,r=t;;){var a=s.return;if(a===null)break;var o=a.alternate;if(o===null){if(r=a.return,r!==null){s=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===s)return Jw(a),e;if(o===r)return Jw(a),t;o=o.sibling}throw Error(se(188))}if(s.return!==r.return)s=a,r=o;else{for(var i=!1,l=a.child;l;){if(l===s){i=!0,s=a,r=o;break}if(l===r){i=!0,r=a,s=o;break}l=l.sibling}if(!i){for(l=o.child;l;){if(l===s){i=!0,s=o,r=a;break}if(l===r){i=!0,r=o,s=a;break}l=l.sibling}if(!i)throw Error(se(189))}}if(s.alternate!==r)throw Error(se(190))}if(s.tag!==3)throw Error(se(188));return s.stateNode.current===s?e:t}function E5(e){return e=rD(e),e!==null?R5(e):null}function R5(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=R5(e);if(t!==null)return t;e=e.sibling}return null}var A5=nn.unstable_scheduleCallback,Xw=nn.unstable_cancelCallback,aD=nn.unstable_shouldYield,oD=nn.unstable_requestPaint,Ut=nn.unstable_now,iD=nn.unstable_getCurrentPriorityLevel,Db=nn.unstable_ImmediatePriority,P5=nn.unstable_UserBlockingPriority,Zh=nn.unstable_NormalPriority,lD=nn.unstable_LowPriority,O5=nn.unstable_IdlePriority,nm=null,pr=null;function cD(e){if(pr&&typeof pr.onCommitFiberRoot=="function")try{pr.onCommitFiberRoot(nm,e,void 0,(e.current.flags&128)===128)}catch{}}var Vn=Math.clz32?Math.clz32:fD,dD=Math.log,uD=Math.LN2;function fD(e){return e>>>=0,e===0?32:31-(dD(e)/uD|0)|0}var _f=64,Tf=4194304;function md(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 Yh(e,t){var s=e.pendingLanes;if(s===0)return 0;var r=0,a=e.suspendedLanes,o=e.pingedLanes,i=s&268435455;if(i!==0){var l=i&~a;l!==0?r=md(l):(o&=i,o!==0&&(r=md(o)))}else i=s&~a,i!==0?r=md(i):o!==0&&(r=md(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&a)&&(a=r&-r,o=t&-t,a>=o||a===16&&(o&4194240)!==0))return t;if(r&4&&(r|=s&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)s=31-Vn(t),a=1<<s,r|=e[s],t&=~a;return r}function hD(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 pD(e,t){for(var s=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,o=e.pendingLanes;0<o;){var i=31-Vn(o),l=1<<i,c=a[i];c===-1?(!(l&s)||l&r)&&(a[i]=hD(l,t)):c<=t&&(e.expiredLanes|=l),o&=~l}}function l0(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function L5(){var e=_f;return _f<<=1,!(_f&4194240)&&(_f=64),e}function Sx(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function Vu(e,t,s){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Vn(t),e[t]=s}function mD(e,t){var s=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<s;){var a=31-Vn(s),o=1<<a;t[a]=0,r[a]=-1,e[a]=-1,s&=~o}}function Ib(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var r=31-Vn(s),a=1<<r;a&t|e[r]&t&&(e[r]|=t),s&=~a}}var dt=0;function D5(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var I5,Mb,M5,$5,U5,c0=!1,Ef=[],Fa=null,Wa=null,Ha=null,qd=new Map,Zd=new Map,ja=[],xD="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 e2(e,t){switch(e){case"focusin":case"focusout":Fa=null;break;case"dragenter":case"dragleave":Wa=null;break;case"mouseover":case"mouseout":Ha=null;break;case"pointerover":case"pointerout":qd.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zd.delete(t.pointerId)}}function Xc(e,t,s,r,a,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:s,eventSystemFlags:r,nativeEvent:o,targetContainers:[a]},t!==null&&(t=qu(t),t!==null&&Mb(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function gD(e,t,s,r,a){switch(t){case"focusin":return Fa=Xc(Fa,e,t,s,r,a),!0;case"dragenter":return Wa=Xc(Wa,e,t,s,r,a),!0;case"mouseover":return Ha=Xc(Ha,e,t,s,r,a),!0;case"pointerover":var o=a.pointerId;return qd.set(o,Xc(qd.get(o)||null,e,t,s,r,a)),!0;case"gotpointercapture":return o=a.pointerId,Zd.set(o,Xc(Zd.get(o)||null,e,t,s,r,a)),!0}return!1}function z5(e){var t=zo(e.target);if(t!==null){var s=Ai(t);if(s!==null){if(t=s.tag,t===13){if(t=T5(s),t!==null){e.blockedOn=t,U5(e.priority,function(){M5(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function vh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=d0(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(s===null){s=e.nativeEvent;var r=new s.constructor(s.type,s);r0=r,s.target.dispatchEvent(r),r0=null}else return t=qu(s),t!==null&&Mb(t),e.blockedOn=s,!1;t.shift()}return!0}function t2(e,t,s){vh(e)&&s.delete(t)}function bD(){c0=!1,Fa!==null&&vh(Fa)&&(Fa=null),Wa!==null&&vh(Wa)&&(Wa=null),Ha!==null&&vh(Ha)&&
vendor: 11,540 bytes, line 37
37(Ha=null),qd.forEach(t2),Zd.forEach(t2)}function ed(e,t){e.blockedOn===t&&(e.blockedOn=null,c0||(c0=!0,nn.unstable_scheduleCallback(nn.unstable_NormalPriority,bD)))}function Yd(e){function t(a){return ed(a,e)}if(0<Ef.length){ed(Ef[0],e);for(var s=1;s<Ef.length;s++){var r=Ef[s];r.blockedOn===e&&(r.blockedOn=null)}}for(Fa!==null&&ed(Fa,e),Wa!==null&&ed(Wa,e),Ha!==null&&ed(Ha,e),qd.forEach(t),Zd.forEach(t),s=0;s<ja.length;s++)r=ja[s],r.blockedOn===e&&(r.blockedOn=null);for(;0<ja.length&&(s=ja[0],s.blockedOn===null);)z5(s),s.blockedOn===null&&ja.shift()}var wl=na.ReactCurrentBatchConfig,Qh=!0;function yD(e,t,s,r){var a=dt,o=wl.transition;wl.transition=null;try{dt=1,$b(e,t,s,r)}finally{dt=a,wl.transition=o}}function vD(e,t,s,r){var a=dt,o=wl.transition;wl.transition=null;try{dt=4,$b(e,t,s,r)}finally{dt=a,wl.transition=o}}function $b(e,t,s,r){if(Qh){var a=d0(e,t,s,r);if(a===null)Lx(e,t,r,Jh,s),e2(e,r);else if(gD(a,e,t,s,r))r.stopPropagation();else if(e2(e,r),t&4&&-1<xD.indexOf(e)){for(;a!==null;){var o=qu(a);if(o!==null&&I5(o),o=d0(e,t,s,r),o===null&&Lx(e,t,r,Jh,s),o===a)break;a=o}a!==null&&r.stopPropagation()}else Lx(e,t,r,null,s)}}var Jh=null;function d0(e,t,s,r){if(Jh=null,e=Lb(r),e=zo(e),e!==null)if(t=Ai(e),t===null)e=null;else if(s=t.tag,s===13){if(e=T5(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Jh=e,null}function B5(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(iD()){case Db:return 1;case P5:return 4;case Zh:case lD:return 16;case O5:return 536870912;default:return 16}default:return 16}}var Ia=null,Ub=null,wh=null;function F5(){if(wh)return wh;var e,t=Ub,s=t.length,r,a="value"in Ia?Ia.value:Ia.textContent,o=a.length;for(e=0;e<s&&t[e]===a[e];e++);var i=s-e;for(r=1;r<=i&&t[s-r]===a[o-r];r++);return wh=a.slice(e,1<r?1-r:void 0)}function jh(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 Rf(){return!0}function s2(){return!1}function on(e){function t(s,r,a,o,i){this._reactName=s,this._targetInst=a,this.type=r,this.nativeEvent=o,this.target=i,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(s=e[l],this[l]=s?s(o):o[l]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Rf:s2,this.isPropagationStopped=s2,this}return Tt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Rf)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Rf)},persist:function(){},isPersistent:Rf}),t}var vc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zb=on(vc),Ku=Tt({},vc,{view:0,detail:0}),wD=on(Ku),Nx,Cx,td,rm=Tt({},Ku,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bb,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!==td&&(td&&e.type==="mousemove"?(Nx=e.screenX-td.screenX,Cx=e.screenY-td.screenY):Cx=Nx=0,td=e),Nx)},movementY:function(e){return"movementY"in e?e.movementY:Cx}}),n2=on(rm),jD=Tt({},rm,{dataTransfer:0}),kD=on(jD),SD=Tt({},Ku,{relatedTarget:0}),_x=on(SD),ND=Tt({},vc,{animationName:0,elapsedTime:0,pseudoElement:0}),CD=on(ND),_D=Tt({},vc,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),TD=on(_D),ED=Tt({},vc,{data:0}),r2=on(ED),RD={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},AD={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"},PD={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function OD(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=PD[e])?!!t[e]:!1}function Bb(){return OD}var LD=Tt({},Ku,{key:function(e){if(e.key){var t=RD[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=jh(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?AD[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bb,charCode:function(e){return e.type==="keypress"?jh(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?jh(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),DD=on(LD),ID=Tt({},rm,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),a2=on(ID),MD=Tt({},Ku,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bb}),$D=on(MD),UD=Tt({},vc,{propertyName:0,elapsedTime:0,pseudoElement:0}),zD=on(UD),BD=Tt({},rm,{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}),FD=on(BD),WD=[9,13,27,32],Fb=Kr&&"CompositionEvent"in window,_d=null;Kr&&"documentMode"in document&&(_d=document.documentMode);var HD=Kr&&"TextEvent"in window&&!_d,W5=Kr&&(!Fb||_d&&8<_d&&11>=_d),o2=" ",i2=!1;function H5(e,t){switch(e){case"keyup":return WD.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function G5(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var rl=!1;function GD(e,t){switch(e){case"compositionend":return G5(t);case"keypress":return t.which!==32?null:(i2=!0,o2);case"textInput":return e=t.data,e===o2&&i2?null:e;default:return null}}function VD(e,t){if(rl)return e==="compositionend"||!Fb&&H5(e,t)?(e=F5(),wh=Ub=Ia=null,rl=!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 W5&&t.locale!=="ko"?null:t.data;default:return null}}var KD={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 l2(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!KD[e.type]:t==="textarea"}function V5(e,t,s,r){k5(r),t=Xh(t,"onChange"),0<t.length&&(s=new zb("onChange","change",null,s,r),e.push({event:s,listeners:t}))}var Td=null,Qd=null;function qD(e){n_(e,0)}function am(e){var t=il(e);if(x5(t))return e}function ZD(e,t){if(e==="change")return t}var K5=!1;if(Kr){var Tx;if(Kr){var Ex="oninput"in document;if(!Ex){var c2=document.createElement("div");c2.setAttribute("oninput","return;"),Ex=typeof c2.oninput=="function"}Tx=Ex}else Tx=!1;K5=Tx&&(!document.documentMode||9<document.documentMode)}function d2(){Td&&(Td.detachEvent("onpropertychange",q5),Qd=Td=null)}function q5(e){if(e.propertyName==="value"&&am(Qd)){var t=[];V5(t,Qd,e,Lb(e)),_5(qD,t)}}function YD(e,t,s){e==="focusin"?(d2(),Td=t,Qd=s,Td.attachEvent("onpropertychange",q5)):e==="focusout"&&d2()}function QD(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return am(Qd)}function JD(e,t){if(e==="click")return am(t)}function XD(e,t){if(e==="input"||e==="change")return am(t)}function eI(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var qn=typeof Object.is=="function"?Object.is:eI;function Jd(e,t){if(qn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),r=Object.keys(t);if(s.length!==r.length)return!1;for(r=0;r<s.length;r++){var a=s[r];if(!Vg.call(t,a)||!qn(e[a],t[a]))return!1}return!0}function u2(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function f2(e,t){var s=u2(e);e=0;for(var r;s;){if(s.nodeType===3){if(r=e+s.textContent.length,e<=t&&r>=t)return{node:s,offset:t-e};e=r}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=u2(s)}}function Z5(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Z5(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Y5(){for(var e=window,t=Vh();t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=Vh(e.document)}return t}function Wb(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 tI(e){var t=Y5(),s=e.focusedElem,r=e.selectionRange;if(t!==s&&s&&s.ownerDocument&&Z5(s.ownerDocument.documentElement,s)){if(r!==null&&Wb(s)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in s)s.selectionStart=t,s.selectionEnd=Math.min(e,s.value.length);else if(e=(t=s.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=s.textContent.length,o=Math.min(r.start,a);r=r.end===void 0?o:Math.min(r.end,a),!e.extend&&o>r&&(a=r,r=o,o=a),a=f2(s,o);var i=f2(s,r);a&&i&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=s;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<t.length;s++)e=t[s],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var sI=Kr&&"documentMode"in document&&11>=document.documentMode,al=null,u0=null,Ed=null,f0=!1;
vendor: 4,821 bytes, line 37
37function h2(e,t,s){var r=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;f0||al==null||al!==Vh(r)||(r=al,"selectionStart"in r&&Wb(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}),Ed&&Jd(Ed,r)||(Ed=r,r=Xh(u0,"onSelect"),0<r.length&&(t=new zb("onSelect","select",null,t,s),e.push({event:t,listeners:r}),t.target=al)))}function Af(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var ol={animationend:Af("Animation","AnimationEnd"),animationiteration:Af("Animation","AnimationIteration"),animationstart:Af("Animation","AnimationStart"),transitionend:Af("Transition","TransitionEnd")},Rx={},Q5={};Kr&&(Q5=document.createElement("div").style,"AnimationEvent"in window||(delete ol.animationend.animation,delete ol.animationiteration.animation,delete ol.animationstart.animation),"TransitionEvent"in window||delete ol.transitionend.transition);function om(e){if(Rx[e])return Rx[e];if(!ol[e])return e;var t=ol[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in Q5)return Rx[e]=t[s];return e}var J5=om("animationend"),X5=om("animationiteration"),e_=om("animationstart"),t_=om("transitionend"),s_=new Map,p2="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 xo(e,t){s_.set(e,t),Ri(t,[e])}for(var Ax=0;Ax<p2.length;Ax++){var Px=p2[Ax],nI=Px.toLowerCase(),rI=Px[0].toUpperCase()+Px.slice(1);xo(nI,"on"+rI)}xo(J5,"onAnimationEnd");xo(X5,"onAnimationIteration");xo(e_,"onAnimationStart");xo("dblclick","onDoubleClick");xo("focusin","onFocus");xo("focusout","onBlur");xo(t_,"onTransitionEnd");ql("onMouseEnter",["mouseout","mouseover"]);ql("onMouseLeave",["mouseout","mouseover"]);ql("onPointerEnter",["pointerout","pointerover"]);ql("onPointerLeave",["pointerout","pointerover"]);Ri("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ri("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ri("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ri("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ri("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ri("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xd="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(" "),aI=new Set("cancel close invalid load scroll toggle".split(" ").concat(xd));function m2(e,t,s){var r=e.type||"unknown-event";e.currentTarget=s,nD(r,t,void 0,e),e.currentTarget=null}function n_(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var r=e[s],a=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var i=r.length-1;0<=i;i--){var l=r[i],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==o&&a.isPropagationStopped())break e;m2(a,l,d),o=c}else for(i=0;i<r.length;i++){if(l=r[i],c=l.instance,d=l.currentTarget,l=l.listener,c!==o&&a.isPropagationStopped())break e;m2(a,l,d),o=c}}}if(qh)throw e=i0,qh=!1,i0=null,e}function bt(e,t){var s=t[g0];s===void 0&&(s=t[g0]=new Set);var r=e+"__bubble";s.has(r)||(r_(t,e,2,!1),s.add(r))}function Ox(e,t,s){var r=0;t&&(r|=4),r_(s,e,r,t)}var Pf="_reactListening"+Math.random().toString(36).slice(2);function Xd(e){if(!e[Pf]){e[Pf]=!0,u5.forEach(function(s){s!=="selectionchange"&&(aI.has(s)||Ox(s,!1,e),Ox(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Pf]||(t[Pf]=!0,Ox("selectionchange",!1,t))}}function r_(e,t,s,r){switch(B5(t)){case 1:var a=yD;break;case 4:a=vD;break;default:a=$b}s=a.bind(null,t,s,e),a=void 0,!o0||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),r?a!==void 0?e.addEventListener(t,s,{capture:!0,passive:a}):e.addEventListener(t,s,!0):a!==void 0?e.addEventListener(t,s,{passive:a}):e.addEventListener(t,s,!1)}function Lx(e,t,s,r,a){var o=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var i=r.tag;if(i===3||i===4){var l=r.stateNode.containerInfo;
vendor: 2,527 bytes, line 37
37if(l===a||l.nodeType===8&&l.parentNode===a)break;if(i===4)for(i=r.return;i!==null;){var c=i.tag;if((c===3||c===4)&&(c=i.stateNode.containerInfo,c===a||c.nodeType===8&&c.parentNode===a))return;i=i.return}for(;l!==null;){if(i=zo(l),i===null)return;if(c=i.tag,c===5||c===6){r=o=i;continue e}l=l.parentNode}}r=r.return}_5(function(){var d=o,u=Lb(s),f=[];e:{var h=s_.get(e);if(h!==void 0){var m=zb,y=e;switch(e){case"keypress":if(jh(s)===0)break e;case"keydown":case"keyup":m=DD;break;case"focusin":y="focus",m=_x;break;case"focusout":y="blur",m=_x;break;case"beforeblur":case"afterblur":m=_x;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=n2;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=kD;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=$D;break;case J5:case X5:case e_:m=CD;break;case t_:m=zD;break;case"scroll":m=wD;break;case"wheel":m=FD;break;case"copy":case"cut":case"paste":m=TD;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=a2}var b=(t&4)!==0,w=!b&&e==="scroll",x=b?h!==null?h+"Capture":null:h;b=[];for(var g=d,v;g!==null;){v=g;var k=v.stateNode;if(v.tag===5&&k!==null&&(v=k,x!==null&&(k=Kd(g,x),k!=null&&b.push(eu(g,k,v)))),w)break;g=g.return}0<b.length&&(h=new m(h,y,null,s,u),f.push({event:h,listeners:b}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",h&&s!==r0&&(y=s.relatedTarget||s.fromElement)&&(zo(y)||y[qr]))break e;if((m||h)&&(h=u.window===u?u:(h=u.ownerDocument)?h.defaultView||h.parentWindow:window,m?(y=s.relatedTarget||s.toElement,m=d,y=y?zo(y):null,y!==null&&(w=Ai(y),y!==w||y.tag!==5&&y.tag!==6)&&(y=null)):(m=null,y=d),m!==y)){if(b=n2,k="onMouseLeave",x="onMouseEnter",g="mouse",(e==="pointerout"||e==="pointerover")&&(b=a2,k="onPointerLeave",x="onPointerEnter",g="pointer"),w=m==null?h:il(m),v=y==null?h:il(y),h=new b(k,g+"leave",m,s,u),h.target=w,h.relatedTarget=v,k=null,zo(u)===d&&(b=new b(x,g+"enter",y,s,u),b.target=v,b.relatedTarget=w,k=b),w=k,m&&y)t:{for(b=m,x=y,g=0,v=b;v;v=Fi(v))g++;for(v=0,k=x;k;k=Fi(k))v++;for(;0<g-v;)b=Fi(b),g--;for(;0<v-g;)x=Fi(x),v--;for(;g--;){if(b===x||x!==null&&b===x.alternate)break t;b=Fi(b),x=Fi(x)}b=null}else b=null;m!==null&&x2(f,h,m,b,!1),y!==null&&w!==null&&x2(f,w,y,b,!0)}}
vendor: 4,576 bytes, lines 37-38
37e:{if(h=d?il(d):window,m=h.nodeName&&h.nodeName.toLowerCase(),m==="select"||m==="input"&&h.type==="file")var S=ZD;else if(l2(h))if(K5)S=XD;else{S=QD;var N=YD}else(m=h.nodeName)&&m.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(S=JD);if(S&&(S=S(e,d))){V5(f,S,s,u);break e}N&&N(e,h,d),e==="focusout"&&(N=h._wrapperState)&&N.controlled&&h.type==="number"&&Xg(h,"number",h.value)}switch(N=d?il(d):window,e){case"focusin":(l2(N)||N.contentEditable==="true")&&(al=N,u0=d,Ed=null);break;case"focusout":Ed=u0=al=null;break;case"mousedown":f0=!0;break;case"contextmenu":case"mouseup":case"dragend":f0=!1,h2(f,s,u);break;case"selectionchange":if(sI)break;case"keydown":case"keyup":h2(f,s,u)}var C;if(Fb)e:{switch(e){case"compositionstart":var _="onCompositionStart";break e;case"compositionend":_="onCompositionEnd";break e;case"compositionupdate":_="onCompositionUpdate";break e}_=void 0}else rl?H5(e,s)&&(_="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(_="onCompositionStart");_&&(W5&&s.locale!=="ko"&&(rl||_!=="onCompositionStart"?_==="onCompositionEnd"&&rl&&(C=F5()):(Ia=u,Ub="value"in Ia?Ia.value:Ia.textContent,rl=!0)),N=Xh(d,_),0<N.length&&(_=new r2(_,e,null,s,u),f.push({event:_,listeners:N}),C?_.data=C:(C=G5(s),C!==null&&(_.data=C)))),(C=HD?GD(e,s):VD(e,s))&&(d=Xh(d,"onBeforeInput"),0<d.length&&(u=new r2("onBeforeInput","beforeinput",null,s,u),f.push({event:u,listeners:d}),u.data=C))}n_(f,t)})}function eu(e,t,s){return{instance:e,listener:t,currentTarget:s}}function Xh(e,t){for(var s=t+"Capture",r=[];e!==null;){var a=e,o=a.stateNode;a.tag===5&&o!==null&&(a=o,o=Kd(e,s),o!=null&&r.unshift(eu(e,o,a)),o=Kd(e,t),o!=null&&r.push(eu(e,o,a))),e=e.return}return r}function Fi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function x2(e,t,s,r,a){for(var o=t._reactName,i=[];s!==null&&s!==r;){var l=s,c=l.alternate,d=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&d!==null&&(l=d,a?(c=Kd(s,o),c!=null&&i.unshift(eu(s,c,l))):a||(c=Kd(s,o),c!=null&&i.push(eu(s,c,l)))),s=s.return}i.length!==0&&e.push({event:t,listeners:i})}var oI=/\r\n?/g,iI=/\u0000|\uFFFD/g;function g2(e){return(typeof e=="string"?e:""+e).replace(oI,`
38`).replace(iI,"")}function Of(e,t,s){if(t=g2(t),g2(e)!==t&&s)throw Error(se(425))}function ep(){}var h0=null,p0=null;function m0(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 x0=typeof setTimeout=="function"?setTimeout:void 0,lI=typeof clearTimeout=="function"?clearTimeout:void 0,b2=typeof Promise=="function"?Promise:void 0,cI=typeof queueMicrotask=="function"?queueMicrotask:typeof b2<"u"?function(e){return b2.resolve(null).then(e).catch(dI)}:x0;function dI(e){setTimeout(function(){throw e})}function Dx(e,t){var s=t,r=0;do{var a=s.nextSibling;if(e.removeChild(s),a&&a.nodeType===8)if(s=a.data,s==="/$"){if(r===0){e.removeChild(a),Yd(t);return}r--}else s!=="$"&&s!=="$?"&&s!=="$!"||r++;s=a}while(s);Yd(t)}function Ga(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 y2(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"){if(t===0)return e;t--}else s==="/$"&&t++}e=e.previousSibling}return null}var wc=Math.random().toString(36).slice(2),dr="__reactFiber$"+wc,tu="__reactProps$"+wc,qr="__reactContainer$"+wc,g0="__reactEvents$"+wc,uI="__reactListeners$"+wc,fI="__reactHandles$"+wc;function zo(e){var t=e[dr];if(t)return t;for(var s=e.parentNode;s;){if(t=s[qr]||s[dr]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=y2(e);e!==null;){if(s=e[dr])return s;e=y2(e)}return t}e=s,s=e.parentNode}return null}function qu(e){return e=e[dr]||e[qr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function il(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(se(33))}function im(e){return e[tu]||null}var b0=[],ll=-1;function go(e){return{current:e}}function vt(e){0>ll||(e.current=b0[ll],b0[ll]=null,ll--)}function xt(e,t){ll++,b0[ll]=e.current,e.current=t}var no={},bs=go(no),Us=go(!1),di=no;function Zl(e,t){var s=e.type.contextTypes;if(!s)return no;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a={},o;for(o in s)a[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a
vendor: 4,063 bytes, line 38
38),a}function zs(e){return e=e.childContextTypes,e!=null}function tp(){vt(Us),vt(bs)}function v2(e,t,s){if(bs.current!==no)throw Error(se(168));xt(bs,t),xt(Us,s)}function a_(e,t,s){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return s;r=r.getChildContext();for(var a in r)if(!(a in t))throw Error(se(108,YL(e)||"Unknown",a));return Tt({},s,r)}function sp(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||no,di=bs.current,xt(bs,e),xt(Us,Us.current),!0}function w2(e,t,s){var r=e.stateNode;if(!r)throw Error(se(169));s?(e=a_(e,t,di),r.__reactInternalMemoizedMergedChildContext=e,vt(Us),vt(bs),xt(bs,e)):vt(Us),xt(Us,s)}var Or=null,lm=!1,Ix=!1;function o_(e){Or===null?Or=[e]:Or.push(e)}function hI(e){lm=!0,o_(e)}function bo(){if(!Ix&&Or!==null){Ix=!0;var e=0,t=dt;try{var s=Or;for(dt=1;e<s.length;e++){var r=s[e];do r=r(!0);while(r!==null)}Or=null,lm=!1}catch(a){throw Or!==null&&(Or=Or.slice(e+1)),A5(Db,bo),a}finally{dt=t,Ix=!1}}return null}var cl=[],dl=0,np=null,rp=0,bn=[],yn=0,ui=null,Fr=1,Wr="";function Do(e,t){cl[dl++]=rp,cl[dl++]=np,np=e,rp=t}function i_(e,t,s){bn[yn++]=Fr,bn[yn++]=Wr,bn[yn++]=ui,ui=e;var r=Fr;e=Wr;var a=32-Vn(r)-1;r&=~(1<<a),s+=1;var o=32-Vn(t)+a;if(30<o){var i=a-a%5;o=(r&(1<<i)-1).toString(32),r>>=i,a-=i,Fr=1<<32-Vn(t)+a|s<<a|r,Wr=o+e}else Fr=1<<o|s<<a|r,Wr=e}function Hb(e){e.return!==null&&(Do(e,1),i_(e,1,0))}function Gb(e){for(;e===np;)np=cl[--dl],cl[dl]=null,rp=cl[--dl],cl[dl]=null;for(;e===ui;)ui=bn[--yn],bn[yn]=null,Wr=bn[--yn],bn[yn]=null,Fr=bn[--yn],bn[yn]=null}var tn=null,Xs=null,jt=!1,zn=null;function l_(e,t){var s=vn(5,null,null,0);s.elementType="DELETED",s.stateNode=t,s.return=e,t=e.deletions,t===null?(e.deletions=[s],e.flags|=16):t.push(s)}function j2(e,t){switch(e.tag){case 5:var s=e.type;return t=t.nodeType!==1||s.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,tn=e,Xs=Ga(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,tn=e,Xs=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(s=ui!==null?{id:Fr,overflow:Wr}:null,e.memoizedState={dehydrated:t,treeContext:s,retryLane:1073741824},s=vn(18,null,null,0),s.stateNode=t,s.return=e,e.child=s,tn=e,Xs=null,!0):!1;default:return!1}}function y0(e){return(e.mode&1)!==0&&(e.flags&128)===0}function v0(e){if(jt){var t=Xs;if(t){var s=t;if(!j2(e,t)){if(y0(e))throw Error(se(418));t=Ga(s.nextSibling);var r=tn;t&&j2(e,t)?l_(r,s):(e.flags=e.flags&-4097|2,jt=!1,tn=e)}}else{if(y0(e))throw Error(se(418));e.flags=e.flags&-4097|2,jt=!1,tn=e}}}function k2(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;tn=e}function Lf(e){if(e!==tn)return!1;if(!jt)return k2(e),jt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!m0(e.type,e.memoizedProps)),t&&(t=Xs)){if(y0(e))throw c_(),Error(se(418));for(;t;)l_(e,t),t=Ga(t.nextSibling)}if(k2(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(se(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"){if(t===0){Xs=Ga(e.nextSibling);break e}t--}else s!=="$"&&s!=="$!"&&s!=="$?"||t++}e=e.nextSibling}Xs=null}}else Xs=tn?Ga(e.stateNode.nextSibling):null;return!0}function c_(){for(var e=Xs;e;)e=Ga(e.nextSibling)}function Yl(){Xs=tn=null,jt=!1}function Vb(e){zn===null?zn=[e]:zn.push(e)}var pI=na.ReactCurrentBatchConfig;function sd(e,t,s){if(e=s.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(s._owner){if(s=s._owner,s){if(s.tag!==1)throw Error(se(309));var r=s.stateNode}if(!r)throw Error(se(147,e));var a=r,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(i){var l=a.refs;i===null?delete l[o]:l[o]=i},t._stringRef=o,t)}if(typeof e!="string")throw Error(se(284));if(!s._owner)throw Error(se(290,e))}return e}function Df(e,t){throw e=Object.prototype.toString.call(t),Error(se(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function S2(e){var t=e._init;return t(e._payload)}
vendor: 4,123 bytes, line 38
38function d_(e){function t(x,g){if(e){var v=x.deletions;v===null?(x.deletions=[g],x.flags|=16):v.push(g)}}function s(x,g){if(!e)return null;for(;g!==null;)t(x,g),g=g.sibling;return null}function r(x,g){for(x=new Map;g!==null;)g.key!==null?x.set(g.key,g):x.set(g.index,g),g=g.sibling;return x}function a(x,g){return x=Za(x,g),x.index=0,x.sibling=null,x}function o(x,g,v){return x.index=v,e?(v=x.alternate,v!==null?(v=v.index,v<g?(x.flags|=2,g):v):(x.flags|=2,g)):(x.flags|=1048576,g)}function i(x){return e&&x.alternate===null&&(x.flags|=2),x}function l(x,g,v,k){return g===null||g.tag!==6?(g=Wx(v,x.mode,k),g.return=x,g):(g=a(g,v),g.return=x,g)}function c(x,g,v,k){var S=v.type;return S===nl?u(x,g,v.props.children,k,v.key):g!==null&&(g.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===va&&S2(S)===g.type)?(k=a(g,v.props),k.ref=sd(x,g,v),k.return=x,k):(k=Eh(v.type,v.key,v.props,null,x.mode,k),k.ref=sd(x,g,v),k.return=x,k)}function d(x,g,v,k){return g===null||g.tag!==4||g.stateNode.containerInfo!==v.containerInfo||g.stateNode.implementation!==v.implementation?(g=Hx(v,x.mode,k),g.return=x,g):(g=a(g,v.children||[]),g.return=x,g)}function u(x,g,v,k,S){return g===null||g.tag!==7?(g=ai(v,x.mode,k,S),g.return=x,g):(g=a(g,v),g.return=x,g)}function f(x,g,v){if(typeof g=="string"&&g!==""||typeof g=="number")return g=Wx(""+g,x.mode,v),g.return=x,g;if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Sf:return v=Eh(g.type,g.key,g.props,null,x.mode,v),v.ref=sd(x,null,g),v.return=x,v;case sl:return g=Hx(g,x.mode,v),g.return=x,g;case va:var k=g._init;return f(x,k(g._payload),v)}if(pd(g)||Qc(g))return g=ai(g,x.mode,v,null),g.return=x,g;Df(x,g)}return null}function h(x,g,v,k){var S=g!==null?g.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return S!==null?null:l(x,g,""+v,k);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Sf:return v.key===S?c(x,g,v,k):null;case sl:return v.key===S?d(x,g,v,k):null;case va:return S=v._init,h(x,g,S(v._payload),k)}if(pd(v)||Qc(v))return S!==null?null:u(x,g,v,k,null);Df(x,v)}return null}function m(x,g,v,k,S){if(typeof k=="string"&&k!==""||typeof k=="number")return x=x.get(v)||null,l(g,x,""+k,S);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Sf:return x=x.get(k.key===null?v:k.key)||null,c(g,x,k,S);case sl:return x=x.get(k.key===null?v:k.key)||null,d(g,x,k,S);case va:var N=k._init;return m(x,g,v,N(k._payload),S)}if(pd(k)||Qc(k))return x=x.get(v)||null,u(g,x,k,S,null);Df(g,k)}return null}function y(x,g,v,k){for(var S=null,N=null,C=g,_=g=0,T=null;C!==null&&_<v.length;_++){C.index>_?(T=C,C=null):T=C.sibling;var E=h(x,C,v[_],k);if(E===null){C===null&&(C=T);break}e&&C&&E.alternate===null&&t(x,C),g=o(E,g,_),N===null?S=E:N.sibling=E,N=E,C=T}if(_===v.length)return s(x,C),jt&&Do(x,_),S;if(C===null){for(;_<v.length;_++)C=f(x,v[_],k),C!==null&&(g=o(C,g,_),N===null?S=C:N.sibling=C,N=C);return jt&&Do(x,_),S}for(C=r(x,C);_<v.length;_++)T=m(C,x,_,v[_],k),T!==null&&(e&&T.alternate!==null&&C.delete(T.key===null?_:T.key),g=o(T,g,_),N===null?S=T:N.sibling=T,N=T);return e&&C.forEach(function(A){return t(x,A)}),jt&&Do(x,_),S}function b(x,g,v,k){var S=Qc(v);if(typeof S!="function")throw Error(se(150));if(v=S.call(v),v==null)throw Error(se(151));for(var N=S=null,C=g,_=g=0,T=null,E=v.next();C!==null&&!E.done;_++,E=v.next()){C.index>_?(T=C,C=null):T=C.sibling;var A=h(x,C,E.value,k);if(A===null){C===null&&(C=T);break}e&&C&&A.alternate===null&&t(x,C),g=o(A,g,_),N===null?S=A:N.sibling=A,N=A,C=T}if(E.done)return s(x,C),jt&&Do(x,_),S;if(C===null){for(;!E.done;_++,E=v.next())E=f(x,E.value,k),E!==null&&(g=o(E,g,_),N===null?S=E:N.sibling=E,N=E);return jt&&Do(x,_),S}for(C=r(x,C);!E.done;_++,E=v.next())E=m(C,x,_,E.value,k),E!==null&&(e&&E.alternate!==null&&C.delete(E.key===null?_:E.key),g=o(E,g,_),N===null?S=E:N.sibling=E,N=E);return e&&C.forEach(function(P){return t(x,P)}),jt&&Do(x,_),S}function w(x,g,v,k){if(typeof v=="object"&&v!==null&&v.type===nl&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Sf:e:{for(var S=v.key,N=g;N!==null;){if(N.key===S){if(S=v.type,S===nl){if(N.tag===7){s(x,N.sibling),g=
vendor: 9,773 bytes, line 38
38a(N,v.props.children),g.return=x,x=g;break e}}else if(N.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===va&&S2(S)===N.type){s(x,N.sibling),g=a(N,v.props),g.ref=sd(x,N,v),g.return=x,x=g;break e}s(x,N);break}else t(x,N);N=N.sibling}v.type===nl?(g=ai(v.props.children,x.mode,k,v.key),g.return=x,x=g):(k=Eh(v.type,v.key,v.props,null,x.mode,k),k.ref=sd(x,g,v),k.return=x,x=k)}return i(x);case sl:e:{for(N=v.key;g!==null;){if(g.key===N)if(g.tag===4&&g.stateNode.containerInfo===v.containerInfo&&g.stateNode.implementation===v.implementation){s(x,g.sibling),g=a(g,v.children||[]),g.return=x,x=g;break e}else{s(x,g);break}else t(x,g);g=g.sibling}g=Hx(v,x.mode,k),g.return=x,x=g}return i(x);case va:return N=v._init,w(x,g,N(v._payload),k)}if(pd(v))return y(x,g,v,k);if(Qc(v))return b(x,g,v,k);Df(x,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,g!==null&&g.tag===6?(s(x,g.sibling),g=a(g,v),g.return=x,x=g):(s(x,g),g=Wx(v,x.mode,k),g.return=x,x=g),i(x)):s(x,g)}return w}var Ql=d_(!0),u_=d_(!1),ap=go(null),op=null,ul=null,Kb=null;function qb(){Kb=ul=op=null}function Zb(e){var t=ap.current;vt(ap),e._currentValue=t}function w0(e,t,s){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===s)break;e=e.return}}function jl(e,t){op=e,Kb=ul=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ms=!0),e.firstContext=null)}function Nn(e){var t=e._currentValue;if(Kb!==e)if(e={context:e,memoizedValue:t,next:null},ul===null){if(op===null)throw Error(se(308));ul=e,op.dependencies={lanes:0,firstContext:e}}else ul=ul.next=e;return t}var Bo=null;function Yb(e){Bo===null?Bo=[e]:Bo.push(e)}function f_(e,t,s,r){var a=t.interleaved;return a===null?(s.next=s,Yb(t)):(s.next=a.next,a.next=s),t.interleaved=s,Zr(e,r)}function Zr(e,t){e.lanes|=t;var s=e.alternate;for(s!==null&&(s.lanes|=t),s=e,e=e.return;e!==null;)e.childLanes|=t,s=e.alternate,s!==null&&(s.childLanes|=t),s=e,e=e.return;return s.tag===3?s.stateNode:null}var wa=!1;function Qb(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function h_(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 Gr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Va(e,t,s){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,nt&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,Zr(e,s)}return a=r.interleaved,a===null?(t.next=t,Yb(r)):(t.next=a.next,a.next=t),r.interleaved=t,Zr(e,s)}function kh(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,s|=r,t.lanes=s,Ib(e,s)}}function N2(e,t){var s=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,s===r)){var a=null,o=null;if(s=s.firstBaseUpdate,s!==null){do{var i={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};o===null?a=o=i:o=o.next=i,s=s.next}while(s!==null);o===null?a=o=t:o=o.next=t}else a=o=t;s={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}function ip(e,t,s,r){var a=e.updateQueue;wa=!1;var o=a.firstBaseUpdate,i=a.lastBaseUpdate,l=a.shared.pending;if(l!==null){a.shared.pending=null;var c=l,d=c.next;c.next=null,i===null?o=d:i.next=d,i=c;var u=e.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==i&&(l===null?u.firstBaseUpdate=d:l.next=d,u.lastBaseUpdate=c))}if(o!==null){var f=a.baseState;i=0,u=d=c=null,l=o;do{var h=l.lane,m=l.eventTime;if((r&h)===h){u!==null&&(u=u.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var y=e,b=l;switch(h=t,m=s,b.tag){case 1:if(y=b.payload,typeof y=="function"){f=y.call(m,f,h);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=b.payload,h=typeof y=="function"?y.call(m,f,h):y,h==null)break e;f=Tt({},f,h);break e;case 2:wa=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,h=a.effects,h===null?a.effects=[l]:h.push(l))}else m={eventTime:m,lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(d=u=m,c=f):u=u.next=m,i|=h;if(l=l.next,l===null){if(l=a.shared.pending,l===null)break;h=l,l=h.next,h.next=null,a.lastBaseUpdate=h,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 i|=a.lane,a=a.next;while(a!==t)}else o===null&&(a.shared.lanes=0);hi|=i,e.lanes=i,e.memoizedState=f}}function C2(e,t,s){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=s,typeof a!="function")throw Error(se(191,a));a.call(r)}}}var Zu={},mr=go(Zu),su=go(Zu),nu=go(Zu);function Fo(e){if(e===Zu)throw Error(se(174));return e}function Jb(e,t){switch(xt(nu,t),xt(su,e),xt(mr,Zu),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:t0(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=t0(t,e)}vt(mr),xt(mr,t)}function Jl(){vt(mr),vt(su),vt(nu)}function p_(e){Fo(nu.current);var t=Fo(mr.current),s=t0(t,e.type);t!==s&&(xt(su,e),xt(mr,s))}function Xb(e){su.current===e&&(vt(mr),vt(su))}var Ct=go(0);function lp(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||s.data==="$?"||s.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 Mx=[];function ey(){for(var e=0;e<Mx.length;e++)Mx[e]._workInProgressVersionPrimary=null;Mx.length=0}var Sh=na.ReactCurrentDispatcher,$x=na.ReactCurrentBatchConfig,fi=0,_t=null,qt=null,ss=null,cp=!1,Rd=!1,ru=0,mI=0;function hs(){throw Error(se(321))}function ty(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!qn(e[s],t[s]))return!1;return!0}function sy(e,t,s,r,a,o){if(fi=o,_t=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Sh.current=e===null||e.memoizedState===null?yI:vI,e=s(r,a),Rd){o=0;do{if(Rd=!1,ru=0,25<=o)throw Error(se(301));o+=1,ss=qt=null,t.updateQueue=null,Sh.current=wI,e=s(r,a)}while(Rd)}if(Sh.current=dp,t=qt!==null&&qt.next!==null,fi=0,ss=qt=_t=null,cp=!1,t)throw Error(se(300));return e}function ny(){var e=ru!==0;return ru=0,e}function rr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ss===null?_t.memoizedState=ss=e:ss=ss.next=e,ss}function Cn(){if(qt===null){var e=_t.alternate;e=e!==null?e.memoizedState:null}else e=qt.next;var t=ss===null?_t.memoizedState:ss.next;if(t!==null)ss=t,qt=e;else{if(e===null)throw Error(se(310));qt=e,e={memoizedState:qt.memoizedState,baseState:qt.baseState,baseQueue:qt.baseQueue,queue:qt.queue,next:null},ss===null?_t.memoizedState=ss=e:ss=ss.next=e}return ss}function au(e,t){return typeof t=="function"?t(e):t}function Ux(e){var t=Cn(),s=t.queue;if(s===null)throw Error(se(311));s.lastRenderedReducer=e;var r=qt,a=r.baseQueue,o=s.pending;if(o!==null){if(a!==null){var i=a.next;a.next=o.next,o.next=i}r.baseQueue=a=o,s.pending=null}if(a!==null){o=a.next,r=r.baseState;var l=i=null,c=null,d=o;do{var u=d.lane;if((fi&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,i=r):c=c.next=f,_t.lanes|=u,hi|=u}d=d.next}while(d!==null&&d!==o);c===null?i=r:c.next=l,qn(r,t.memoizedState)||(Ms=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=c,s.lastRenderedState=r}if(e=s.interleaved,e!==null){a=e;do o=a.lane,_t.lanes|=o,hi|=o,a=a.next;while(a!==e)}else a===null&&(s.lanes=0);return[t.memoizedState,s.dispatch]}function zx(e){var t=Cn(),s=t.queue;if(s===null)throw Error(se(311));s.lastRenderedReducer=e;var r=s.dispatch,a=s.pending,o=t.memoizedState;if(a!==null){s.pending=null;var i=a=a.next;do o=e(o,i.action),i=i.next;while(i!==a);qn(o,t.memoizedState)||(Ms=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),s.lastRenderedState=o}return[o,r]}function m_(){}function x_(e,t){var s=_t,r=Cn(),a=t(),o=!qn(r.memoizedState,a);if(o&&(r.memoizedState=a,Ms=!0),r=r.queue,ry(y_.bind(null,s,r,e),[e]),r.getSnapshot!==t||o||ss!==null&&ss.memoizedState.tag&1){if(s.flags|=2048,ou(9,b_.bind(null,s,r,a,t),void 0,null),ns===null)throw Error(se(349));fi&30||g_(s,t,a)}return a}function g_(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=_t.updateQueue,t===null?(t={lastEffect:null,stores:null},_t.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function b_(e,t,s,r){t.value=s,t.getSnapshot=r,v_(t)&&w_(e)}function y_(e,t,s){return s(function(){v_(t)&&w_(e)})}function v_(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!qn(e,s)}catch{return!0}}function w_(e){var t=Zr(e,1);t!==null&&Kn(t,e,1,-1)}function _2(e){var t=rr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:au,lastRenderedState:e},t.queue=e,e=e.dispatch=bI.bind(null,_t,e),[t.memoizedState,e]}function ou(e,t,s,r){return e={tag:e,create:t,destroy:s,deps:r,next:null},t=_t.updateQueue,t===null?(t={lastEffect:null,stores:null},_t.updateQueue=t,t.lastEffect=e.next=e):(s=t.lastEffect,s===null?t.lastEffect=e.next=e:(r=s.next,
vendor: 4,291 bytes, line 38
38s.next=e,e.next=r,t.lastEffect=e)),e}function j_(){return Cn().memoizedState}function Nh(e,t,s,r){var a=rr();_t.flags|=e,a.memoizedState=ou(1|t,s,void 0,r===void 0?null:r)}function cm(e,t,s,r){var a=Cn();r=r===void 0?null:r;var o=void 0;if(qt!==null){var i=qt.memoizedState;if(o=i.destroy,r!==null&&ty(r,i.deps)){a.memoizedState=ou(t,s,o,r);return}}_t.flags|=e,a.memoizedState=ou(1|t,s,o,r)}function T2(e,t){return Nh(8390656,8,e,t)}function ry(e,t){return cm(2048,8,e,t)}function k_(e,t){return cm(4,2,e,t)}function S_(e,t){return cm(4,4,e,t)}function N_(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 C_(e,t,s){return s=s!=null?s.concat([e]):null,cm(4,4,N_.bind(null,t,e),s)}function ay(){}function __(e,t){var s=Cn();t=t===void 0?null:t;var r=s.memoizedState;return r!==null&&t!==null&&ty(t,r[1])?r[0]:(s.memoizedState=[e,t],e)}function T_(e,t){var s=Cn();t=t===void 0?null:t;var r=s.memoizedState;return r!==null&&t!==null&&ty(t,r[1])?r[0]:(e=e(),s.memoizedState=[e,t],e)}function E_(e,t,s){return fi&21?(qn(s,t)||(s=L5(),_t.lanes|=s,hi|=s,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ms=!0),e.memoizedState=s)}function xI(e,t){var s=dt;dt=s!==0&&4>s?s:4,e(!0);var r=$x.transition;$x.transition={};try{e(!1),t()}finally{dt=s,$x.transition=r}}function R_(){return Cn().memoizedState}function gI(e,t,s){var r=qa(e);if(s={lane:r,action:s,hasEagerState:!1,eagerState:null,next:null},A_(e))P_(t,s);else if(s=f_(e,t,s,r),s!==null){var a=Ns();Kn(s,e,r,a),O_(s,t,r)}}function bI(e,t,s){var r=qa(e),a={lane:r,action:s,hasEagerState:!1,eagerState:null,next:null};if(A_(e))P_(t,a);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,l=o(i,s);if(a.hasEagerState=!0,a.eagerState=l,qn(l,i)){var c=t.interleaved;c===null?(a.next=a,Yb(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}s=f_(e,t,a,r),s!==null&&(a=Ns(),Kn(s,e,r,a),O_(s,t,r))}}function A_(e){var t=e.alternate;return e===_t||t!==null&&t===_t}function P_(e,t){Rd=cp=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function O_(e,t,s){if(s&4194240){var r=t.lanes;r&=e.pendingLanes,s|=r,t.lanes=s,Ib(e,s)}}var dp={readContext:Nn,useCallback:hs,useContext:hs,useEffect:hs,useImperativeHandle:hs,useInsertionEffect:hs,useLayoutEffect:hs,useMemo:hs,useReducer:hs,useRef:hs,useState:hs,useDebugValue:hs,useDeferredValue:hs,useTransition:hs,useMutableSource:hs,useSyncExternalStore:hs,useId:hs,unstable_isNewReconciler:!1},yI={readContext:Nn,useCallback:function(e,t){return rr().memoizedState=[e,t===void 0?null:t],e},useContext:Nn,useEffect:T2,useImperativeHandle:function(e,t,s){return s=s!=null?s.concat([e]):null,Nh(4194308,4,N_.bind(null,t,e),s)},useLayoutEffect:function(e,t){return Nh(4194308,4,e,t)},useInsertionEffect:function(e,t){return Nh(4,2,e,t)},useMemo:function(e,t){var s=rr();return t=t===void 0?null:t,e=e(),s.memoizedState=[e,t],e},useReducer:function(e,t,s){var r=rr();return t=s!==void 0?s(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=gI.bind(null,_t,e),[r.memoizedState,e]},useRef:function(e){var t=rr();return e={current:e},t.memoizedState=e},useState:_2,useDebugValue:ay,useDeferredValue:function(e){return rr().memoizedState=e},useTransition:function(){var e=_2(!1),t=e[0];return e=xI.bind(null,e[1]),rr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,s){var r=_t,a=rr();if(jt){if(s===void 0)throw Error(se(407));s=s()}else{if(s=t(),ns===null)throw Error(se(349));fi&30||g_(r,t,s)}a.memoizedState=s;var o={value:s,getSnapshot:t};return a.queue=o,T2(y_.bind(null,r,o,e),[e]),r.flags|=2048,ou(9,b_.bind(null,r,o,s,t),void 0,null),s},useId:function(){var e=rr(),t=ns.identifierPrefix;if(jt){var s=Wr,r=Fr;s=(r&~(1<<32-Vn(r)-1)).toString(32)+s,t=":"+t+"R"+s,s=ru++,0<s&&(t+="H"+s.toString(32)),t+=":"}else s=mI++,t=":"+t+"r"+s.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},vI={readContext:Nn,useCallback:__,useContext:Nn,useEffect:ry,useImperativeHandle:C_,useInsertionEffect:k_,useLayoutEffect:S_,useMemo:T_,useReducer:Ux,useRef
vendor: 6,411 bytes, lines 38-40
38:j_,useState:function(){return Ux(au)},useDebugValue:ay,useDeferredValue:function(e){var t=Cn();return E_(t,qt.memoizedState,e)},useTransition:function(){var e=Ux(au)[0],t=Cn().memoizedState;return[e,t]},useMutableSource:m_,useSyncExternalStore:x_,useId:R_,unstable_isNewReconciler:!1},wI={readContext:Nn,useCallback:__,useContext:Nn,useEffect:ry,useImperativeHandle:C_,useInsertionEffect:k_,useLayoutEffect:S_,useMemo:T_,useReducer:zx,useRef:j_,useState:function(){return zx(au)},useDebugValue:ay,useDeferredValue:function(e){var t=Cn();return qt===null?t.memoizedState=e:E_(t,qt.memoizedState,e)},useTransition:function(){var e=zx(au)[0],t=Cn().memoizedState;return[e,t]},useMutableSource:m_,useSyncExternalStore:x_,useId:R_,unstable_isNewReconciler:!1};function In(e,t){if(e&&e.defaultProps){t=Tt({},t),e=e.defaultProps;for(var s in e)t[s]===void 0&&(t[s]=e[s]);return t}return t}function j0(e,t,s,r){t=e.memoizedState,s=s(r,t),s=s==null?t:Tt({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var dm={isMounted:function(e){return(e=e._reactInternals)?Ai(e)===e:!1},enqueueSetState:function(e,t,s){e=e._reactInternals;var r=Ns(),a=qa(e),o=Gr(r,a);o.payload=t,s!=null&&(o.callback=s),t=Va(e,o,a),t!==null&&(Kn(t,e,a,r),kh(t,e,a))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var r=Ns(),a=qa(e),o=Gr(r,a);o.tag=1,o.payload=t,s!=null&&(o.callback=s),t=Va(e,o,a),t!==null&&(Kn(t,e,a,r),kh(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=Ns(),r=qa(e),a=Gr(s,r);a.tag=2,t!=null&&(a.callback=t),t=Va(e,a,r),t!==null&&(Kn(t,e,r,s),kh(t,e,r))}};function E2(e,t,s,r,a,o,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,o,i):t.prototype&&t.prototype.isPureReactComponent?!Jd(s,r)||!Jd(a,o):!0}function L_(e,t,s){var r=!1,a=no,o=t.contextType;return typeof o=="object"&&o!==null?o=Nn(o):(a=zs(t)?di:bs.current,r=t.contextTypes,o=(r=r!=null)?Zl(e,a):no),t=new t(s,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=dm,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=o),t}function R2(e,t,s,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,r),t.state!==e&&dm.enqueueReplaceState(t,t.state,null)}function k0(e,t,s,r){var a=e.stateNode;a.props=s,a.state=e.memoizedState,a.refs={},Qb(e);var o=t.contextType;typeof o=="object"&&o!==null?a.context=Nn(o):(o=zs(t)?di:bs.current,a.context=Zl(e,o)),a.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(j0(e,t,o,s),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&&dm.enqueueReplaceState(a,a.state,null),ip(e,s,a,r),a.state=e.memoizedState),typeof a.componentDidMount=="function"&&(e.flags|=4194308)}function Xl(e,t){try{var s="",r=t;do s+=ZL(r),r=r.return;while(r);var a=s}catch(o){a=`
39Error generating stack: `+o.message+`
40`+o.stack}return{value:e,source:t,stack:a,digest:null}}function Bx(e,t,s){return{value:e,source:null,stack:s??null,digest:t??null}}function S0(e,t){try{console.error(t.value)}catch(s){setTimeout(function(){throw s})}}var jI=typeof WeakMap=="function"?WeakMap:Map;function D_(e,t,s){s=Gr(-1,s),s.tag=3,s.payload={element:null};var r=t.value;return s.callback=function(){fp||(fp=!0,L0=r),S0(e,t)},s}function I_(e,t,s){s=Gr(-1,s),s.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var a=t.value;s.payload=function(){return r(a)},s.callback=function(){S0(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(s.callback=function(){S0(e,t),typeof r!="function"&&(Ka===null?Ka=new Set([this]):Ka.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),s}function A2(e,t,s){var r=e.pingCache;if(r===null){r=e.pingCache=new jI;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(s)||(a.add(s),e=II.bind(null,e,t,s),t.then(e,e))}function P2(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 O2(e,t,s,r,a){return e.mode&1?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(t=Gr(-1,1),t.tag=2,Va(s,t,1))),s.lanes|=1),e)}var kI=na.ReactCurrentOwner,Ms=!1;function ks(e,t,s,r){t.child=e===null?u_(t,null,s,r):Ql(t,e.child,s,r)}function L2(e,t,s,r,a){s=s.render;var o=t.ref;return jl(t,a),r=sy(e,t,s,r,o,a),s=ny(),e!==null&&!Ms?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Yr(e,t,a)):(jt&&s&&Hb(t),t.flags|=1,ks(e,t,r,a),t.child)}function D2(e,t,s,r,a){if(e===null){var o=s.type;return typeof o=="function"&&!hy(o)&&o.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(t.tag=15,t.type=o,M_(e,t,o,r,a)):(e=Eh(s.type,null,r,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&a)){var i=o.memoizedProps;if(s=s.compare,s=s!==null?s:Jd,s(i,r)&&e.ref===t.ref)return Yr(e,t,a)}return t.flags|=1,e=Za(o,r),e.ref=t.ref,e.return=t,t.child=e}function M_(e,t,s,r,a){if(e!==null){var o=e.memoizedProps;if(Jd(o,r)&&e.ref===t.ref)if(Ms=!1,t.pendingProps=r=o,(e.lanes&a)!==0)e.flags&131072&&(Ms=!0);else return t.lanes=e.lanes,Yr(e,t,a)}return N0(e,t,s,r,a)}function $_(e,t,s){var r=t.pendingProps,a=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},xt(hl,Ks),Ks|=s;else{if(!(s&1073741824))return e=o!==null?o.baseLanes|s:s,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,xt(hl,Ks),Ks|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:s,xt(hl,Ks),Ks|=r}else o!==null?(r=o.baseLanes|s,t.memoizedState=null):r=s,xt(hl,Ks),Ks|=r;return ks(e,t,a,s),t.child}function U_(e,t){var s=t.ref;(e===null&&s!==null||e!==null&&e.ref!==s)&&(t.flags|=512,t.flags|=2097152)}
vendor: 1,636 bytes, line 40
40function N0(e,t,s,r,a){var o=zs(s)?di:bs.current;return o=Zl(t,o),jl(t,a),s=sy(e,t,s,r,o,a),r=ny(),e!==null&&!Ms?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Yr(e,t,a)):(jt&&r&&Hb(t),t.flags|=1,ks(e,t,s,a),t.child)}function I2(e,t,s,r,a){if(zs(s)){var o=!0;sp(t)}else o=!1;if(jl(t,a),t.stateNode===null)Ch(e,t),L_(t,s,r),k0(t,s,r,a),r=!0;else if(e===null){var i=t.stateNode,l=t.memoizedProps;i.props=l;var c=i.context,d=s.contextType;typeof d=="object"&&d!==null?d=Nn(d):(d=zs(s)?di:bs.current,d=Zl(t,d));var u=s.getDerivedStateFromProps,f=typeof u=="function"||typeof i.getSnapshotBeforeUpdate=="function";f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==r||c!==d)&&R2(t,i,r,d),wa=!1;var h=t.memoizedState;i.state=h,ip(t,r,i,a),c=t.memoizedState,l!==r||h!==c||Us.current||wa?(typeof u=="function"&&(j0(t,s,u,r),c=t.memoizedState),(l=wa||E2(t,s,l,r,h,c,d))?(f||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),i.props=r,i.state=c,i.context=d,r=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,h_(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:In(t.type,l),i.props=d,f=t.pendingProps,h=i.context,c=s.contextType,typeof c=="object"&&c!==null?c=Nn(c):(c=zs(s)?di:bs.current,c=Zl(t,c)
vendor: 4,611 bytes, line 40
40);var m=s.getDerivedStateFromProps;(u=typeof m=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==f||h!==c)&&R2(t,i,r,c),wa=!1,h=t.memoizedState,i.state=h,ip(t,r,i,a);var y=t.memoizedState;l!==f||h!==y||Us.current||wa?(typeof m=="function"&&(j0(t,s,m,r),y=t.memoizedState),(d=wa||E2(t,s,d,r,h,y,c)||!1)?(u||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,y,c),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,y,c)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),i.props=r,i.state=y,i.context=c,r=d):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return C0(e,t,s,r,o,a)}function C0(e,t,s,r,a,o){U_(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return a&&w2(t,s,!1),Yr(e,t,o);r=t.stateNode,kI.current=t;var l=i&&typeof s.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=Ql(t,e.child,null,o),t.child=Ql(t,null,l,o)):ks(e,t,l,o),t.memoizedState=r.state,a&&w2(t,s,!0),t.child}function z_(e){var t=e.stateNode;t.pendingContext?v2(e,t.pendingContext,t.pendingContext!==t.context):t.context&&v2(e,t.context,!1),Jb(e,t.containerInfo)}function M2(e,t,s,r,a){return Yl(),Vb(a),t.flags|=256,ks(e,t,s,r),t.child}var _0={dehydrated:null,treeContext:null,retryLane:0};function T0(e){return{baseLanes:e,cachePool:null,transitions:null}}function B_(e,t,s){var r=t.pendingProps,a=Ct.current,o=!1,i=(t.flags&128)!==0,l;if((l=i)||(l=e!==null&&e.memoizedState===null?!1:(a&2)!==0),l?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(a|=1),xt(Ct,a&1),e===null)return v0(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):(i=r.children,e=r.fallback,o?(r=t.mode,o=t.child,i={mode:"hidden",children:i},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=i):o=hm(i,r,0,null),e=ai(e,r,s,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=T0(s),t.memoizedState=_0,e):oy(t,i));if(a=e.memoizedState,a!==null&&(l=a.dehydrated,l!==null))return SI(e,t,i,r,l,a,s);if(o){o=r.fallback,i=t.mode,a=e.child,l=a.sibling;var c={mode:"hidden",children:r.children};return!(i&1)&&t.child!==a?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Za(a,c),r.subtreeFlags=a.subtreeFlags&14680064),l!==null?o=Za(l,o):(o=ai(o,i,s,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,i=e.child.memoizedState,i=i===null?T0(s):{baseLanes:i.baseLanes|s,cachePool:null,transitions:i.transitions},o.memoizedState=i,o.childLanes=e.childLanes&~s,t.memoizedState=_0,r}return o=e.child,e=o.sibling,r=Za(o,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=s),r.return=t,r.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=r,t.memoizedState=null,r}function oy(e,t){return t=hm({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function If(e,t,s,r){return r!==null&&Vb(r),Ql(t,e.child,null,s),e=oy(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function SI(e,t,s,r,a,o,i){if(s)return t.flags&256?(t.flags&=-257,r=Bx(Error(se(422))),If(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,a=t.mode,r=hm({mode:"visible",children:r.children},a,0,null),o=ai(o,a,i,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&Ql(t,e.child,null,i),t.child.memoizedState=T0(i),t.memoizedState=_0,o);if(!(t.mode&1))return If(e,t,i,null);if(a.data==="$!"){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,o=Error(se(419)),r=Bx(o,r,void 0),If(e,t,i,r)}if(l=(i&e.childLanes)!==0,Ms||l){if(r=ns,r!==null){switch(i&-i){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}
vendor: 4,665 bytes, line 40
40a=a&(r.suspendedLanes|i)?0:a,a!==0&&a!==o.retryLane&&(o.retryLane=a,Zr(e,a),Kn(r,e,a,-1))}return fy(),r=Bx(Error(se(421))),If(e,t,i,r)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=MI.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Xs=Ga(a.nextSibling),tn=t,jt=!0,zn=null,e!==null&&(bn[yn++]=Fr,bn[yn++]=Wr,bn[yn++]=ui,Fr=e.id,Wr=e.overflow,ui=t),t=oy(t,r.children),t.flags|=4096,t)}function $2(e,t,s){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),w0(e.return,t,s)}function Fx(e,t,s,r,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:s,tailMode:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=s,o.tailMode=a)}function F_(e,t,s){var r=t.pendingProps,a=r.revealOrder,o=r.tail;if(ks(e,t,r.children,s),r=Ct.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&&$2(e,s,t);else if(e.tag===19)$2(e,s,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(xt(Ct,r),!(t.mode&1))t.memoizedState=null;else switch(a){case"forwards":for(s=t.child,a=null;s!==null;)e=s.alternate,e!==null&&lp(e)===null&&(a=s),s=s.sibling;s=a,s===null?(a=t.child,t.child=null):(a=s.sibling,s.sibling=null),Fx(t,!1,a,s,o);break;case"backwards":for(s=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&lp(e)===null){t.child=a;break}e=a.sibling,a.sibling=s,s=a,a=e}Fx(t,!0,s,null,o);break;case"together":Fx(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ch(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Yr(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),hi|=t.lanes,!(s&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(se(153));if(t.child!==null){for(e=t.child,s=Za(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=Za(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function NI(e,t,s){switch(t.tag){case 3:z_(t),Yl();break;case 5:p_(t);break;case 1:zs(t.type)&&sp(t);break;case 4:Jb(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;xt(ap,r._currentValue),r._currentValue=a;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(xt(Ct,Ct.current&1),t.flags|=128,null):s&t.child.childLanes?B_(e,t,s):(xt(Ct,Ct.current&1),e=Yr(e,t,s),e!==null?e.sibling:null);xt(Ct,Ct.current&1);break;case 19:if(r=(s&t.childLanes)!==0,e.flags&128){if(r)return F_(e,t,s);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),xt(Ct,Ct.current),r)break;return null;case 22:case 23:return t.lanes=0,$_(e,t,s)}return Yr(e,t,s)}var W_,E0,H_,G_;W_=function(e,t){for(var s=t.child;s!==null;){if(s.tag===5||s.tag===6)e.appendChild(s.stateNode);else if(s.tag!==4&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return;s=s.return}s.sibling.return=s.return,s=s.sibling}};E0=function(){};H_=function(e,t,s,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,Fo(mr.current);var o=null;switch(s){case"input":a=Qg(e,a),r=Qg(e,r),o=[];break;case"select":a=Tt({},a,{value:void 0}),r=Tt({},r,{value:void 0}),o=[];break;case"textarea":a=e0(e,a),r=e0(e,r),o=[];break;default:typeof a.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=ep)}s0(s,r);var i;s=null;for(d in a)if(!r.hasOwnProperty(d)&&a.hasOwnProperty(d)&&a[d]!=null)if(d==="style"){var l=a[d];for(i in l)l.hasOwnProperty(i)&&(s||(s={}),s[i]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(Gd.hasOwnProperty(d)?o||(o=[]):(o=o||[]).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(i in l)!l.hasOwnProperty(i)||c&&c.hasOwnProperty(i)||(s||(s={}),s[i]="");for(i in c)c.hasOwnProperty(i)&&l[i]!==c[i]&&(s||(s={}),s[i]=c[i])}else s||(o||(o=[]),o.push(d,s)),s=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(o=o||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(o=o||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(Gd.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&bt("scroll",e),o||l===c||(o=[])):(o=o||[]).push(d,c))}s&&(o=o||[]).push("style",s);var d=o;(t.updateQueue=d)&&(t.flags|=4)}};G_=function(e,t,s,r){s!==r&&(t.flags|=4)};
vendor: 31,492 bytes, line 40
40function nd(e,t){if(!jt)switch(e.tailMode){case"hidden":t=e.tail;for(var s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var r=null;s!==null;)s.alternate!==null&&(r=s),s=s.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ps(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,r=0;if(t)for(var a=e.child;a!==null;)s|=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;)s|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=s,t}function CI(e,t,s){var r=t.pendingProps;switch(Gb(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ps(t),null;case 1:return zs(t.type)&&tp(),ps(t),null;case 3:return r=t.stateNode,Jl(),vt(Us),vt(bs),ey(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Lf(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,zn!==null&&(M0(zn),zn=null))),E0(e,t),ps(t),null;case 5:Xb(t);var a=Fo(nu.current);if(s=t.type,e!==null&&t.stateNode!=null)H_(e,t,s,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(se(166));return ps(t),null}if(e=Fo(mr.current),Lf(t)){r=t.stateNode,s=t.type;var o=t.memoizedProps;switch(r[dr]=t,r[tu]=o,e=(t.mode&1)!==0,s){case"dialog":bt("cancel",r),bt("close",r);break;case"iframe":case"object":case"embed":bt("load",r);break;case"video":case"audio":for(a=0;a<xd.length;a++)bt(xd[a],r);break;case"source":bt("error",r);break;case"img":case"image":case"link":bt("error",r),bt("load",r);break;case"details":bt("toggle",r);break;case"input":Kw(r,o),bt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},bt("invalid",r);break;case"textarea":Zw(r,o),bt("invalid",r)}s0(s,o),a=null;for(var i in o)if(o.hasOwnProperty(i)){var l=o[i];i==="children"?typeof l=="string"?r.textContent!==l&&(o.suppressHydrationWarning!==!0&&Of(r.textContent,l,e),a=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(o.suppressHydrationWarning!==!0&&Of(r.textContent,l,e),a=["children",""+l]):Gd.hasOwnProperty(i)&&l!=null&&i==="onScroll"&&bt("scroll",r)}switch(s){case"input":Nf(r),qw(r,o,!0);break;case"textarea":Nf(r),Yw(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=ep)}r=a,t.updateQueue=r,r!==null&&(t.flags|=4)}else{i=a.nodeType===9?a:a.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=y5(s)),e==="http://www.w3.org/1999/xhtml"?s==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(s,{is:r.is}):(e=i.createElement(s),s==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,s),e[dr]=t,e[tu]=r,W_(e,t,!1,!1),t.stateNode=e;e:{switch(i=n0(s,r),s){case"dialog":bt("cancel",e),bt("close",e),a=r;break;case"iframe":case"object":case"embed":bt("load",e),a=r;break;case"video":case"audio":for(a=0;a<xd.length;a++)bt(xd[a],e);a=r;break;case"source":bt("error",e),a=r;break;case"img":case"image":case"link":bt("error",e),bt("load",e),a=r;break;case"details":bt("toggle",e),a=r;break;case"input":Kw(e,r),a=Qg(e,r),bt("invalid",e);break;case"option":a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=Tt({},r,{value:void 0}),bt("invalid",e);break;case"textarea":Zw(e,r),a=e0(e,r),bt("invalid",e);break;default:a=r}s0(s,a),l=a;for(o in l)if(l.hasOwnProperty(o)){var c=l[o];o==="style"?j5(e,c):o==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&v5(e,c)):o==="children"?typeof c=="string"?(s!=="textarea"||c!=="")&&Vd(e,c):typeof c=="number"&&Vd(e,""+c):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Gd.hasOwnProperty(o)?c!=null&&o==="onScroll"&&bt("scroll",e):c!=null&&Rb(e,o,c,i))}switch(s){case"input":Nf(e),qw(e,r,!1);break;case"textarea":Nf(e),Yw(e);break;case"option":r.value!=null&&e.setAttribute("value",""+so(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?bl(e,!!r.multiple,o,!1):r.defaultValue!=null&&bl(e,!!r.multiple,r.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=ep)}switch(s){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)}return ps(t),null;case 6:if(e&&t.stateNode!=null)G_(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(se(166));if(s=Fo(nu.current),Fo(mr.current),Lf(t)){if(r=t.stateNode,s=t.memoizedProps,r[dr]=t,(o=r.nodeValue!==s)&&(e=tn,e!==null))switch(e.tag){case 3:Of(r.nodeValue,s,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Of(r.nodeValue,s,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(s.nodeType===9?s:s.ownerDocument).createTextNode(r),r[dr]=t,t.stateNode=r}return ps(t),null;case 13:if(vt(Ct),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(jt&&Xs!==null&&t.mode&1&&!(t.flags&128))c_(),Yl(),t.flags|=98560,o=!1;else if(o=Lf(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(se(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(se(317));o[dr]=t}else Yl(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ps(t),o=!1}else zn!==null&&(M0(zn),zn=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=s,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Ct.current&1?Yt===0&&(Yt=3):fy())),t.updateQueue!==null&&(t.flags|=4),ps(t),null);case 4:return Jl(),E0(e,t),e===null&&Xd(t.stateNode.containerInfo),ps(t),null;case 10:return Zb(t.type._context),ps(t),null;case 17:return zs(t.type)&&tp(),ps(t),null;case 19:if(vt(Ct),o=t.memoizedState,o===null)return ps(t),null;if(r=(t.flags&128)!==0,i=o.rendering,i===null)if(r)nd(o,!1);else{if(Yt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=lp(e),i!==null){for(t.flags|=128,nd(o,!1),r=i.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=s,s=t.child;s!==null;)o=s,e=r,o.flags&=14680066,i=o.alternate,i===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,o.type=i.type,e=i.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),s=s.sibling;return xt(Ct,Ct.current&1|2),t.child}e=e.sibling}o.tail!==null&&Ut()>ec&&(t.flags|=128,r=!0,nd(o,!1),t.lanes=4194304)}else{if(!r)if(e=lp(i),e!==null){if(t.flags|=128,r=!0,s=e.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),nd(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!jt)return ps(t),null}else 2*Ut()-o.renderingStartTime>ec&&s!==1073741824&&(t.flags|=128,r=!0,nd(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(s=o.last,s!==null?s.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ut(),t.sibling=null,s=Ct.current,xt(Ct,r?s&1|2:s&1),t):(ps(t),null);case 22:case 23:return uy(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ks&1073741824&&(ps(t),t.subtreeFlags&6&&(t.flags|=8192)):ps(t),null;case 24:return null;case 25:return null}throw Error(se(156,t.tag))}function _I(e,t){switch(Gb(t),t.tag){case 1:return zs(t.type)&&tp(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Jl(),vt(Us),vt(bs),ey(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Xb(t),null;case 13:if(vt(Ct),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(se(340));Yl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return vt(Ct),null;case 4:return Jl(),null;case 10:return Zb(t.type._context),null;case 22:case 23:return uy(),null;case 24:return null;default:return null}}var Mf=!1,gs=!1,TI=typeof WeakSet=="function"?WeakSet:Set,me=null;function fl(e,t){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(r){Lt(e,t,r)}else s.current=null}function R0(e,t,s){try{s()}catch(r){Lt(e,t,r)}}var U2=!1;function EI(e,t){if(h0=Qh,e=Y5(),Wb(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var r=s.getSelection&&s.getSelection();if(r&&r.rangeCount!==0){s=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{s.nodeType,o.nodeType}catch{s=null;break e}var i=0,l=-1,c=-1,d=0,u=0,f=e,h=null;t:for(;;){for(var m;f!==s||a!==0&&f.nodeType!==3||(l=i+a),f!==o||r!==0&&f.nodeType!==3||(c=i+r),f.nodeType===3&&(i+=f.nodeValue.length),(m=f.firstChild)!==null;)h=f,f=m;for(;;){if(f===e)break t;if(h===s&&++d===a&&(l=i),h===o&&++u===r&&(c=i),(m=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=m}s=l===-1||c===-1?null:{start:l,end:c}}else s=null}s=s||{start:0,end:0}}else s=null;for(p0={focusedElem:e,selectionRange:s},Qh=!1,me=t;me!==null;)if(t=me,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,me=e;else for(;me!==null;){t=me;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var b=y.memoizedProps,w=y.memoizedState,x=t.stateNode,g=x.getSnapshotBeforeUpdate(t.elementType===t.type?b:In(t.type,b),w);x.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(se(163))}}catch(k){Lt(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,me=e;break}me=t.return}return y=U2,U2=!1,y}function Ad(e,t,s){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 o=a.destroy;a.destroy=void 0,o!==void 0&&R0(t,s,o)}a=a.next}while(a!==r)}}function um(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var s=t=t.next;do{if((s.tag&e)===e){var r=s.create;s.destroy=r()}s=s.next}while(s!==t)}}function A0(e){var t=e.ref;if(t!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof t=="function"?t(e):t.current=e}}function V_(e){var t=e.alternate;t!==null&&(e.alternate=null,V_(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[dr],delete t[tu],delete t[g0],delete t[uI],delete t[fI])),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 K_(e){return e.tag===5||e.tag===3||e.tag===4}function z2(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||K_(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 P0(e,t,s){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?s.nodeType===8?s.parentNode.insertBefore(e,t):s.insertBefore(e,t):(s.nodeType===8?(t=s.parentNode,t.insertBefore(e,s)):(t=s,t.appendChild(e)),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=ep));else if(r!==4&&(e=e.child,e!==null))for(P0(e,t,s),e=e.sibling;e!==null;)P0(e,t,s),e=e.sibling}function O0(e,t,s){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(O0(e,t,s),e=e.sibling;e!==null;)O0(e,t,s),e=e.sibling}var ls=null,Un=!1;function ha(e,t,s){for(s=s.child;s!==null;)q_(e,t,s),s=s.sibling}function q_(e,t,s){if(pr&&typeof pr.onCommitFiberUnmount=="function")try{pr.onCommitFiberUnmount(nm,s)}catch{}switch(s.tag){case 5:gs||fl(s,t);case 6:var r=ls,a=Un;ls=null,ha(e,t,s),ls=r,Un=a,ls!==null&&(Un?(e=ls,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):ls.removeChild(s.stateNode));break;case 18:ls!==null&&(Un?(e=ls,s=s.stateNode,e.nodeType===8?Dx(e.parentNode,s):e.nodeType===1&&Dx(e,s),Yd(e)):Dx(ls,s.stateNode));break;case 4:r=ls,a=Un,ls=s.stateNode.containerInfo,Un=!0,ha(e,t,s),ls=r,Un=a;break;case 0:case 11:case 14:case 15:if(!gs&&(r=s.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){a=r=r.next;do{var o=a,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&R0(s,t,i),a=a.next}while(a!==r)}ha(e,t,s);break;case 1:if(!gs&&(fl(s,t),r=s.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=s.memoizedProps,r.state=s.memoizedState,r.componentWillUnmount()}catch(l){Lt(s,t,l)}ha(e,t,s);break;case 21:ha(e,t,s);break;case 22:s.mode&1?(gs=(r=gs)||s.memoizedState!==null,ha(e,t,s),gs=r):ha(e,t,s);break;default:ha(e,t,s)}}function B2(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new TI),t.forEach(function(r){var a=$I.bind(null,e,r);s.has(r)||(s.add(r),r.then(a,a))})}}function On(e,t){var s=t.deletions;if(s!==null)for(var r=0;r<s.length;r++){var a=s[r];try{var o=e,i=t,l=i;e:for(;l!==null;){switch(l.tag){case 5:ls=l.stateNode,Un=!1;break e;case 3:ls=l.stateNode.containerInfo,Un=!0;break e;case 4:ls=l.stateNode.containerInfo,Un=!0;break e}l=l.return}if(ls===null)throw Error(se(160));q_(o,i,a),ls=null,Un=!1;var c=a.alternate;c!==null&&(c.return=null),a.return=null}catch(d){Lt(a,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Z_(t,e),t=t.sibling}function Z_(e,t){var s=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(On(t,e),Xn(e),r&4){try{Ad(3,e,e.return),um(3,e)}catch(b){Lt(e,e.return,b)}try{Ad(5,e,e.return)}catch(b){Lt(e,e.return,b)}}break;case 1:On(t,e),Xn(e),r&512&&s!==null&&fl(s,s.return);break;case 5:if(On(t,e),Xn(e),r&512&&s!==null&&fl(s,s.return),e.flags&32){var a=e.stateNode;try{Vd(a,"")}catch(b){Lt(e,e.return,b)}}if(r&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,i=s!==null?s.memoizedProps:o,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&o.type==="radio"&&o.name!=null&&g5(a,o),n0(l,i);var d=n0(l,o);for(i=0;i<c.length;i+=2){var u=c[i],f=c[i+1];u==="style"?j5(a,f):u==="dangerouslySetInnerHTML"?v5(a,f):u==="children"?Vd(a,f):Rb(a,u,f,d)}switch(l){case"input":Jg(a,o);break;case"textarea":b5(a,o);break;case"select":var h=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m!=null?bl(a,!!o.multiple,m,!1):h!==!!o.multiple&&(o.defaultValue!=null?bl(a,!!o.multiple,o.defaultValue,!0):bl(a,!!o.multiple,o.multiple?[]:"",!1))}a[tu]=o}catch(b){Lt(e,e.return,b)}}break;case 6:if(On(t,e),Xn(e),r&4){if(e.stateNode===null)throw Error(se(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(b){Lt(e,e.return,b)}}break;case 3:if(On(t,e),Xn(e),r&4&&s!==null&&s.memoizedState.isDehydrated)try{Yd(t.containerInfo)}catch(b){Lt(e,e.return,b)}break;case 4:On(t,e),Xn(e);break;case 13:On(t,e),Xn(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(cy=Ut())),r&4&&B2(e);break;case 22:if(u=s!==null&&s.memoizedState!==null,e.mode&1?(gs=(d=gs)||u,On(t,e),gs=d):On(t,e),Xn(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!u&&e.mode&1)for(me=e,u=e.child;u!==null;){for(f=me=u;me!==null;){switch(h=me,m=h.child,h.tag){case 0:case 11:case 14:case 15:Ad(4,h,h.return);break;case 1:fl(h,h.return);var y=h.stateNode;if(typeof y.componentWillUnmount=="function"){r=h,s=h.return;try{t=r,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(b){Lt(r,s,b)}}break;case 5:fl(h,h.return);break;case 22:if(h.memoizedState!==null){W2(f);continue}}m!==null?(m.return=h,me=m):W2(f)}u=u.sibling}e:for(u=null,f=e;;){if(f.tag===5){if(u===null){u=f;try{a=f.stateNode,d?(o=a.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(l=f.stateNode,c=f.memoizedProps.style,i=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=w5("display",i))}catch(b){Lt(e,e.return,b)}}}else if(f.tag===6){if(u===null)try{f.stateNode.nodeValue=d?"":f.memoizedProps}catch(b){Lt(e,e.return,b)}}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:On(t,e),Xn(e),r&4&&B2(e);break;case 21:break;default:On(t,e),Xn(e)}}function Xn(e){var t=e.flags;if(t&2){try{e:{for(var s=e.return;s!==null;){if(K_(s)){var r=s;break e}s=s.return}throw Error(se(160))}switch(r.tag){case 5:var a=r.stateNode;r.flags&32&&(Vd(a,""),r.flags&=-33);var o=z2(e);O0(e,o,a);break;case 3:case 4:var i=r.stateNode.containerInfo,l=z2(e);P0(e,l,i);break;default:throw Error(se(161))}}catch(c){Lt(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function RI(e,t,s){me=e,Y_(e)}function Y_(e,t,s){for(var r=(e.mode&1)!==0;me!==null;){var a=me,o=a.child;if(a.tag===22&&r){var i=a.memoizedState!==null||Mf;if(!i){var l=a.alternate,c=l!==null&&l.memoizedState!==null||gs;l=Mf;var d=gs;if(Mf=i,(gs=c)&&!d)for(me=a;me!==null;)i=me,c=i.child,i.tag===22&&i.memoizedState!==null?H2(a):c!==null?(c.return=i,me=c):H2(a);for(;o!==null;)me=o,Y_(o),o=o.sibling;me=a,Mf=l,gs=d}F2(e)}else a.subtreeFlags&8772&&o!==null?(o.return=a,me=o):F2(e)}}function F2(e){for(;me!==null;){var t=me;if(t.flags&8772){var s=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:gs||um(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!gs)if(s===null)r.componentDidMount();else{var a=t.elementType===t.type?s.memoizedProps:In(t.type,s.memoizedProps);r.componentDidUpdate(a,s.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&C2(t,o,r);break;case 3:var i=t.updateQueue;if(i!==null){if(s=null,t.child!==null)switch(t.child.tag){case 5:s=t.child.stateNode;break;case 1:s=t.child.stateNode}C2(t,i,s)}break;case 5:var l=t.stateNode;if(s===null&&t.flags&4){s=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&s.focus();break;case"img":c.src&&(s.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&&Yd(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(se(163))}gs||t.flags&512&&A0(t)}catch(h){Lt(t,t.return,h)}}if(t===e){me=null;break}if(s=t.sibling,s!==null){s.return=t.return,me=s;break}me=t.return}}function W2(e){for(;me!==null;){var t=me;if(t===e){me=null;break}var s=t.sibling;if(s!==null){s.return=t.return,me=s;break}me=t.return}}function H2(e){for(;me!==null;){var t=me;try{switch(t.tag){case 0:case 11:case 15:var s=t.return;try{um(4,t)}catch(c){Lt(t,s,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var a=t.return;try{r.componentDidMount()}catch(c){Lt(t,a,c)}}var o=t.return;try{A0(t)}catch(c){Lt(t,o,c)}break;case 5:var i=t.return;try{A0(t)}catch(c){Lt(t,i,c)}}}catch(c){Lt(t,t.return,c)}if(t===e){me=null;break}var l=t.sibling;if(l!==null){l.return=t.return,me=l;break}me=t.return}}var AI=Math.ceil,up=na.ReactCurrentDispatcher,iy=na.ReactCurrentOwner,jn=na.ReactCurrentBatchConfig,nt=0,ns=null,Ht=null,cs=0,Ks=0,hl=go(0),Yt=0,iu=null,hi=0,fm=0,ly=0,Pd=null,Ds=null,cy=0,ec=1/0,Er=null,fp=!1,L0=null,Ka=null,$f=!1,Ma=null,hp=0,Od=0,D0=null,_h=-1,Th=0;function Ns(){return nt&6?Ut():_h!==-1?_h:_h=Ut()}function qa(e){return e.mode&1?nt&2&&cs!==0?cs&-cs:pI.transition!==null?(Th===0&&(Th=L5()),Th):(e=dt,e!==0||(e=window.event,e=e===void 0?16:B5(e.type)),e):1}function Kn(e,t,s,r){if(50<Od)throw Od=0,D0=null,Error(se(185));Vu(e,s,r),(!(nt&2)||e!==ns)&&(e===ns&&(!(nt&2)&&(fm|=s),Yt===4&&ka(e,cs)),Bs(e,r),s===1&&nt===0&&!(t.mode&1)&&(ec=Ut()+500,lm&&bo()))}function Bs(e,t){var s=e.callbackNode;pD(e,t);var r=Yh(e,e===ns?cs:0);if(r===0)s!==null&&Xw(s),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(s!=null&&Xw(s),t===1)e.tag===0?hI(G2.bind(null,e)):o_(G2.bind(null,e)),cI(function(){!(nt&6)&&bo()}),s=null;else{switch(D5(r)){case 1:s=Db;break;case 4:s=P5;break;case 16:s=Zh;break;case 536870912:s=O5;break;default:s=Zh}s=r3(s,Q_.bind(null,e))}e.callbackPriority=t,e.callbackNode=s}}function Q_(e,t){if(_h=-1,Th=0,nt&6)throw Error(se(327));var s=e.callbackNode;if(kl()&&e.callbackNode!==s)return null;var r=Yh(e,e===ns?cs:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=pp(e,r);else{t=r;var a=nt;nt|=2;var o=X_();(ns!==e||cs!==t)&&(Er=null,ec=Ut()+500,ri(e,t));do try{LI();break}catch(l){J_(e,l)}while(!0);qb(),up.current=o,nt=a,Ht!==null?t=0:(ns=null,cs=0,t=Yt)}if(t!==0){if(t===2&&(a=l0(e),a!==0&&(r=a,t=I0(e,a))),t===1)throw s=iu,ri(e,0),ka(e,r),Bs(e,Ut()),s;if(t===6)ka(e,r);else{if(a=e.current.alternate,!(r&30)&&!PI(a)&&(t=pp(e,r),t===2&&(o=l0(e),o!==0&&(r=o,t=I0(e,o))),t===1))throw s=iu,ri(e,0),ka(e,r),Bs(e,Ut()),s;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(se(345));case 2:Io(e,Ds,Er);break;case 3:if(ka(e,r),(r&130023424)===r&&(t=cy+500-Ut(),10<t)){if(Yh(e,0)!==0)break;if(a=e.suspendedLanes,(a&r)!==r){Ns(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=x0(Io.bind(null,e,Ds,Er),t);break}Io(e,Ds,Er);break;case 4:if(ka(e,r),(r&4194240)===r)break;for(t=e.eventTimes,a=-1;0<r;){var i=31-Vn(r);o=1<<i,i=t[i],i>a&&(a=i),r&=~o}if(r=a,r=Ut()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*AI(r/1960))-r,10<r){e.timeoutHandle=x0(Io.bind(null,e,Ds,Er),r);break}Io(e,Ds,Er);break;case 5:Io(e,Ds,Er);break;default:throw Error(se(329))}}}return Bs(e,Ut()),e.callbackNode===s?Q_.bind(null,e):null}function I0(e,t){var s=Pd;return e.current.memoizedState.isDehydrated&&(ri(e,t).flags|=256),e=pp(e,t),e!==2&&(t=Ds,Ds=s,t!==null&&M0(t)),e}function M0(e){Ds===null?Ds=e:Ds.push.apply(Ds,e)}function PI(e){for(var t=e;;){if(t.flags&16384){var s=t.updateQueue;if(s!==null&&(s=s.stores,s!==null))for(var r=0;r<s.length;r++){var a=s[r],o=a.getSnapshot;a=a.value;try{if(!qn(o(),a))return!1}catch{return!1}}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;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 ka(e,t){for(t&=~ly,t&=~fm,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var s=31-Vn(t),r=1<<s;e[s]=-1,t&=~r}}function G2(e){if(nt&6)throw Error(se(327));kl();var t=Yh(e,0);if(!(t&1))return Bs(e,Ut()),null;var s=pp(e,t);if(e.tag!==0&&s===2){var r=l0(e);r!==0&&(t=r,s=I0(e,r))}if(s===1)throw s=iu,ri(e,0),ka(e,t),Bs(e,Ut()),s;if(s===6)throw Error(se(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Io(e,Ds,Er),Bs(e,Ut()),null}function dy(e,t){var s=nt;nt|=1;try{return e(t)}finally{nt=s,nt===0&&(ec=Ut()+500,lm&&bo())}}function pi(e){Ma!==null&&Ma.tag===0&&!(nt&6)&&kl();var t=nt;nt|=1;var s=jn.transition,r=dt;try{if(jn.transition=null,dt=1,e)return e()}finally{dt=r,jn.transition=s,nt=t,!(nt&6)&&bo()}}function uy(){Ks=hl.current,vt(hl)}function ri(e,t){e.finishedWork=null,e.finishedLanes=0;var s=e.timeoutHandle;if(s!==-1&&(e.timeoutHandle=-1,lI(s)),Ht!==null)for(s=Ht.return;s!==null;){var r=s;switch(Gb(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&tp();break;case 3:Jl(),vt(Us),vt(bs),ey();break;case 5:Xb(r);break;case 4:Jl();break;case 13:vt(Ct);break;case 19:vt(Ct);break;case 10:Zb(r.type._context);break;case 22:case 23:uy()}s=s.return}if(ns=e,Ht=e=Za(e.current,null),cs=Ks=t,Yt=0,iu=null,ly=fm=hi=0,Ds=Pd=null,Bo!==null){for(t=0;t<Bo.length;t++)if(s=Bo[t],r=s.interleaved,r!==null){s.interleaved=null;var a=r.next,o=s.pending;if(o!==null){var i=o.next;o.next=a,r.next=i}s.pending=r}Bo=null}return e}function J_(e,t){do{var s=Ht;try{if(qb(),Sh.current=dp,cp){for(var r=_t.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}cp=!1}if(fi=0,ss=qt=_t=null,Rd=!1,ru=0,iy.current=null,s===null||s.return===null){Yt=1,iu=t,Ht=null;break}e:{var o=e,i=s.return,l=s,c=t;if(t=cs,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 h=u.alternate;h?(u.updateQueue=h.updateQueue,u.memoizedState=h.memoizedState,u.lanes=h.lanes):(u.updateQueue=null,u.memoizedState=null)}var m=P2(i);if(m!==null){m.flags&=-257,O2(m,i,l,o,t),m.mode&1&&A2(o,d,t),t=m,c=d;var y=t.updateQueue;if(y===null){var b=new Set;b.add(c),t.updateQueue=b}else y.add(c);break e}else{if(!(t&1)){A2(o,d,t),fy();break e}c=Error(se(426))}}else if(jt&&l.mode&1){var w=P2(i);if(w!==null){!(w.flags&65536)&&(w.flags|=256),O2(w,i,l,o,t),Vb(Xl(c,l));break e}}o=c=Xl(c,l),Yt!==4&&(Yt=2),Pd===null?Pd=[o]:Pd.push(o),o=i;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var x=D_(o,c,t);N2(o,x);break e;case 1:l=c;var g=o.type,v=o.stateNode;if(!(o.flags&128)&&(typeof g.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Ka===null||!Ka.has(v)))){o.flags|=65536,t&=-t,o.lanes|=t;var k=I_(o,l,t);N2(o,k);break e}}o=o.return}while(o!==null)}t3(s)}catch(S){t=S,Ht===s&&s!==null&&(Ht=s=s.return);continue}break}while(!0)}function X_(){var e=up.current;return up.current=dp,e===null?dp:e}function fy(){(Yt===0||Yt===3||Yt===2)&&(Yt=4),ns===null||!(hi&268435455)&&!(fm&268435455)||ka(ns,cs)}function pp(e,t){var s=nt;nt|=2;var r=X_();(ns!==e||cs!==t)&&(Er=null,ri(e,t));do try{OI();break}catch(a){J_(e,a)}while(!0);if(qb(),nt=s,up.current=r,Ht!==null)throw Error(se(261));return ns=null,cs=0,Yt}function OI(){for(;Ht!==null;)e3(Ht)}function LI(){for(;Ht!==null&&!aD();)e3(Ht)}function e3(e){var t=n3(e.alternate,e,Ks);e.memoizedProps=e.pendingProps,t===null?t3(e):Ht=t,iy.current=null}function t3(e){var t=e;do{var s=t.alternate;if(e=t.return,t.flags&32768){if(s=_I(s,t),s!==null){s.flags&=32767,Ht=s;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Yt=6,Ht=null;return}}else if(s=CI(s,t,Ks),s!==null){Ht=s;return}if(t=t.sibling,t!==null){Ht=t;return}Ht=t=e}while(t!==null);Yt===0&&(Yt=5)}function Io(e,t,s){var r=dt,a=jn.transition;try{jn.transition=null,dt=1,DI(e,t,s,r)}finally{jn.transition=a,dt=r}return null}function DI(e,t,s,r){do kl();while(Ma!==null);if(nt&6)throw Error(se(327));s=e.finishedWork;var a=e.finishedLanes;if(s===null)return null;if(e.finishedWork=null,e.finishedLanes=0,s===e.current)throw Error(se(177));e.callbackNode=null,e.callbackPriority=0;var o=s.lanes|s.childLanes;if(mD(e,o),e===ns&&(Ht=ns=null,cs=0),!(s.subtreeFlags&2064)&&!(s.flags&2064)||$f||($f=!0,r3(Zh,function(){return kl(),null})),o=(s.flags&15990)!==0,s.subtreeFlags&15990||o){o=jn.transition,jn.transition=null;var i=dt;dt=1;var l=nt;nt|=4,iy.current=null,EI(e,s),Z_(s,e),tI(p0),Qh=!!h0,p0=h0=null,e.current=s,RI(s),oD(),nt=l,dt=i,jn.transition=o}else e.current=s;if($f&&($f=!1,Ma=e,hp=a),o=e.pendingLanes,o===0&&(Ka=null),cD(s.stateNode),Bs(e,Ut()),t!==null)for(r=e.onRecoverableError,s=0;s<t.length;s++)a=t[s],r(a.value,{componentStack:a.stack,digest:a.digest});if(fp)throw fp=!1,e=L0,L0=null,e;return hp&1&&e.tag!==0&&kl(),o=e.pendingLanes,o&1?e===D0?Od++:(Od=0,D0=e):Od=0,bo(),null}function kl(){if(Ma!==null){var e=D5(hp),t=jn.transition,s=dt;try{if(jn.transition=null,dt=16>e?16:e,Ma===null)var r=!1;else{if(e=Ma,Ma=null,hp=0,nt&6)throw Error(se(331));var a=nt;for(nt|=4,me=e.current;me!==null;){var o=me,i=o.child;if(me.flags&16){var l=o.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(me=d;me!==null;){var u=me;switch(u.tag){case 0:case 11:case 15:Ad(8,u,o)}var f=u.child;if(f!==null)f.return=u,me=f;else for(;me!==null;){u=me;var h=u.sibling,m=u.return;if(V_(u),u===d){me=null;break}if(h!==null){h.return=m,me=h;break}me=m}}}var y=o.alternate;if(y!==null){var b=y.child;if(b!==null){y.child=null;do{var w=b.sibling;b.sibling=null,b=w}while(b!==null)}}me=o}}if(o.subtreeFlags&2064&&i!==null)i.return=o,me=i;else e:for(;me!==null;){if(o=me,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Ad(9,o,o.return)}var x=o.sibling;if(x!==null){x.return=o.return,me=x;break e}me=o.return}}var g=e.current;for(me=g;me!==null;){i=me;var v=i.child;if(i.subtreeFlags&2064&&v!==null)v.return=i,me=v;else e:for(i=g;me!==null;){if(l=me,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:um(9,l)}}catch(S){Lt(l,l.return,S)}if(l===i){me=null;break e}var k=l.sibling;if(k!==null){k.return=l.return,me=k;break e}me=l.return}}if(nt=a,bo(),pr&&typeof pr.onPostCommitFiberRoot=="function")try{pr.onPostCommitFiberRoot(nm,e)}catch{}r=!0}return r}finally{dt=s,jn.transition=t}}return!1}function V2(e,t,s){t=Xl(s,t),t=D_(e,t,1),e=Va(e,t,1),t=Ns(),e!==null&&(Vu(e,1,t),Bs(e,t))}function Lt(e,t,s){if(e.tag===3)V2(e,e,s);else for(;t!==null;){if(t.tag===3){V2(t,e,s);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ka===null||!Ka.has(r))){e=Xl(s,e),e=I_(t,e,1),t=Va(t,e,1),e=Ns(),t!==null&&(Vu(t,1,e),Bs(t,e));break}}t=t.return}}function II(e,t,s){var r=e.pingCache;r!==null&&r.delete(t),t=Ns(),e.pingedLanes|=e.suspendedLanes&s,ns===e&&(cs&s)===s&&(Yt===4||Yt===3&&(cs&130023424)===cs&&500>Ut()-cy?ri(e,0):ly|=s),Bs(e,t)}function s3(e,t){t===0&&(e.mode&1?(t=Tf,Tf<<=1,!(Tf&130023424)&&(Tf=4194304)):t=1);var s=Ns();e=Zr(e,t),e!==null&&(Vu(e,t,s),Bs(e,s))}function MI(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),s3(e,s)}function $I(e,t){var s=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(s=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(se(314))}r!==null&&r.delete(t),s3(e,s)}var n3;n3=function(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps||Us.current)Ms=!0;else{if(!(e.lanes&s)&&!(t.flags&128))return Ms=!1,NI(e,t,s);Ms=!!(e.flags&131072)}else Ms=!1,jt&&t.flags&1048576&&i_(t,rp,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ch(e,t),e=t.pendingProps;var a=Zl(t,bs.current);jl(t,s),a=sy(null,t,r,e,a,s);var o=ny();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,zs(r)?(o=!0,sp(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Qb(t),a.updater=dm,t.stateNode=a,a._reactInternals=t,k0(t,r,e,s),t=C0(null,t,r,!0,o,s)):(t.tag=0,jt&&o&&Hb(t),ks(null,t,a,s),t=t.child),t;case 16:r=t.elementType;e:{switch(Ch(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=zI(r),e=In(r,e),a){case 0:t=N0(null,t,r,e,s);break e;case 1:t=I2(null,t,r,e,s);break e;case 11:t=L2(null,t,r,e,s);break e;case 14:t=D2(null,t,r,In(r.type,e),s);break e}throw Error(se(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:In(r,a),N0(e,t,r,a,s);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:In(r,a),I2(e,t,r,a,s);case 3:e:{if(z_(t),e===null)throw Error(se(387));r=t.pendingProps,o=t.memoizedState,a=o.element,h_(e,t),ip(t,r,null,s);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Xl(Error(se(423)),t),t=M2(e,t,r,s,a);break e}else if(r!==a){a=Xl(Error(se(424)),t),t=M2(e,t,r,s,a);break e}else for(Xs=Ga(t.stateNode.containerInfo.firstChild),tn=t,jt=!0,zn=null,
vendor: 5,198 bytes, line 40
40s=u_(t,null,r,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Yl(),r===a){t=Yr(e,t,s);break e}ks(e,t,r,s)}t=t.child}return t;case 5:return p_(t),e===null&&v0(t),r=t.type,a=t.pendingProps,o=e!==null?e.memoizedProps:null,i=a.children,m0(r,a)?i=null:o!==null&&m0(r,o)&&(t.flags|=32),U_(e,t),ks(e,t,i,s),t.child;case 6:return e===null&&v0(t),null;case 13:return B_(e,t,s);case 4:return Jb(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ql(t,null,r,s):ks(e,t,r,s),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:In(r,a),L2(e,t,r,a,s);case 7:return ks(e,t,t.pendingProps,s),t.child;case 8:return ks(e,t,t.pendingProps.children,s),t.child;case 12:return ks(e,t,t.pendingProps.children,s),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,o=t.memoizedProps,i=a.value,xt(ap,r._currentValue),r._currentValue=i,o!==null)if(qn(o.value,i)){if(o.children===a.children&&!Us.current){t=Yr(e,t,s);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var l=o.dependencies;if(l!==null){i=o.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(o.tag===1){c=Gr(-1,s&-s),c.tag=2;var d=o.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}}o.lanes|=s,c=o.alternate,c!==null&&(c.lanes|=s),w0(o.return,s,t),l.lanes|=s;break}c=c.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(se(341));i.lanes|=s,l=i.alternate,l!==null&&(l.lanes|=s),w0(i,s,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}ks(e,t,a.children,s),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,jl(t,s),a=Nn(a),r=r(a),t.flags|=1,ks(e,t,r,s),t.child;case 14:return r=t.type,a=In(r,t.pendingProps),a=In(r.type,a),D2(e,t,r,a,s);case 15:return M_(e,t,t.type,t.pendingProps,s);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:In(r,a),Ch(e,t),t.tag=1,zs(r)?(e=!0,sp(t)):e=!1,jl(t,s),L_(t,r,a),k0(t,r,a,s),C0(null,t,r,!0,e,s);case 19:return F_(e,t,s);case 22:return $_(e,t,s)}throw Error(se(156,t.tag))};function r3(e,t){return A5(e,t)}function UI(e,t,s,r){this.tag=e,this.key=s,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 vn(e,t,s,r){return new UI(e,t,s,r)}function hy(e){return e=e.prototype,!(!e||!e.isReactComponent)}function zI(e){if(typeof e=="function")return hy(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Pb)return 11;if(e===Ob)return 14}return 2}function Za(e,t){var s=e.alternate;return s===null?(s=vn(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function Eh(e,t,s,r,a,o){var i=2;if(r=e,typeof e=="function")hy(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case nl:return ai(s.children,a,o,t);case Ab:i=8,a|=8;break;case Kg:return e=vn(12,s,t,a|2),e.elementType=Kg,e.lanes=o,e;case qg:return e=vn(13,s,t,a),e.elementType=qg,e.lanes=o,e;case Zg:return e=vn(19,s,t,a),e.elementType=Zg,e.lanes=o,e;case p5:return hm(s,a,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case f5:i=10;break e;case h5:i=9;break e;case Pb:i=11;break e;case Ob:i=14;break e;case va:i=16,r=null;break e}throw Error(se(130,e==null?e:typeof e,""))}return t=vn(i,s,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ai(e,t,s,r){return e=vn(7,e,r,t),e.lanes=s,e}function hm(e,t,s,r){return e=vn(22,e,r,t),e.elementType=p5,e.lanes=s,e.stateNode={isHidden:!1},e}function Wx(e,t,s){return e=vn(6,e,null,t),e.lanes=s,e}function Hx(e,t,s){return t=vn(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function BI(e,t,s,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=Sx(0),this.expirationTimes=Sx(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Sx(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function py(e,t,s,r,a,o,i,l,c){return e=new BI(e,t,s,l,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=vn(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null}
vendor: 4,689 bytes, line 40
40,Qb(o),e}function FI(e,t,s){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:sl,key:r==null?null:""+r,children:e,containerInfo:t,implementation:s}}function a3(e){if(!e)return no;e=e._reactInternals;e:{if(Ai(e)!==e||e.tag!==1)throw Error(se(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(zs(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(se(171))}if(e.tag===1){var s=e.type;if(zs(s))return a_(e,s,t)}return t}function o3(e,t,s,r,a,o,i,l,c){return e=py(s,r,!0,e,a,o,i,l,c),e.context=a3(null),s=e.current,r=Ns(),a=qa(s),o=Gr(r,a),o.callback=t??null,Va(s,o,a),e.current.lanes=a,Vu(e,a,r),Bs(e,r),e}function pm(e,t,s,r){var a=t.current,o=Ns(),i=qa(a);return s=a3(s),t.context===null?t.context=s:t.pendingContext=s,t=Gr(o,i),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Va(a,t,i),e!==null&&(Kn(e,a,i,o),kh(e,a,i)),i}function mp(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 K2(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function my(e,t){K2(e,t),(e=e.alternate)&&K2(e,t)}function WI(){return null}var i3=typeof reportError=="function"?reportError:function(e){console.error(e)};function xy(e){this._internalRoot=e}mm.prototype.render=xy.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(se(409));pm(e,t,null,null)};mm.prototype.unmount=xy.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;pi(function(){pm(null,e,null,null)}),t[qr]=null}};function mm(e){this._internalRoot=e}mm.prototype.unstable_scheduleHydration=function(e){if(e){var t=$5();e={blockedOn:null,target:e,priority:t};for(var s=0;s<ja.length&&t!==0&&t<ja[s].priority;s++);ja.splice(s,0,e),s===0&&z5(e)}};function gy(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function xm(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function q2(){}function HI(e,t,s,r,a){if(a){if(typeof r=="function"){var o=r;r=function(){var d=mp(i);o.call(d)}}var i=o3(t,r,e,0,null,!1,!1,"",q2);return e._reactRootContainer=i,e[qr]=i.current,Xd(e.nodeType===8?e.parentNode:e),pi(),i}for(;a=e.lastChild;)e.removeChild(a);if(typeof r=="function"){var l=r;r=function(){var d=mp(c);l.call(d)}}var c=py(e,0,!1,null,null,!1,!1,"",q2);return e._reactRootContainer=c,e[qr]=c.current,Xd(e.nodeType===8?e.parentNode:e),pi(function(){pm(t,c,s,r)}),c}function gm(e,t,s,r,a){var o=s._reactRootContainer;if(o){var i=o;if(typeof a=="function"){var l=a;a=function(){var c=mp(i);l.call(c)}}pm(t,i,e,a)}else i=HI(s,t,e,a,r);return mp(i)}I5=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var s=md(t.pendingLanes);s!==0&&(Ib(t,s|1),Bs(t,Ut()),!(nt&6)&&(ec=Ut()+500,bo()))}break;case 13:pi(function(){var r=Zr(e,1);if(r!==null){var a=Ns();Kn(r,e,1,a)}}),my(e,1)}};Mb=function(e){if(e.tag===13){var t=Zr(e,134217728);if(t!==null){var s=Ns();Kn(t,e,134217728,s)}my(e,134217728)}};M5=function(e){if(e.tag===13){var t=qa(e),s=Zr(e,t);if(s!==null){var r=Ns();Kn(s,e,t,r)}my(e,t)}};$5=function(){return dt};U5=function(e,t){var s=dt;try{return dt=e,t()}finally{dt=s}};a0=function(e,t,s){switch(t){case"input":if(Jg(e,s),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<s.length;t++){var r=s[t];if(r!==e&&r.form===e.form){var a=im(r);if(!a)throw Error(se(90));x5(r),Jg(r,a)}}}break;case"textarea":b5(e,s);break;case"select":t=s.value,t!=null&&bl(e,!!s.multiple,t,!1)}};N5=dy;C5=pi;var GI={usingClientEntryPoint:!1,Events:[qu,il,im,k5,S5,dy]},rd={findFiberByHostInstance:zo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},VI={bundleType:rd.bundleType,version:rd.version,rendererPackageName:rd.rendererPackageName,rendererConfig:rd.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:na.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=E5(e),e===null?null:e.stateNode},findFiberByHostInstance:rd.findFiberByHostInstance||WI,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};
40if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Uf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Uf.isDisabled&&Uf.supportsFiber)try{nm=Uf.inject(VI),pr=Uf}catch{}}an.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=GI;an.createPortal=function(e,t){var s=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!gy(t))throw Error(se(200));return FI(e,t,null,s)};an.createRoot=function(e,t){if(!gy(e))throw Error(se(299));var s=!1,r="",a=i3;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=py(e,1,!1,null,null,s,!1,r,a),e[qr]=t.current,Xd(e.nodeType===8?e.parentNode:e),new xy(t)};an.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(se(188)):(e=Object.keys(e).join(","),Error(se(268,e)));return e=E5(t),e=e===null?null:e.stateNode,e};an.flushSync=function(e){return pi(e)};an.hydrate=function(e,t,s){if(!xm(t))throw Error(se(200));return gm(null,e,t,!0,s)};an.hydrateRoot=function(e,t,s){if(!gy(e))throw Error(se(405));var r=s!=null&&s.hydratedSources||null,a=!1,o="",i=i3;if(s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(o=s.identifierPrefix),s.onRecoverableError!==void 0&&(i=s.onRecoverableError)),t=o3(t,null,e,1,s??null,a,!1,o,i),e[qr]=t.current,Xd(e),r)for(e=0;e<r.length;e++)s=r[e],a=s._getVersion,a=a(s._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[s,a]:t.mutableSourceEagerHydrationData.push(s,a);return new mm(t)};an.render=function(e,t,s){if(!xm(t))throw Error(se(200));return gm(null,e,t,!1,s)};an.unmountComponentAtNode=function(e){if(!xm(e))throw Error(se(40));return e._reactRootContainer?(pi(function(){gm(null,null,e,!1,function(){e._reactRootContainer=null,e[qr]=null})}),!0):!1};an.unstable_batchedUpdates=dy;an.unstable_renderSubtreeIntoContainer=function(e,t,s,r){if(!xm(s))throw Error(se(200));if(e==null||e._reactInternals===void 0)throw Error(se(38));return gm(e,t,s,!1,r)};an.version="18.3.1-next-f1338f8080-20240426";function l3(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l3)}catch(e){console.error(e)}}l3(),l5.exports=an;var It=l5.exports;const KI=Y4(It);var Z2=It;Gg.createRoot=Z2.createRoot,Gg.hydrateRoot=Z2.hydrateRoot;/**
41 * @remix-run/router v1.23.2
42 *
43 * Copyright (c) Remix Software Inc.
44 *
45 * This source code is licensed under the MIT license found in the
46 * LICENSE.md file in the root directory of this source tree.
47 *
48 * @license MIT
49 */function lu(){return lu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},lu.apply(this,arguments)}var $a;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})($a||($a={}));const Y2="popstate";function qI(e){e===void 0&&(e={});function t(r,a){let{pathname:o,search:i,hash:l}=r.location;return $0("",{pathname:o,search:i,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function s(r,a){return typeof a=="string"?a:xp(a)}return YI(t,s,null,e)}function zt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function by(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function ZI(){return Math.random().toString(36).substr(2,8)}function Q2(e,t){return{usr:e.state,key:e.key,idx:t}}function $0(e,t,s,r){return s===void 0&&(s=null),lu({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?jc(t):t,{state:s,key:t&&t.key||r||ZI()})}function xp(e){let{pathname:t="/",search:s="",hash:r=""}=e;return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function jc(e){let t={};if(e){let s=e.indexOf("#");s>=0&&(t.hash=e.substr(s),e=e.substr(0,s));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function YI(e,t,s,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:o=!1}=r,i=a.history,l=$a.Pop,c=null,d=u();d==null&&(d=0,i.replaceState(lu({},i.state,{idx:d}),""));function u(){return(i.state||{idx:null}).idx}function f(){l=$a.Pop;let w=u(),x=w==null?null:w-d;d=w,c&&c({action:l,location:b.location,delta:x})}function h(w,x){l=$a.Push;let g=$0(b.location,w,x);d=u()+1;
vendor: 10,438 bytes, lines 49-58
49let v=Q2(g,d),k=b.createHref(g);try{i.pushState(v,"",k)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;a.location.assign(k)}o&&c&&c({action:l,location:b.location,delta:1})}function m(w,x){l=$a.Replace;let g=$0(b.location,w,x);d=u();let v=Q2(g,d),k=b.createHref(g);i.replaceState(v,"",k),o&&c&&c({action:l,location:b.location,delta:0})}function y(w){let x=a.location.origin!=="null"?a.location.origin:a.location.href,g=typeof w=="string"?w:xp(w);return g=g.replace(/ $/,"%20"),zt(x,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,x)}let b={get action(){return l},get location(){return e(a,i)},listen(w){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(Y2,f),c=w,()=>{a.removeEventListener(Y2,f),c=null}},createHref(w){return t(a,w)},createURL:y,encodeLocation(w){let x=y(w);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:h,replace:m,go(w){return i.go(w)}};return b}var J2;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(J2||(J2={}));function QI(e,t,s){return s===void 0&&(s="/"),JI(e,t,s)}function JI(e,t,s,r){let a=typeof t=="string"?jc(t):t,o=yy(a.pathname||"/",s);if(o==null)return null;let i=c3(e);XI(i);let l=null;for(let c=0;l==null&&c<i.length;++c){let d=uM(o);l=lM(i[c],d)}return l}function c3(e,t,s,r){t===void 0&&(t=[]),s===void 0&&(s=[]),r===void 0&&(r="");let a=(o,i,l)=>{let c={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:i,route:o};c.relativePath.startsWith("/")&&(zt(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=Ya([r,c.relativePath]),u=s.concat(c);o.children&&o.children.length>0&&(zt(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),c3(o.children,t,u,d)),!(o.path==null&&!o.index)&&t.push({path:d,score:oM(d,o.index),routesMeta:u})};return e.forEach((o,i)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))a(o,i);else for(let c of d3(o.path))a(o,i,c)}),t}function d3(e){let t=e.split("/");if(t.length===0)return[];let[s,...r]=t,a=s.endsWith("?"),o=s.replace(/\?$/,"");if(r.length===0)return a?[o,""]:[o];let i=d3(r.join("/")),l=[];return l.push(...i.map(c=>c===""?o:[o,c].join("/"))),a&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function XI(e){e.sort((t,s)=>t.score!==s.score?s.score-t.score:iM(t.routesMeta.map(r=>r.childrenIndex),s.routesMeta.map(r=>r.childrenIndex)))}const eM=/^:[\w-]+$/,tM=3,sM=2,nM=1,rM=10,aM=-2,X2=e=>e==="*";function oM(e,t){let s=e.split("/"),r=s.length;return s.some(X2)&&(r+=aM),t&&(r+=sM),s.filter(a=>!X2(a)).reduce((a,o)=>a+(eM.test(o)?tM:o===""?nM:rM),r)}function iM(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 lM(e,t,s){let{routesMeta:r}=e,a={},o="/",i=[];for(let l=0;l<r.length;++l){let c=r[l],d=l===r.length-1,u=o==="/"?t:t.slice(o.length)||"/",f=cM({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},u),h=c.route;if(!f)return null;Object.assign(a,f.params),i.push({params:a,pathname:Ya([o,f.pathname]),pathnameBase:xM(Ya([o,f.pathnameBase])),route:h}),f.pathnameBase!=="/"&&(o=Ya([o,f.pathnameBase]))}return i}function cM(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[s,r]=dM(e.path,e.caseSensitive,e.end),a=t.match(s);if(!a)return null;let o=a[0],i=o.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:r.reduce((d,u,f)=>{let{paramName:h,isOptional:m}=u;if(h==="*"){let b=l[f]||"";i=o.slice(0,o.length-b.length).replace(/(.)\/+$/,"$1")}const y=l[f];return m&&!y?d[h]=void 0:d[h]=(y||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:i,pattern:e}}function dM(e,t,s){t===void 0&&(t=!1),s===void 0&&(s=!0),by(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,(i,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function uM(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return by(!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 yy(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let s=t.endsWith("/")?t.length-1:t.length,r=e.charAt(s);return r&&r!=="/"?null:e.slice(s)||"/"}const fM=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,hM=e=>fM.test(e);function pM(e,t){t===void 0&&(t="/");let{pathname:s,search:r="",hash:a=""}=typeof e=="string"?jc(e):e,o;if(s)if(hM(s))o=s;else{if(s.includes("//")){let i=s;s=s.replace(/\/\/+/g,"/"),by(!1,"Pathnames cannot have embedded double slashes - normalizing "+(i+" -> "+s))}s.startsWith("/")?o=ej(s.substring(1),"/"):o=ej(s,t)}else o=t;return{pathname:o,search:gM(r),hash:bM(a)}}function ej(e,t){let s=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?s.length>1&&s.pop():a!=="."&&s.push(a)}),s.length>1?s.join("/"):"/"}function Gx(e,t,s,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"].  Please separate it out to the ")+("`to."+s+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function mM(e){return e.filter((t,s)=>s===0||t.route.path&&t.route.path.length>0)}function vy(e,t){let s=mM(e);return t?s.map((r,a)=>a===s.length-1?r.pathname:r.pathnameBase):s.map(r=>r.pathnameBase)}function wy(e,t,s,r){r===void 0&&(r=!1);let a;typeof e=="string"?a=jc(e):(a=lu({},e),zt(!a.pathname||!a.pathname.includes("?"),Gx("?","pathname","search",a)),zt(!a.pathname||!a.pathname.includes("#"),Gx("#","pathname","hash",a)),zt(!a.search||!a.search.includes("#"),Gx("#","search","hash",a)));let o=e===""||a.pathname==="",i=o?"/":a.pathname,l;if(i==null)l=s;else{let f=t.length-1;if(!r&&i.startsWith("..")){let h=i.split("/");for(;h[0]==="..";)h.shift(),f-=1;a.pathname=h.join("/")}l=f>=0?t[f]:"/"}let c=pM(a,l),d=i&&i!=="/"&&i.endsWith("/"),u=(o||i===".")&&s.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}const Ya=e=>e.join("/").replace(/\/\/+/g,"/"),xM=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),gM=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,bM=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function yM(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const u3=["post","put","patch","delete"];new Set(u3);const vM=["get",...u3];new Set(vM);/**
50 * React Router v6.30.3
51 *
52 * Copyright (c) Remix Software Inc.
53 *
54 * This source code is licensed under the MIT license found in the
55 * LICENSE.md file in the root directory of this source tree.
56 *
57 * @license MIT
58 */function cu(){return cu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},cu.apply(this,arguments)}const jy=p.createContext(null),wM=p.createContext(null),yo=p.createContext(null),bm=p.createContext(null),ra=p.createContext({outlet:null,matches:[],isDataRoute:!1}),f3=p.createContext(null);function jM(e,t){let{relative:s}=t===void 0?{}:t;kc()||zt(!1);let{basename:r,navigator:a}=p.useContext(yo),{hash:o,pathname:i,search:l}=p3(e,{relative:s}),c=i;return r!=="/"&&(c=i==="/"?r:Ya([r,i])),a.createHref({pathname:c,search:l,hash:o})}function kc(){return p.useContext(bm)!=null}function Rt(){return kc()||zt(!1),p.useContext(bm).location}function h3(e){p.useContext(yo).static||p.useLayoutEffect(e)}function ln(){let{isDataRoute:e}=p.useContext(ra);return e?DM():kM()}function kM(){kc()||zt(!1);let e=p.useContext(jy),{basename:t,future:s,navigator:r}=p.useContext(yo),{matches:a}=p.useContext(ra),{pathname:o}=Rt(),i=JSON.stringify(vy(a,s.v7_relativeSplatPath)),l=p.useRef(!1);return h3(()=>{l.current=!0}),p.useCallback(function(d,u){if(u===void 0&&(u={}),!l.current)return;if(typeof d=="number"){r.go(d);return}let f=wy(d,JSON.parse(i),o,u.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Ya([t,f.pathname])),(u.replace?r.replace:r.push)(f,u.state,u)},[t,r,i,o,e])}function cn(){let{matches:e}=p.useContext(ra),t=e[e.length-1];return t?t.params:{}}function p3(e,t){let{relative:s}=t===void 0?{}:t,{future:r}=p.useContext(yo),{matches:a}=p.useContext(ra),{pathname:o}=Rt(),i=JSON.stringify(vy(a,r.v7_relativeSplatPath));return p.useMemo(()=>wy(e,JSON.parse(i),o,s==="path"),[e,i,o,s])}function SM(e,t){return NM(e,t)}function NM(e,t,s,r){kc()||zt(!1);let{navigator:a}=p.useContext(yo),{matches:o}=p.useContext(ra),i=o[o.length-1],l=i?i.params:{};i&&i.pathname;let c=i?i.pathnameBase:"/";i&&i.route;let d=Rt(),u;if(t){var f;let w=typeof t=="string"?jc(t):t;c==="/"||(f=w.pathname)!=null&&f.startsWith(c)||zt(!1),u=w}else u=d;let h=u.pathname||"/",m=h;if(c!=="/"){let w=c.replace(/^\//,"").split("/");m="/"+h.replace(/^\//,"").split("/").slice(w.length).join("/")}let y=QI(e,{pathname:m}),b=RM(y&&y.map(w=>Object.assign({},w,{params:Object.assign({},l,w.params),pathname:Ya([c,a.encodeLocation?a.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?c:Ya([c,a.encodeLocation?a.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),o,s,r);return t&&b?p.createElement(bm.Provider,{value:{location:cu({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:$a.Pop}},b):b}function CM(){let e=LM(),t=yM(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),s=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application 
58Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},t),s?p.createElement("pre",{style:a},s):null,null)}const _M=p.createElement(CM,null);class TM extends p.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,s){return s.location!==t.location||s.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:s.error,location:s.location,revalidation:t.revalidation||s.revalidation}}componentDidCatch(t,s){console.error("React Router caught the following error during render",t,s)}render(){return this.state.error!==void 0?p.createElement(ra.Provider,{value:this.props.routeContext},p.createElement(f3.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function EM(e){let{routeContext:t,match:s,children:r}=e,a=p.useContext(jy);return a&&a.static&&a.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=s.route.id),p.createElement(ra.Provider,{value:t},r)}function RM(e,t,s,r){var a;if(t===void 0&&(t=[]),s===void 0&&(s=null),r===void 0&&(r=null),e==null){var o;if(!s)return null;if(s.errors)e=s.matches;else if((o=r)!=null&&o.v7_partialHydration&&t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let i=e,l=(a=s)==null?void 0:a.errors;if(l!=null){let u=i.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);u>=0||zt(!1),i=i.slice(0,Math.min(i.length,u+1))}let c=!1,d=-1;if(s&&r&&r.v7_partialHydration)for(let u=0;u<i.length;u++){let f=i[u];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(d=u),f.route.id){let{loaderData:h,errors:m}=s,y=f.route.loader&&h[f.route.id]===void 0&&(!m||m[f.route.id]===void 0);if(f.route.lazy||y){c=!0,d>=0?i=i.slice(0,d+1):i=[i[0]];break}}}return i.reduceRight((u,f,h)=>{let m,y=!1,b=null,w=null;s&&(m=l&&f.route.id?l[f.route.id]:void 0,b=f.route.errorElement||_M,c&&(d<0&&h===0?(IM("route-fallback"),y=!0,w=null):d===h&&(y=!0,w=f.route.hydrateFallbackElement||null)));let x=t.concat(i.slice(0,h+1)),g=()=>{let v;return m?v=b:y?v=w:f.route.Component?v=p.createElement(f.route.Component,null):f.route.element?v=f.route.element:v=u,p.createElement(EM,{match:f,routeContext:{outlet:u,matches:x,isDataRoute:s!=null},children:v})};return s&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?p.createElement(TM,{location:s.location,revalidation:s.revalidation,component:b,error:m,children:g(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):g()},null)}var m3=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(m3||{}),x3=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}(x3||{});function AM(e){let t=p.useContext(jy);return t||zt(!1),t}function PM(e){let t=p.useContext(wM);return t||zt(!1),t}function OM(e){let t=p.useContext(ra);return t||zt(!1),t}function g3(e){let t=OM(),s=t.matches[t.matches.length-1];return s.route.id||zt(!1),s.route.id}function LM(){var e;let t=p.useContext(f3),s=PM(),r=g3();return t!==void 0?t:(e=s.errors)==null?void 0:e[r]}function DM(){let{router:e}=AM(m3.UseNavigateStable),t=g3(x3.UseNavigateStable),s=p.useRef(!1);return h3(()=>{s.current=!0}),p.useCallback(function(a,o){o===void 0&&(o={}),s.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,cu({fromRouteId:t},o)))},[e,t])}const tj={};function IM(e,t,s){tj[e]||(tj[e]=!0)}function MM(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function wn(e){let{to:t,replace:s,state:r,relative:a}=e;kc()||zt(!1);let{future:o,static:i}=p.useContext(yo),{matches:l}=p.useContext(ra),{pathname:c}=Rt(),d=ln(),u=wy(t,vy(l,o.v7_relativeSplatPath),c,a==="path"),f=JSON.stringify(u);return p.useEffect(()=>d(JSON.parse(f),{replace:s,state:r,relative:a}),[d,f,a,s,r]),null}function Ze(e){zt(!1)}function $M(e){let{basename:t="/",children:s=null,location:r,navigationType:a=$a.Pop,navigator:o,static:i=!1,future:l}=e;kc()&&zt(!1);let c=t.replace(/^\/*/,"/"),d=p.useMemo(()=>({basename:c,navigator:o,static:i,future:cu({v7_relativeSplatPath:!1},l)}),[c,l,o,i]);typeof r=="string"&&(r=jc(r));
58let{pathname:u="/",search:f="",hash:h="",state:m=null,key:y="default"}=r,b=p.useMemo(()=>{let w=yy(u,c);return w==null?null:{location:{pathname:w,search:f,hash:h,state:m,key:y},navigationType:a}},[c,u,f,h,m,y,a]);return b==null?null:p.createElement(yo.Provider,{value:d},p.createElement(bm.Provider,{children:s,value:b}))}function UM(e){let{children:t,location:s}=e;return SM(U0(t),s)}new Promise(()=>{});function U0(e,t){t===void 0&&(t=[]);let s=[];return p.Children.forEach(e,(r,a)=>{if(!p.isValidElement(r))return;let o=[...t,a];if(r.type===p.Fragment){s.push.apply(s,U0(r.props.children,o));return}r.type!==Ze&&zt(!1),!r.props.index||!r.props.children||zt(!1);let i={id:r.props.id||o.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&&(i.children=U0(r.props.children,o)),s.push(i)}),s}/**
59 * React Router DOM v6.30.3
60 *
61 * Copyright (c) Remix Software Inc.
62 *
63 * This source code is licensed under the MIT license found in the
64 * LICENSE.md file in the root directory of this source tree.
65 *
66 * @license MIT
67 */function z0(){return z0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},z0.apply(this,arguments)}function zM(e,t){if(e==null)return{};var s={},r=Object.keys(e),a,o;for(o=0;o<r.length;o++)a=r[o],!(t.indexOf(a)>=0)&&(s[a]=e[a]);return s}function BM(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function FM(e,t){return e.button===0&&(!t||t==="_self")&&!BM(e)}function B0(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,s)=>{let r=e[s];return t.concat(Array.isArray(r)?r.map(a=>[s,a]):[[s,r]])},[]))}function WM(e,t){let s=B0(e);return t&&t.forEach((r,a)=>{s.has(a)||t.getAll(a).forEach(o=>{s.append(a,o)})}),s}const HM=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],GM="6";try{window.__reactRouterVersion=GM}catch{}const VM="startTransition",sj=_b[VM];function KM(e){let{basename:t,children:s,future:r,window:a}=e,o=p.useRef();o.current==null&&(o.current=qI({window:a,v5Compat:!0}));let i=o.current,[l,c]=p.useState({action:i.action,location:i.location}),{v7_startTransition:d}=r||{},u=p.useCallback(f=>{d&&sj?sj(()=>c(f)):c(f)},[c,d]);return p.useLayoutEffect(()=>i.listen(u),[i,u]),p.useEffect(()=>MM(r),[r]),p.createElement($M,{basename:t,children:s,location:l.location,navigationType:l.action,navigator:i,future:r})}const qM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ZM=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,te=p.forwardRef(function(t,s){let{onClick:r,relative:a,reloadDocument:o,replace:i,state:l,target:c,to:d,preventScrollReset:u,viewTransition:f}=t,h=zM(t,HM),{basename:m}=p.useContext(yo),y,b=!1;if(typeof d=="string"&&ZM.test(d)&&(y=d,qM))try{let v=new URL(window.location.href),k=d.startsWith("//")?new URL(v.protocol+d):new URL(d),S=yy(k.pathname,m);k.origin===v.origin&&S!=null?d=S+k.search+k.hash:b=!0}catch{}let w=jM(d,{relative:a}),x=YM(d,{replace:i,state:l,target:c,preventScrollReset:u,relative:a,viewTransition:f});function g(v){r&&r(v),v.defaultPrevented||x(v)}return p.createElement("a",z0({},h,{href:y||w,onClick:b||o?r:g,ref:s,target:c}))});var nj;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(nj||(nj={}));var rj;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(rj||(rj={}));function YM(e,t){let{target:s,replace:r,state:a,preventScrollReset:o,relative:i,viewTransition:l}=t===void 0?{}:t,c=ln(),d=Rt(),u=p3(e,{relative:i});return p.useCallback(f=>{if(FM(f,s)){f.preventDefault();let h=r!==void 0?r:xp(d)===xp(u);c(e,{replace:h,state:a,preventScrollReset:o,relative:i,viewTransition:l})}},[d,c,u,r,a,s,e,o,i,l])}function Rn(e){let t=p.useRef(B0(e)),s=p.useRef(!1),r=Rt(),a=p.useMemo(()=>WM(r.search,s.current?null:t.current),[r.search]),o=ln(),i=p.useCallback((l,c)=>{const d=B0(typeof l=="function"?l(a):l);s.current=!0,o("?"+d,c)},[o,a]);return[a,i]}var Pi=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(){}},qo,Ca,Ol,D4,QM=(D4=class extends Pi{constructor(){super();he(this,qo);he(this,Ca);he(this,Ol);ne(this,Ol,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){R(this,Ca)||this.setEventListener(R(this,Ol))}onUnsubscribe(){var t;this.hasListeners()||((t=R(this,Ca))==null||t.call(this),ne(this,Ca,void 0))}setEventListener(t){var s;ne(this,Ol,t),(s=R(this,Ca))==null||s.call(this),ne(this,Ca,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){R(this,qo)!==t&&(ne(this,qo,t),this.onFocus())}onFocus(){const t=this.isFocused();
67this.listeners.forEach(s=>{s(t)})}isFocused(){var t;return typeof R(this,qo)=="boolean"?R(this,qo):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},qo=new WeakMap,Ca=new WeakMap,Ol=new WeakMap,D4),ky=new QM,JM={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_a,jb,I4,XM=(I4=class{constructor(){he(this,_a,JM);he(this,jb,!1)}setTimeoutProvider(e){ne(this,_a,e)}setTimeout(e,t){return R(this,_a).setTimeout(e,t)}clearTimeout(e){R(this,_a).clearTimeout(e)}setInterval(e,t){return R(this,_a).setInterval(e,t)}clearInterval(e){R(this,_a).clearInterval(e)}},_a=new WeakMap,jb=new WeakMap,I4),Wo=new XM;function e7(e){setTimeout(e,0)}var t7=typeof window>"u"||"Deno"in globalThis;function xs(){}function s7(e,t){return typeof e=="function"?e(t):e}function F0(e){return typeof e=="number"&&e>=0&&e!==1/0}function b3(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Qa(e,t){return typeof e=="function"?e(t):e}function Zs(e,t){return typeof e=="function"?e(t):e}function aj(e,t){const{type:s="all",exact:r,fetchStatus:a,predicate:o,queryKey:i,stale:l}=e;if(i){if(r){if(t.queryHash!==Sy(i,t.options))return!1}else if(!du(t.queryKey,i))return!1}if(s!=="all"){const c=t.isActive();if(s==="active"&&!c||s==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||a&&a!==t.state.fetchStatus||o&&!o(t))}function oj(e,t){const{exact:s,status:r,predicate:a,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(s){if(mi(t.options.mutationKey)!==mi(o))return!1}else if(!du(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||a&&!a(t))}function Sy(e,t){return((t==null?void 0:t.queryKeyHashFn)||mi)(e)}function mi(e){return JSON.stringify(e,(t,s)=>W0(s)?Object.keys(s).sort().reduce((r,a)=>(r[a]=s[a],r),{}):s)}function du(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(s=>du(e[s],t[s])):!1}var n7=Object.prototype.hasOwnProperty;function Ny(e,t,s=0){if(e===t)return e;if(s>500)return t;const r=ij(e)&&ij(t);if(!r&&!(W0(e)&&W0(t)))return t;const o=(r?e:Object.keys(e)).length,i=r?t:Object.keys(t),l=i.length,c=r?new Array(l):{};let d=0;for(let u=0;u<l;u++){const f=r?u:i[u],h=e[f],m=t[f];if(h===m){c[f]=h,(r?u<o:n7.call(e,f))&&d++;continue}if(h===null||m===null||typeof h!="object"||typeof m!="object"){c[f]=m;continue}const y=Ny(h,m,s+1);c[f]=y,y===h&&d++}return o===l&&d===o?e:c}function uu(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}function ij(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function W0(e){if(!lj(e))return!1;const t=e.constructor;if(t===void 0)return!0;const s=t.prototype;return!(!lj(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function lj(e){return Object.prototype.toString.call(e)==="[object Object]"}function r7(e){return new Promise(t=>{Wo.setTimeout(t,e)})}function H0(e,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,t):s.structuralSharing!==!1?Ny(e,t):t}function ym(e){return e}function a7(e,t,s=0){const r=[...e,t];return s&&r.length>s?r.slice(1):r}function o7(e,t,s=0){const r=[t,...e];return s&&r.length>s?r.slice(0,-1):r}var Cy=Symbol();function y3(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Cy?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function _y(e,t){return typeof e=="function"?e(...t):!!e}function i7(e,t,s){let r=!1,a;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(a??(a=t()),r||(r=!0,a.aborted?s():a.addEventListener("abort",s,{once:!0})),a)}),e}var fu=(()=>{let e=()=>t7;return{isServer(){return e()},setIsServer(t){e=t}}})();function G0(){let e,t;const s=new Promise((a,o)=>{e=a,t=o});s.status="pending",s.catch(()=>{});function r(a){Object.assign(s,a),delete s.resolve,delete s.reject}return s.resolve=a=>{r({status:"fulfilled",value:a}),e(a)},s.reject=a=>{r({status:"rejected",reason:a}),t(a)},s}var l7=e7;function c7(){let e=[],t=0,s=l=>{l()},r=l=>{l()},a=l7;const o=l=>{t?e.push(l):a(()=>{s(l)})},i=()=>{const l=e;e=[],l.length&&a(()=>{r(()=>{l.forEach(c=>{s(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||i()}return c},batchCalls:l=>(...c)=>{o(()=>
67{l(...c)})},schedule:o,setNotifyFunction:l=>{s=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{a=l}}}var Dt=c7(),Ll,Ta,Dl,M4,d7=(M4=class extends Pi{constructor(){super();he(this,Ll,!0);he(this,Ta);he(this,Dl);ne(this,Dl,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",r)}}})}onSubscribe(){R(this,Ta)||this.setEventListener(R(this,Dl))}onUnsubscribe(){var t;this.hasListeners()||((t=R(this,Ta))==null||t.call(this),ne(this,Ta,void 0))}setEventListener(t){var s;ne(this,Dl,t),(s=R(this,Ta))==null||s.call(this),ne(this,Ta,t(this.setOnline.bind(this)))}setOnline(t){R(this,Ll)!==t&&(ne(this,Ll,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return R(this,Ll)}},Ll=new WeakMap,Ta=new WeakMap,Dl=new WeakMap,M4),gp=new d7;function u7(e){return Math.min(1e3*2**e,3e4)}function v3(e){return(e??"online")==="online"?gp.isOnline():!0}var V0=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function w3(e){let t=!1,s=0,r;const a=G0(),o=()=>a.status!=="pending",i=b=>{var w;if(!o()){const x=new V0(b);h(x),(w=e.onCancel)==null||w.call(e,x)}},l=()=>{t=!0},c=()=>{t=!1},d=()=>ky.isFocused()&&(e.networkMode==="always"||gp.isOnline())&&e.canRun(),u=()=>v3(e.networkMode)&&e.canRun(),f=b=>{o()||(r==null||r(),a.resolve(b))},h=b=>{o()||(r==null||r(),a.reject(b))},m=()=>new Promise(b=>{var w;r=x=>{(o()||d())&&b(x)},(w=e.onPause)==null||w.call(e)}).then(()=>{var b;r=void 0,o()||(b=e.onContinue)==null||b.call(e)}),y=()=>{if(o())return;let b;const w=s===0?e.initialPromise:void 0;try{b=w??e.fn()}catch(x){b=Promise.reject(x)}Promise.resolve(b).then(f).catch(x=>{var N;if(o())return;const g=e.retry??(fu.isServer()?0:3),v=e.retryDelay??u7,k=typeof v=="function"?v(s,x):v,S=g===!0||typeof g=="number"&&s<g||typeof g=="function"&&g(s,x);if(t||!S){h(x);return}s++,(N=e.onFail)==null||N.call(e,s,x),r7(k).then(()=>d()?void 0:m()).then(()=>{t?h(x):y()})})};return{promise:a,status:()=>a.status,cancel:i,continue:()=>(r==null||r(),a),cancelRetry:l,continueRetry:c,canStart:u,start:()=>(u()?y():m().then(y),a)}}var Zo,$4,j3=($4=class{constructor(){he(this,Zo)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),F0(this.gcTime)&&ne(this,Zo,Wo.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(fu.isServer()?1/0:5*60*1e3))}clearGcTimeout(){R(this,Zo)!==void 0&&(Wo.clearTimeout(R(this,Zo)),ne(this,Zo,void 0))}},Zo=new WeakMap,$4);function f7(e){return{onFetch:(t,s)=>{var u,f,h,m,y;const r=t.options,a=(h=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,o=((m=t.state.data)==null?void 0:m.pages)||[],i=((y=t.state.data)==null?void 0:y.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let b=!1;const w=v=>{i7(v,()=>t.signal,()=>b=!0)},x=y3(t.options,t.fetchOptions),g=async(v,k,S)=>{if(b)return Promise.reject(t.signal.reason);if(k==null&&v.pages.length)return Promise.resolve(v);const C=(()=>{const A={client:t.client,queryKey:t.queryKey,pageParam:k,direction:S?"backward":"forward",meta:t.options.meta};return w(A),A})(),_=await x(C),{maxPages:T}=t.options,E=S?o7:a7;return{pages:E(v.pages,_,T),pageParams:E(v.pageParams,k,T)}};if(a&&o.length){const v=a==="backward",k=v?k3:K0,S={pages:o,pageParams:i},N=k(r,S);l=await g(S,N,v)}else{const v=e??o.length;do{const k=c===0?i[0]??r.initialPageParam:K0(r,l);if(c>0&&k==null)break;l=await g(l,k),c++}while(c<v)}return l};t.options.persister?t.fetchFn=()=>{var b,w;return(w=(b=t.options).persister)==null?void 0:w.call(b,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s)}:t.fetchFn=d}}}function K0(e,{pages:t,pageParams:s}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,s[r],s):void 0}function k3(e,{pages:t,pageParams:s}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,s[0],s):void 0}function h7(e,t){return t?K0(e,t)!=null:!1}function p7(e,t){return!t||!e.getPreviousPageParam?!1:k3(e,t)!=null}var Il,Yo,Ml,xn,Qo,ts,Iu,Jo,qs,S3,Tr,U4,m7=(U4=class extends j3{constructor(t){super();he(this,qs);he(this,Il);he(this,Yo);he(this,Ml);he(this,xn);he(this,Qo);he(this,ts);he(this,Iu);he(this,Jo);ne(this,Jo,!1),ne(this,Iu,t.defaultOptions),this.setOptions(t.options),this.observers=[],ne(this,Qo,t.client),ne(this,xn,R(this,Qo).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ne(this,Yo,dj(this.options)),this.state=t.state??R(this,Yo),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return R(this,Il)}get promise(){var t;return(t=R(this,ts))==null?void 0:t.promise}setOptions(t){if(this.options={...R(this,Iu),...t},t!=null&&t._type&&ne(this,Il,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const s=dj(this.options);s.data!==void 0&&(this.setState(cj(s.data,s.dataUpdatedAt)),ne(this,Yo,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&R(this,xn).remove(this)}setData(t,s){const r=H0(this.state.data,t,this.options);return Te(this,qs,Tr).call(this,{data:r,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),r}setState(t){Te(this,qs,Tr).call(this,{type:"setState",state:t})}cancel(t){var r,a;const s=(r=R(this,ts))==null?void 0:r.promise;return(a=R(this,ts))==null||a.cancel(t),s?s.then(xs).catch(xs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return R(this,Yo)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Zs(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Cy||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdate
67Count>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Qa(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:!b3(this.state.dataUpdatedAt,t)}onFocus(){var s;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(s=R(this,ts))==null||s.continue()}onOnline(){var s;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(s=R(this,ts))==null||s.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),R(this,xn).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(s=>s!==t),this.observers.length||(R(this,ts)&&(R(this,Jo)||Te(this,qs,S3).call(this)?R(this,ts).cancel({revert:!0}):R(this,ts).cancelRetry()),this.scheduleGc()),R(this,xn).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Te(this,qs,Tr).call(this,{type:"invalidate"})}async fetch(t,s){var d,u,f,h,m,y,b,w,x,g,v;if(this.state.fetchStatus!=="idle"&&((d=R(this,ts))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(R(this,ts))return R(this,ts).continueRetry(),R(this,ts).promise}if(t&&this.setOptions(t),!this.options.queryFn){const k=this.observers.find(S=>S.options.queryFn);k&&this.setOptions(k.options)}const r=new AbortController,a=k=>{Object.defineProperty(k,"signal",{enumerable:!0,get:()=>(ne(this,Jo,!0),r.signal)})},o=()=>{const k=y3(this.options,s),N=(()=>{const C={client:R(this,Qo),queryKey:this.queryKey,meta:this.meta};return a(C),C})();return ne(this,Jo,!1),this.options.persister?this.options.persister(k,N,this):k(N)},l=(()=>{const k={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:R(this,Qo),state:this.state,fetchFn:o};return a(k),k})(),c=R(this,Il)==="infinite"?f7(this.options.pages):this.options.behavior;c==null||c.onFetch(l,this),ne(this,Ml,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=l.fetchOptions)==null?void 0:u.meta))&&Te(this,qs,Tr).call(this,{type:"fetch",meta:(f=l.fetchOptions)==null?void 0:f.meta}),ne(this,ts,w3({initialPromise:s==null?void 0:s.initialPromise,fn:l.fetchFn,onCancel:k=>{k instanceof V0&&k.revert&&this.setState({...R(this,Ml),fetchStatus:"idle"}),r.abort()},onFail:(k,S)=>{Te(this,qs,Tr).call(this,{type:"failed",failureCount:k,error:S})},onPause:()=>{Te(this,qs,Tr).call(this,{type:"pause"})},onContinue:()=>{Te(this,qs,Tr).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const k=await R(this,ts).start();if(k===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(k),(m=(h=R(this,xn).config).onSuccess)==null||m.call(h,k,this),(b=(y=R(this,xn).config).onSettled)==null||b.call(y,k,this.state.error,this),k}catch(k){if(k instanceof V0){if(k.silent)return R(this,ts).promise;if(k.revert){if(this.state.data===void 0)throw k;return this.state.data}}throw Te(this,qs,Tr).call(this,{type:"error",error:k}),(x=(w=R(this,xn).config).onError)==null||x.call(w,k,this),(v=(g=R(this,xn).config).onSettled)==null||v.call(g,this.state.data,k,this),k}finally{this.scheduleGc()}}},Il=new WeakMap,Yo=new WeakMap,Ml=new WeakMap,xn=new WeakMap,Qo=new WeakMap,ts=new WeakMap,Iu=new WeakMap,Jo=new WeakMap,qs=new WeakSet,S3=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Tr=function(t){const s=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,...N3(r.data,this.options),fetchMeta:t.meta??null};case"success":const a={...r,...cj(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ne(this,Ml,t.manual?a:void 0),a;case"error":const o=t.error;
vendor: 5,471 bytes, line 67
67return{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=s(this.state),Dt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),R(this,xn).notify({query:this,type:"updated",action:t})})},U4);function N3(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:v3(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function cj(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function dj(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,s=t!==void 0,r=s?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var Ps,Je,Mu,js,Xo,$l,Ir,Ea,$u,Ul,zl,ei,ti,Ra,Bl,lt,gd,q0,Z0,Y0,Q0,J0,X0,e1,C3,z4,vm=(z4=class extends Pi{constructor(t,s){super();he(this,lt);he(this,Ps);he(this,Je);he(this,Mu);he(this,js);he(this,Xo);he(this,$l);he(this,Ir);he(this,Ea);he(this,$u);he(this,Ul);he(this,zl);he(this,ei);he(this,ti);he(this,Ra);he(this,Bl,new Set);this.options=s,ne(this,Ps,t),ne(this,Ea,null),ne(this,Ir,G0()),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(R(this,Je).addObserver(this),uj(R(this,Je),this.options)?Te(this,lt,gd).call(this):this.updateResult(),Te(this,lt,Q0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return t1(R(this,Je),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return t1(R(this,Je),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Te(this,lt,J0).call(this),Te(this,lt,X0).call(this),R(this,Je).removeObserver(this)}setOptions(t){const s=this.options,r=R(this,Je);if(this.options=R(this,Ps).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Zs(this.options.enabled,R(this,Je))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Te(this,lt,e1).call(this),R(this,Je).setOptions(this.options),s._defaulted&&!uu(this.options,s)&&R(this,Ps).getQueryCache().notify({type:"observerOptionsUpdated",query:R(this,Je),observer:this});const a=this.hasListeners();a&&fj(R(this,Je),r,this.options,s)&&Te(this,lt,gd).call(this),this.updateResult(),a&&(R(this,Je)!==r||Zs(this.options.enabled,R(this,Je))!==Zs(s.enabled,R(this,Je))||Qa(this.options.staleTime,R(this,Je))!==Qa(s.staleTime,R(this,Je)))&&Te(this,lt,q0).call(this);const o=Te(this,lt,Z0).call(this);a&&(R(this,Je)!==r||Zs(this.options.enabled,R(this,Je))!==Zs(s.enabled,R(this,Je))||o!==R(this,Ra))&&Te(this,lt,Y0).call(this,o)}getOptimisticResult(t){const s=R(this,Ps).getQueryCache().build(R(this,Ps),t),r=this.createResult(s,t);return g7(this,r)&&(ne(this,js,r),ne(this,$l,this.options),ne(this,Xo,R(this,Je).state)),r}getCurrentResult(){return R(this,js)}trackResult(t,s){return new Proxy(t,{get:(r,a)=>(this.trackProp(a),s==null||s(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&R(this,Ir).status==="pending"&&R(this,Ir).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,a))})}trackProp(t){R(this,Bl).add(t)}getCurrentQuery(){return R(this,Je)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const s=R(this,Ps).defaultQueryOptions(t),r=R(this,Ps).getQueryCache().build(R(this,Ps),s);return r.fetch().then(()=>this.createResult(r,s))}fetch(t){return Te(this,lt,gd).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),R(this,js)))}createResult(t,s){var T;const r=R(this,Je),a=this.options,o=R(this,js),i=R(this,Xo),l=R(this,$l),d=t!==r?t.state:R(this,Mu),{state:u}=t;let f={...u},h=!1,m;if(s._optimisticResults){const E=this.hasListeners(),A=!E&&uj(t,s),P=E&&fj(t,r,s,a);(A||P)&&(f={...f,...N3(u.data,t.options)}),s._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:y,errorUpdatedAt:b,status:w}=f;m=f.data;let x=!1;if(s.placeholderData!==void 0&&m===void 0&&w==="pending"){let E;o!=null&&o.isPlaceholderData&&s.placeholderData===(l==null?void 0:l.placeholderData)?(E=o.data,x=!0):E=typeof s.placeholderData=="function"?s.placeholderData((T=R(this,zl))==null?void 0:T.state.data,R(this,zl)):s.placeholderData,E!==void 0&&(w="success",m=H0(o==null?void 0:o.data,E,s),h=!0)}if(s.select&&m!==void 0&&!x)if(o&&m===(i==null?void 0:i.data)&&s.select===R(this,$u))m=R(this,Ul);else try{ne(this,$u,s.select),m=s.select(m),m=H0(o==null?void 0:o.data,m,s),ne(this,Ul,m),ne(this,Ea,null)}catch(E){ne(this,Ea,E)}R(this,Ea)&&(y=R(this,Ea),m=R(this,Ul),b=Date.now(),w="error");const g=f.fetchStatus==="fetching",v=w==="pending",k=w==="error",S=v&&g,N=m!==void 0,_={status:w,fetchStatus:f.fetchStatus,isPending:v,isSuccess:w==="success",isError:k,isInitialLoading:S,isLoading:S,data:m,dataUpdatedAt:f.dataUpdatedAt,error:y,errorUpdatedAt:b,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdate
67Count:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:g,isRefetching:g&&!v,isLoadingError:k&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:k&&N,isStale:Ty(t,s),refetch:this.refetch,promise:R(this,Ir),isEnabled:Zs(s.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const E=_.data!==void 0,A=_.status==="error"&&!E,P=F=>{A?F.reject(_.error):E&&F.resolve(_.data)},M=()=>{const F=ne(this,Ir,_.promise=G0());P(F)},U=R(this,Ir);switch(U.status){case"pending":t.queryHash===r.queryHash&&P(U);break;case"fulfilled":(A||_.data!==U.value)&&M();break;case"rejected":(!A||_.error!==U.reason)&&M();break}}return _}updateResult(){const t=R(this,js),s=this.createResult(R(this,Je),this.options);if(ne(this,Xo,R(this,Je).state),ne(this,$l,this.options),R(this,Xo).data!==void 0&&ne(this,zl,R(this,Je)),uu(s,t))return;ne(this,js,s);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,o=typeof a=="function"?a():a;if(o==="all"||!o&&!R(this,Bl).size)return!0;const i=new Set(o??R(this,Bl));return this.options.throwOnError&&i.add("error"),Object.keys(R(this,js)).some(l=>{const c=l;return R(this,js)[c]!==t[c]&&i.has(c)})};Te(this,lt,C3).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Te(this,lt,Q0).call(this)}},Ps=new WeakMap,Je=new WeakMap,Mu=new WeakMap,js=new WeakMap,Xo=new WeakMap,$l=new WeakMap,Ir=new WeakMap,Ea=new WeakMap,$u=new WeakMap,Ul=new WeakMap,zl=new WeakMap,ei=new WeakMap,ti=new WeakMap,Ra=new WeakMap,Bl=new WeakMap,lt=new WeakSet,gd=function(t){Te(this,lt,e1).call(this);let s=R(this,Je).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(xs)),s},q0=function(){Te(this,lt,J0).call(this);const t=Qa(this.options.staleTime,R(this,Je));if(fu.isServer()||R(this,js).isStale||!F0(t))return;const r=b3(R(this,js).dataUpdatedAt,t)+1;ne(this,ei,Wo.setTimeout(()=>{R(this,js).isStale||this.updateResult()},r))},Z0=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(R(this,Je)):this.options.refetchInterval)??!1},Y0=function(t){Te(this,lt,X0).call(this),ne(this,Ra,t),!(fu.isServer()||Zs(this.options.enabled,R(this,Je))===!1||!F0(R(this,Ra))||R(this,Ra)===0)&&ne(this,ti,Wo.setInterval(()=>{(this.options.refetchIntervalInBackground||ky.isFocused())&&Te(this,lt,gd).call(this)},R(this,Ra)))},Q0=function(){Te(this,lt,q0).call(this),Te(this,lt,Y0).call(this,Te(this,lt,Z0).call(this))},J0=function(){R(this,ei)!==void 0&&(Wo.clearTimeout(R(this,ei)),ne(this,ei,void 0))},X0=function(){R(this,ti)!==void 0&&(Wo.clearInterval(R(this,ti)),ne(this,ti,void 0))},e1=function(){const t=R(this,Ps).getQueryCache().build(R(this,Ps),this.options);if(t===R(this,Je))return;const s=R(this,Je);ne(this,Je,t),ne(this,Mu,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},C3=function(t){Dt.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(R(this,js))}),R(this,Ps).getQueryCache().notify({query:R(this,Je),type:"observerResultsUpdated"})})},z4);function x7(e,t){return Zs(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Zs(t.retryOnMount,e)===!1)}function uj(e,t){return x7(e,t)||e.state.data!==void 0&&t1(e,t,t.refetchOnMount)}function t1(e,t,s){if(Zs(t.enabled,e)!==!1&&Qa(t.staleTime,e)!=="static"){const r=typeof s=="function"?s(e):s;return r==="always"||r!==!1&&Ty(e,t)}return!1}function fj(e,t,s,r){return(e!==t||Zs(r.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&Ty(e,s)}function Ty(e,t){return Zs(t.enabled,e)!==!1&&e.isStaleByTime(Qa(t.staleTime,e))}function g7(e,t){return!uu(e.getCurrentResult(),t)}var b7=class extends vm{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}
67fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var y,b;const{state:s}=e,r=super.createResult(e,t),{isFetching:a,isRefetching:o,isError:i,isRefetchError:l}=r,c=(b=(y=s.fetchMeta)==null?void 0:y.fetchMore)==null?void 0:b.direction,d=i&&c==="forward",u=a&&c==="forward",f=i&&c==="backward",h=a&&c==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:h7(t,s.data),hasPreviousPage:p7(t,s.data),isFetchNextPageError:d,isFetchingNextPage:u,isFetchPreviousPageError:f,isFetchingPreviousPage:h,isRefetchError:l&&!d&&!f,isRefetching:o&&!u&&!h}}},Uu,or,ms,si,ir,ya,B4,y7=(B4=class extends j3{constructor(t){super();he(this,ir);he(this,Uu);he(this,or);he(this,ms);he(this,si);ne(this,Uu,t.client),this.mutationId=t.mutationId,ne(this,ms,t.mutationCache),ne(this,or,[]),this.state=t.state||_3(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){R(this,or).includes(t)||(R(this,or).push(t),this.clearGcTimeout(),R(this,ms).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ne(this,or,R(this,or).filter(s=>s!==t)),this.scheduleGc(),R(this,ms).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){R(this,or).length||(this.state.status==="pending"?this.scheduleGc():R(this,ms).remove(this))}continue(){var t;return((t=R(this,si))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,l,c,d,u,f,h,m,y,b,w,x,g,v,k,S,N,C;const s=()=>{Te(this,ir,ya).call(this,{type:"continue"})},r={client:R(this,Uu),meta:this.options.meta,mutationKey:this.options.mutationKey};ne(this,si,w3({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(_,T)=>{Te(this,ir,ya).call(this,{type:"failed",failureCount:_,error:T})},onPause:()=>{Te(this,ir,ya).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>R(this,ms).canRun(this)}));const a=this.state.status==="pending",o=!R(this,si).canStart();try{if(a)s();else{Te(this,ir,ya).call(this,{type:"pending",variables:t,isPaused:o}),R(this,ms).config.onMutate&&await R(this,ms).config.onMutate(t,this,r);
vendor: 5,238 bytes, line 67
67const T=await((l=(i=this.options).onMutate)==null?void 0:l.call(i,t,r));T!==this.state.context&&Te(this,ir,ya).call(this,{type:"pending",context:T,variables:t,isPaused:o})}const _=await R(this,si).start();return await((d=(c=R(this,ms).config).onSuccess)==null?void 0:d.call(c,_,t,this.state.context,this,r)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,_,t,this.state.context,r)),await((m=(h=R(this,ms).config).onSettled)==null?void 0:m.call(h,_,null,this.state.variables,this.state.context,this,r)),await((b=(y=this.options).onSettled)==null?void 0:b.call(y,_,null,t,this.state.context,r)),Te(this,ir,ya).call(this,{type:"success",data:_}),_}catch(_){try{await((x=(w=R(this,ms).config).onError)==null?void 0:x.call(w,_,t,this.state.context,this,r))}catch(T){Promise.reject(T)}try{await((v=(g=this.options).onError)==null?void 0:v.call(g,_,t,this.state.context,r))}catch(T){Promise.reject(T)}try{await((S=(k=R(this,ms).config).onSettled)==null?void 0:S.call(k,void 0,_,this.state.variables,this.state.context,this,r))}catch(T){Promise.reject(T)}try{await((C=(N=this.options).onSettled)==null?void 0:C.call(N,void 0,_,t,this.state.context,r))}catch(T){Promise.reject(T)}throw Te(this,ir,ya).call(this,{type:"error",error:_}),_}finally{R(this,ms).runNext(this)}}},Uu=new WeakMap,or=new WeakMap,ms=new WeakMap,si=new WeakMap,ir=new WeakSet,ya=function(t){const s=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=s(this.state),Dt.batch(()=>{R(this,or).forEach(r=>{r.onMutationUpdate(t)}),R(this,ms).notify({mutation:this,type:"updated",action:t})})},B4);function _3(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Mr,$n,zu,F4,v7=(F4=class extends Pi{constructor(t={}){super();he(this,Mr);he(this,$n);he(this,zu);this.config=t,ne(this,Mr,new Set),ne(this,$n,new Map),ne(this,zu,0)}build(t,s,r){const a=new y7({client:t,mutationCache:this,mutationId:++jf(this,zu)._,options:t.defaultMutationOptions(s),state:r});return this.add(a),a}add(t){R(this,Mr).add(t);const s=zf(t);if(typeof s=="string"){const r=R(this,$n).get(s);r?r.push(t):R(this,$n).set(s,[t])}this.notify({type:"added",mutation:t})}remove(t){if(R(this,Mr).delete(t)){const s=zf(t);if(typeof s=="string"){const r=R(this,$n).get(s);if(r)if(r.length>1){const a=r.indexOf(t);a!==-1&&r.splice(a,1)}else r[0]===t&&R(this,$n).delete(s)}}this.notify({type:"removed",mutation:t})}canRun(t){const s=zf(t);if(typeof s=="string"){const r=R(this,$n).get(s),a=r==null?void 0:r.find(o=>o.state.status==="pending");return!a||a===t}else return!0}runNext(t){var r;const s=zf(t);if(typeof s=="string"){const a=(r=R(this,$n).get(s))==null?void 0:r.find(o=>o!==t&&o.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Dt.batch(()=>{R(this,Mr).forEach(t=>{this.notify({type:"removed",mutation:t})}),R(this,Mr).clear(),R(this,$n).clear()})}getAll(){return Array.from(R(this,Mr))}find(t){const s={exact:!0,...t};return this.getAll().find(r=>oj(s,r))}findAll(t={}){return this.getAll().filter(s=>oj(t,s))}notify(t){Dt.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return Dt.batch(()=>Promise.all(t.map(s=>s.continue().catch(xs))))}},Mr=new WeakMap,$n=new WeakMap,zu=new WeakMap,F4);function zf(e){var t;return(t=e.options.scope)==null?void 0:t.id}var $r,Aa,Os,Ur,Vr,Rh,s1,W4,w7=(W4=class extends Pi{constructor(s,r){super();he(this,Vr);he(this,$r);he(this,Aa);he(this,Os);he(this,Ur);ne(this,$r,s),this.setOptions(r),this.bindMethods(),Te(this,Vr,Rh).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(s){var a;const r=this.options;this.options=R(this,$r).defaultMutationOptions(s),uu(this.options,r)||R(this,$r).getMutationCache().notify({type:"observerOptionsUpdated",mutation:R(this,Os),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&mi(r.mutationKey)!==mi(this.options.mutationKey)?this.reset():((a=R(this,Os))==null?void 0:a.state.status)==="pending"&&R(this,Os).setOptions(this.options)}onUnsubscribe(){var s;this.hasListeners()||(s=R(this,Os))==null||s.removeObserver(this)}onMutationUpdate(s){Te(this,Vr,Rh).call(this),Te(this,Vr,s1).call(this,s)}getCurrentResult(){return R(this,Aa)}reset(){var s;(s=R(this,Os))==null||s.removeObserver(this),ne(this,Os,void 0),Te(this,Vr,Rh).call(this),Te(this,Vr,s1).call(this)}mutate(s,r){var a;return ne(this,Ur,r),(a=R(this,Os))==null||a.removeObserver(this),ne(this,Os,R(this,$r).getMutationCache().build(R(this,$r),this.options)),R(this,Os).addObserver(this),R(this,Os).execute(s)}}
67,$r=new WeakMap,Aa=new WeakMap,Os=new WeakMap,Ur=new WeakMap,Vr=new WeakSet,Rh=function(){var r;const s=((r=R(this,Os))==null?void 0:r.state)??_3();ne(this,Aa,{...s,isPending:s.status==="pending",isSuccess:s.status==="success",isError:s.status==="error",isIdle:s.status==="idle",mutate:this.mutate,reset:this.reset})},s1=function(s){Dt.batch(()=>{var r,a,o,i,l,c,d,u;if(R(this,Ur)&&this.hasListeners()){const f=R(this,Aa).variables,h=R(this,Aa).context,m={client:R(this,$r),meta:this.options.meta,mutationKey:this.options.mutationKey};if((s==null?void 0:s.type)==="success"){try{(a=(r=R(this,Ur)).onSuccess)==null||a.call(r,s.data,f,h,m)}catch(y){Promise.reject(y)}try{(i=(o=R(this,Ur)).onSettled)==null||i.call(o,s.data,null,f,h,m)}catch(y){Promise.reject(y)}}else if((s==null?void 0:s.type)==="error"){try{(c=(l=R(this,Ur)).onError)==null||c.call(l,s.error,f,h,m)}catch(y){Promise.reject(y)}try{(u=(d=R(this,Ur)).onSettled)==null||u.call(d,void 0,s.error,f,h,m)}catch(y){Promise.reject(y)}}}this.listeners.forEach(f=>{f(R(this,Aa))})})},W4);function hj(e,t){const s=new Set(t);return e.filter(r=>!s.has(r))}function j7(e,t,s){const r=e.slice(0);return r[t]=s,r}var Fl,Ls,Wl,ni,Vs,Pa,Bu,Fu,Wu,Hu,Xt,n1,r1,T3,a1,o1,i1,H4,k7=(H4=class extends Pi{constructor(t,s,r){super();he(this,Xt);he(this,Fl);he(this,Ls);he(this,Wl);he(this,ni);he(this,Vs);he(this,Pa);he(this,Bu);he(this,Fu);he(this,Wu);he(this,Hu,[]);ne(this,Fl,t),ne(this,ni,r),ne(this,Wl,[]),ne(this,Vs,[]),ne(this,Ls,[]),this.setQueries(s)}onSubscribe(){this.listeners.size===1&&R(this,Vs).forEach(t=>{t.subscribe(s=>{Te(this,Xt,o1).call(this,t,s)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,R(this,Vs).forEach(t=>{t.destroy()})}setQueries(t,s){ne(this,Wl,t),ne(this,ni,s),Dt.batch(()=>{const r=R(this,Vs),a=Te(this,Xt,a1).call(this,R(this,Wl));a.forEach(f=>f.observer.setOptions(f.defaultedQueryOptions));const o=a.map(f=>f.observer),i=o.map(f=>f.getCurrentResult()),l=r.length!==o.length,c=o.some((f,h)=>f!==r[h]),d=l||c,u=d?!0:i.some((f,h)=>{const m=R(this,Ls)[h];return!m||!uu(f,m)});!d&&!u||(d&&(ne(this,Hu,a),ne(this,Vs,o)),ne(this,Ls,i),this.hasListeners()&&(d&&(hj(r,o).forEach(f=>{f.destroy()}),hj(o,r).forEach(f=>{f.subscribe(h=>{Te(this,Xt,o1).call(this,f,h)})})),Te(this,Xt,i1).call(this)))})}getCurrentResult(){return R(this,Ls)}getQueries(){return R(this,Vs).map(t=>t.getCurrentQuery())}getObservers(){return R(this,Vs)}getOptimisticResult(t,s){const r=Te(this,Xt,a1).call(this,t),a=r.map(i=>i.observer.getOptimisticResult(i.defaultedQueryOptions)),o=r.map(i=>i.defaultedQueryOptions.queryHash);return[a,i=>Te(this,Xt,r1).call(this,i??a,s,o),()=>Te(this,Xt,n1).call(this,a,r)]}},Fl=new WeakMap,Ls=new WeakMap,Wl=new WeakMap,ni=new WeakMap,Vs=new WeakMap,Pa=new WeakMap,Bu=new WeakMap,Fu=new WeakMap,Wu=new WeakMap,Hu=new WeakMap,Xt=new WeakSet,n1=function(t,s){return s.map((r,a)=>{const o=t[a];return r.defaultedQueryOptions.notifyOnChangeProps?o:r.observer.trackResult(o,i=>{s.forEach(l=>{l.observer.trackProp(i)})})})},r1=function(t,s,r){if(s){const a=R(this,Wu),o=r!==void 0&&a!==void 0&&(a.length!==r.length||r.some((i,l)=>i!==a[l]));return(!R(this,Pa)||R(this,Ls)!==R(this,Fu)||o||s!==R(this,Bu))&&(ne(this,Bu,s),ne(this,Fu,R(this,Ls)),r!==void 0&&ne(this,Wu,r),ne(this,Pa,Ny(R(this,Pa),s(t)))),R(this,Pa)}return t},T3=function(){var t;return((t=R(this,ni))==null?void 0:t.combine)!==void 0&&R(this,Vs).some((s,r)=>{var a;return s.options.suspense&&((a=R(this,Ls)[r])==null?void 0:a.data)===void 0})},a1=function(t){const s=new Map;R(this,Vs).forEach(a=>{const o=a.options.queryHash;if(!o)return;const i=s.get(o);i?i.push(a):s.set(o,[a])});const r=[];return t.forEach(a=>{var c;const o=R(this,Fl).defaultQueryOptions(a),l=((c=s.get(o.queryHash))==null?void 0:c.shift())??new vm(R(this,Fl),o);r.push({defaultedQueryOptions:o,observer:l})}),r},o1=function(t,s){const r=R(this,Vs).indexOf(t);r!==-1&&(ne(this,Ls,j7(R(this,Ls),r,s)),Te(this,Xt,i1).call(this))},i1=function(){var t;if(this.hasListeners()){const s=Te(this,Xt,n1).call(this,R(this,Ls),R(this,Hu)),r=Te(this,Xt,T3).call(this),a=R(this,Pa),o=r?a:Te(this,Xt,r1).call(this,s,(t=R(this,ni))==null?void 0:t.combine);(r||a!==o)&&Dt.batch(()=>
vendor: 5,653 bytes, line 67
67{this.listeners.forEach(i=>{i(R(this,Ls))})})}},H4),lr,G4,S7=(G4=class extends Pi{constructor(t={}){super();he(this,lr);this.config=t,ne(this,lr,new Map)}build(t,s,r){const a=s.queryKey,o=s.queryHash??Sy(a,s);let i=this.get(o);return i||(i=new m7({client:t,queryKey:a,queryHash:o,options:t.defaultQueryOptions(s),state:r,defaultOptions:t.getQueryDefaults(a)}),this.add(i)),i}add(t){R(this,lr).has(t.queryHash)||(R(this,lr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=R(this,lr).get(t.queryHash);s&&(t.destroy(),s===t&&R(this,lr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Dt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return R(this,lr).get(t)}getAll(){return[...R(this,lr).values()]}find(t){const s={exact:!0,...t};return this.getAll().find(r=>aj(s,r))}findAll(t={}){const s=this.getAll();return Object.keys(t).length>0?s.filter(r=>aj(t,r)):s}notify(t){Dt.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){Dt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Dt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},lr=new WeakMap,G4),Pt,Oa,La,Hl,Gl,Da,Vl,Kl,V4,N7=(V4=class{constructor(e={}){he(this,Pt);he(this,Oa);he(this,La);he(this,Hl);he(this,Gl);he(this,Da);he(this,Vl);he(this,Kl);ne(this,Pt,e.queryCache||new S7),ne(this,Oa,e.mutationCache||new v7),ne(this,La,e.defaultOptions||{}),ne(this,Hl,new Map),ne(this,Gl,new Map),ne(this,Da,0)}mount(){jf(this,Da)._++,R(this,Da)===1&&(ne(this,Vl,ky.subscribe(async e=>{e&&(await this.resumePausedMutations(),R(this,Pt).onFocus())})),ne(this,Kl,gp.subscribe(async e=>{e&&(await this.resumePausedMutations(),R(this,Pt).onOnline())})))}unmount(){var e,t;jf(this,Da)._--,R(this,Da)===0&&((e=R(this,Vl))==null||e.call(this),ne(this,Vl,void 0),(t=R(this,Kl))==null||t.call(this),ne(this,Kl,void 0))}isFetching(e){return R(this,Pt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return R(this,Oa).findAll({...e,status:"pending"}).length}getQueryData(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=R(this,Pt).get(t.queryHash))==null?void 0:s.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=R(this,Pt).build(this,t),r=s.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(Qa(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return R(this,Pt).findAll(e).map(({queryKey:t,state:s})=>{const r=s.data;return[t,r]})}setQueryData(e,t,s){const r=this.defaultQueryOptions({queryKey:e}),a=R(this,Pt).get(r.queryHash),o=a==null?void 0:a.state.data,i=s7(t,o);if(i!==void 0)return R(this,Pt).build(this,r).setData(i,{...s,manual:!0})}setQueriesData(e,t,s){return Dt.batch(()=>R(this,Pt).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,s)]))}getQueryState(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=R(this,Pt).get(t.queryHash))==null?void 0:s.state}removeQueries(e){const t=R(this,Pt);Dt.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=R(this,Pt);return Dt.batch(()=>(s.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const s={revert:!0,...t},r=Dt.batch(()=>R(this,Pt).findAll(e).map(a=>a.cancel(s)));return Promise.all(r).then(xs).catch(xs)}invalidateQueries(e,t={}){return Dt.batch(()=>(R(this,Pt).findAll(e).forEach(s=>{s.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 s={...t,cancelRefetch:t.cancelRefetch??!0},r=Dt.batch(()=>R(this,Pt).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let o=a.fetch(void 0,s);return s.throwOnError||(o=o.catch(xs)),a.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(xs)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=R(this,Pt).build(this,t);return s.isStaleByTime(Qa(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xs).catch(xs)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xs).catch(xs)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return gp.isOnline()?R(this,Oa).resumePausedMutations():Promise.resolve()}getQueryCache(){return R(this,Pt)}getMutationCache(){return R(this,Oa)}getDefaultOptions(){return R(this,La)}setDefaultOptions(e){ne(this,La,e)}setQueryDefaults(e,t){R(this,Hl).set(mi(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...R(this,Hl).values()],s={};return t.forEach(r=>{du(e,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(e,t){R(this,Gl).set(mi(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...R(this,Gl).values()],s={};return t.forEach(r=>{du(e,r.mutationKey)&&Object.assign(s,r.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;const t={...R(this,La).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Sy(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===Cy&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...R(this,La).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){R(this,Pt).clear(),R(this,Oa).clear()}}
67,Pt=new WeakMap,Oa=new WeakMap,La=new WeakMap,Hl=new WeakMap,Gl=new WeakMap,Da=new WeakMap,Vl=new WeakMap,Kl=new WeakMap,V4),E3=p.createContext(void 0),dn=e=>{const t=p.useContext(E3);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},C7=({client:e,children:t})=>(p.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),n.jsx(E3.Provider,{value:e,children:t})),R3=p.createContext(!1),A3=()=>p.useContext(R3);R3.Provider;function _7(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var T7=p.createContext(_7()),P3=()=>p.useContext(T7),O3=(e,t,s)=>{const r=s!=null&&s.state.error&&typeof e.throwOnError=="function"?_y(e.throwOnError,[s.state.error,s]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},L3=e=>{p.useEffect(()=>{e.clearReset()},[e])},D3=({result:e,errorResetBoundary:t,throwOnError:s,query:r,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(a&&e.data===void 0||_y(s,[e.error,r])),I3=e=>{if(e.suspense){const s=a=>a==="static"?a:Math.max(a??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...a)=>s(r(...a)):s(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},E7=(e,t)=>e.isLoading&&e.isFetching&&!t,l1=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,c1=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function R7({queries:e,...t},s){const r=dn(),a=A3(),o=P3(),i=p.useMemo(()=>e.map(b=>{const w=r.defaultQueryOptions(b);return w._optimisticResults=a?"isRestoring":"optimistic",w}),[e,r,a]);i.forEach(b=>{I3(b);const w=r.getQueryCache().get(b.queryHash);O3(b,o,w)}),L3(o);const[l]=p.useState(()=>new k7(r,i,t)),[c,d,u]=l.getOptimisticResult(i,t.combine),f=!a&&t.subscribed!==!1;p.useSyncExternalStore(p.useCallback(b=>f?l.subscribe(Dt.batchCalls(b)):xs,[l,f]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),p.useEffect(()=>{l.setQueries(i,t)},[i,t,l]);const m=c.some((b,w)=>l1(i[w],b))?c.flatMap((b,w)=>{const x=i[w];if(x&&l1(x,b)){const g=new vm(r,x);return c1(x,g,o)}return[]}):[];if(m.length>0)throw Promise.all(m);const y=c.find((b,w)=>{const x=i[w];return x&&D3({result:b,errorResetBoundary:o,throwOnError:x.throwOnError,query:r.getQueryCache().get(x.queryHash),suspense:x.suspense})});if(y!=null&&y.error)throw y.error;return d(u())}function M3(e,t,s){var h,m,y,b;const r=A3(),a=P3(),o=dn(),i=o.defaultQueryOptions(e);(m=(h=o.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||m.call(h,i);const l=o.getQueryCache().get(i.queryHash);i._optimisticResults=r?"isRestoring":"optimistic",I3(i),O3(i,a,l),L3(a);const c=!o.getQueryCache().get(i.queryHash),[d]=p.useState(()=>new t(o,i)),u=d.getOptimisticResult(i),f=!r&&e.subscribed!==!1;if(p.useSyncExternalStore(p.useCallback(w=>{const x=f?d.subscribe(Dt.batchCalls(w)):xs;return d.updateResult(),x},[d,f]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),p.useEffect(()=>{d.setOptions(i)},[i,d]),l1(i,u))throw c1(i,d,a);if(D3({result:u,errorResetBoundary:a,throwOnError:i.throwOnError,query:l,suspense:i.suspense}))throw u.error;if((b=(y=o.getDefaultOptions().queries)==null?void 0:y._experimental_afterQuery)==null||b.call(y,i,u),i.experimental_prefetchInRender&&!fu.isServer()&&E7(u,r)){const w=c?c1(i,d,a):l==null?void 0:l.promise;w==null||w.catch(xs).finally(()=>{d.updateResult()})}return i.notifyOnChangeProps?u:d.trackResult(u)}function je(e,t){return M3(e,vm)}function $3(e,t){const s=dn(),[r]=p.useState(()=>new w7(s,e));p.useEffect(()=>{r.setOptions(e)},[r,e]);const a=p.useSyncExternalStore(p.useCallback(i=>r.subscribe(Dt.batchCalls(i)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=p.useCallback((i,l)=>{r.mutate(i,l).catch(xs)},[r]);if(a.error&&_y(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:o,mutateAsync:a.mutate}}function A7(e,t){return M3(e,b7)}const P7={trophy_points:5,two_win_points:2,one_win_points:.5},O7=[{label:"Premier",points:10,rank_points:{Platinum:11,Diamond:13,Mythic:15},formats:["PremierDraft","ContenderDraft","PremierDraftRemixArtifacts","ArenaDirect_Draft","DraftChallenge"]},{label:"Trad",points:8,formats:["TradDraft","OpenDraft_D1_Bo3","OpenDraft_D2_Bo3","OpenDraft_D2_Draft1_Bo3","OpenDraft_D2_Draft2_Bo3","OpenDraft_D2_Draft2B_Bo3","PickTwoTradDraft","DecathlonTradDraft"]},{label:"Sealed",points:10,formats:["Sealed","TradSealed","ArenaDirect_Sealed","QualifierPlayInSealed","QualifierPlayInTradSealed","Qualifier_D1_Sealed","Qualifier_D2_Sealed","OpenSealed_D1_Bo1","OpenSealed_D1_Bo3","OpenSealed_D2_Bo3","OpenSealed_D2_Sealed1_Bo3","FIAB_Sealed"]},{label:"Quick",points:4,formats:["QuickDraft","PickTwoDraft","Omniscience_Draft","Emblem_QuickDraft","DecathlonQuickDraft"]},{label:"LCQ Draft 1",points:30,formats:["LimitedChampionshipQualifier_Draft1","OpenDraft_D1_Bo1"]},{label:"LCQ Draft 2",points:10,rule:"lcq_draft_2",formats:["LimitedChampionshipQualifier_Draft2","OpenDraft_D2_Bo1"]}],L7={pod:P7,groups:O7},wm=L7,Ey=wm.groups;var K4;const D7=(K4=wm.pod)==null?void 0:K4.trophy_points;var q4;const I7=(q4=wm.pod)==null?void 0:q4.two_win_points;var Z4;const M7=(Z4=wm.pod)==null?void 0:Z4.one_win_points,$7=Object.fromEntries(Ey.flatMap(e=>e.formats.map(t=>[t,e.label])));function Lr(e){var t;return((t=Ey.find(s=>s.label===e))==null?void 0:t.formats)??[]}const U3=Ey.map(e=>({label:e.label,points:e.points,rule:e.rule,rankPoints:e.rank_points})),Ry=U3.map(e=>({...e,formats:Lr(e.label)})),Sc=3;function jm(e,t,s){return Math.floor(e*D7+t*I7+s*M7)}function U7(e){return e>0?e/(e+2):0}function z7(e){return Ry.find(t=>t.label===e)}function vo(e){const t=new Map;for(const c of e){if(!z7(c.label))continue;const d=t.get(c.label);d?(d.events+=c.events,d.wins+=c.wins,d.losses+=c.losses,d.trophies+=c.trophies,d.weightedTrophies=(d.weightedTrophies??0)+(c.weightedTrophies||c.trophies)):t.set(c.label,{...c,weightedTrophies:c.weightedTrophies||c.trophies})}const s=new Map,r=new Map;let a=0;for(const c of Ry){const d=t.get(c.label);if(!d)continue;if(c.rule==="lcq_draft_2"){const f=d.wins+d.losses;f>0&&d.wins>0&&r.set(c.label,d.wins*(d.wins/f)*c.points);continue}if(d.trophies===0||d.events===0)continue;const u=d.weightedTrophies||d.trophies;s.set(c.label,u*c.points*(d.trophies/d.events)),a+=d.trophies}const o=U7(a),i=new Map;for(const[c,d]of s)i.set(c,d*o);for(const[c,d]of r)i.set(c,d);let l=0;for(const c of i.values())l+=c;return{total:l,confidence:o,contributionByLabel:i}}function B7(e){const t=new Map;for(const s of e){const r=Ry.find(o=>o.formats.includes(s.format));if(!r)continue;const a=t.get(r.label)??{label:r.label,events:0,wins:0,losses:0,trophies:0,weightedTrophies:0};a.events+=s.events,a.wins+=s.wins,a.losses+=s.losses,a.trophies+=s.trophies,a.weightedTrophies=(a.weightedTrophies??0)+(s.weightedTrophies||s.trophies),t.set(r.label,a)}return[...t.values()]}function Ay(e){return e.map(t=>({label:t.formatLabel,events:t.events,wins:t.wins,losses:t.losses,trophies:t.trophies,weightedTrophies:t.weightedTrophies}))}function z3(e){return Math.round(vo(B7(e)).total*100)/100}function Py(e){return Math.round(vo(e).total*100)/100}const F7=new Set(["OTJ","FDN","BLB","DSK"]),W7=new Set(["DFT"]),H7=[{setCode:"TDM",startDate:"2025-04-18",endDate:"2025-04-20"}
67,{setCode:"FIN",startDate:"2025-06-20",endDate:"2025-06-22"},{setCode:"EOE",startDate:"2025-08-08",endDate:"2025-08-11"},{setCode:"TLA",startDate:"2025-11-28",endDate:"2025-11-30"},{setCode:"ECL",startDate:"2026-01-30",endDate:"2026-02-01"},{setCode:"TMT",startDate:"2026-03-13",endDate:"2026-03-15"},{setCode:"SOS",startDate:"2026-04-30",endDate:"2026-05-04"},{setCode:"MSH",startDate:"2026-06-30",endDate:"2026-07-06"},{setCode:"HOB",startDate:"2026-08-14",endDate:"2026-08-23"},{setCode:"FRA",startDate:"2026-10-02",endDate:"2026-10-12"}],pj=1;function mj(e,t){const s=new Date(`${e}T00:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)}function G7(e,t){const s=t.slice(0,10);for(const r of H7){if(r.setCode!==e)continue;const a=mj(r.startDate,-pj),o=mj(r.endDate,pj);if(a<=s&&s<=o)return!0}return!1}function B3(e,t,s,r){return F7.has(e)?r?2:0:W7.has(e)||s&&G7(e,s)?r?1:0:t>=7?2:t===6?1:0}function Oy(e){return e>=6?2e3:e===5?1e3:0}const xj=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"],V7=["Jan.","Feb.","Mar.","Apr.","May","Jun.","Jul.","Aug.","Sept.","Oct.","Nov.","Dec."];function d1(e,t=new Date){const s=parseInt(e.slice(0,4),10),r=parseInt(e.slice(5,7),10),a=parseInt(e.slice(8,10),10);if(!r||!a)return"";const o=`${V7[r-1]} ${a}`;return s&&s!==t.getFullYear()?`${o}, ${s}`:o}function Hr(e){return e.finishedAt??e.startedAt??""}function Sl(e,t){return!e||!t?!1:e.slice(0,10)>K7(t)}function K7(e){const t=new Date(`${e}T00:00:00Z`);return t.setUTCDate(t.getUTCDate()+1),t.toISOString().slice(0,10)}function Nc(e,t,s=1){return(e/Math.max(1,e+t)*100).toFixed(s)}function wo(e){return e?e.replace(/[a-z]/g,""):""}function bp(e){const t="WUBRG";return[...e].sort((s,r)=>t.indexOf(s)-t.indexOf(r)).join("")}function Bt(e){return bp(wo(e))}function F3(e){if(!e)return"";const t=new Set,s=new Set;for(const r of e){const a=r.toUpperCase();"WUBRG".includes(a)&&(r===a?t.add(a):s.add(a))}for(const r of t)s.delete(r);return bp([...t].join(""))+bp([...s].join("")).toLowerCase()}function q7(e){if(!e)return 0;const t=new Set;for(const s of e){const r=s.toUpperCase();"WUBRG".includes(r)&&t.add(r)}return t.size}function Cs(e,t){return q7(e)<4?!1:t?Bt(e).length>=3:!0}function yp(e){const[t,s,r]=e.slice(0,10).split("-").map(Number);return new Date(t,s-1,r)}function Ld(e,t,s=new Date){if(!e)return"";const r=yp(e),a=`${xj[r.getMonth()]} ${r.getDate()}`;if(!t)return`${r.getFullYear()!==s.getFullYear()?`${a}, ${r.getFullYear()}`:a} — NOW`;const o=yp(t),l=`${o.getFullYear()!==r.getFullYear()?`${a}, ${r.getFullYear()}`:a} — ${xj[o.getMonth()]} ${o.getDate()}`;return o.getFullYear()!==s.getFullYear()?`${l}, ${o.getFullYear()}`:l}function W3(e,t=new Date){if(!(e!=null&&e.startDate)||!e.endDate)return null;const s=yp(e.startDate).getTime(),r=yp(e.endDate).getTime(),a=t.getTime();if(a>r)return null;const o=Math.max(1,Math.ceil((r-s)/(7*24*60*60*1e3)));return`WEEK ${Math.max(1,Math.min(o,Math.ceil((a-s)/(7*24*60*60*1e3))))} OF ${o}`}function Cc(e){if(!e)return"—";const t=ro(e);return t==="now"?"NOW":`${t.toUpperCase()} AGO`}function Z7(e){return e?e.reduce((t,s)=>t+s.events,0).toLocaleString():"0"}function ro(e,t=new Date){const s=new Date(e).getTime(),r=t.getTime()-s;if(r<6e4)return"now";const a=Math.floor(r/6e4);if(a<60)return`${a}m`;const o=Math.floor(a/60);if(o<24)return`${o}h`;const i=Math.floor(o/24);if(i<7)return`${i}d`;const l=Math.floor(i/7);if(l<8)return`${l}w`;const c=Math.floor(i/30);return c<12?`${c}mo`:`${Math.floor(i/365)}y`}const H3=[{unit:"year",short:"y",seconds:31536e3},{unit:"month",short:"mo",seconds:2592e3},{unit:"week",short:"w",seconds:604800},{unit:"day",short:"d",seconds:86400},{unit:"hour",short:"h",seconds:3600},{unit:"minute",short:"m",seconds:60}];function Y7(e,t=new Date){const s=new Date(e).getTime();if(Number.isNaN(s))return"";const r=Math.floor((t.getTime()-s)/1e3);for(const{unit:a,seconds:o}of H3){const i=Math.floor(r/o);if(i>=1)return`${i} ${a}${i===1?"":"s"} ago`}return"just now"}function Q7(e,t=new Date){const s=new Date(e).getTime();if(Number.isNaN(s))return"";const r=Math.floor((t.getTime()-s)/1e3);for(const{short:a,seconds:o}of H3){const i=Math.floor(r/o);if(i>=1)return`${i}${a} ago`}return"just now"}const J7={Premier:"Premier Draft",Trad:"Traditional Draft",Quick:"Quick Draft",Sealed:"Sealed","LCQ Draft 1":"LCQ Draft 1","LCQ Draft 2":"LCQ Draft 2",PremierDraft:"Premier Draft",ContenderDraft:"Contender Draft",TradDraft:"Traditional Draft",QuickDraft:"Quick Draft",TradSealed:"Traditional Sealed",ArenaDirect_Sealed:"Arena Direct",QualifierPlayInSealed:"Qualifier Play-In",QualifierPlayInTradSealed:"Qualifier Play-In Bo3",Qualifier_D1_Sealed:"Qualifier Weekend Day 1",Qualifier_D2_Sealed:"Qualifier Weekend Day 2",PickTwoDraft:"Pick Two Draft",Emblem_QuickDraft:"Quick Draft",LimitedChampionshipQualifier_Draft1:"LCQ Draft 1",LimitedChampionshipQualifier_Draft2:"LCQ Draft 2",PodDraft:"Pod Draft",MidWeekQuickDraft:"Quick Draft",MidWeekSealed:"Sealed",DraftChallenge:"Draft Challenge",OpenSealed_D1_Bo1:"Day 1 Sealed Bo1",OpenSealed_D1_Bo3:"Day 1 Sealed Bo3",OpenSealed_D2_Bo3:"Day 2 Sealed Bo3",OpenSealed_D2_Sealed1_Bo3:"Day 2 Sealed 1 Bo3",OpenDraft_D1_Bo1:"Day 1 Draft Bo1",OpenDraft_D1_Bo3:"Day 1 Draft Bo3",OpenDraft_D2_Bo3:"Day 2 Draft Bo3",OpenDraft_D2_Draft1_Bo3:"Day 2 Draft 1 Bo3",OpenDraft_D2_Draft2_Bo3:"Day 2 Draft 2 Bo3",OpenDraft_D2_Draft2B_Bo3:"Day 2 Draft 2B Bo3"};function vp(e){return J7[e]??e}function X7(e){return e.format==="PodDraft"&&e.eventName?km(e.eventName,e.setCode):vp(e.format)}function e9(e,t){return e.startsWith("MidWeek")?{label:"MidWeek Magic",tone:"midweek"}:e.startsWith("Open")?{label:"Arena Open",tone:"open"}:t&&t.startsWith("Y")?{label:"Alchemy",tone:"alchemy"}:null}function t9(e){return e.format!=="LimitedChampionshipQualifier_Draft2"?null:e.wins>=6?"$2K":e.wins===5&&e.losses===2?"$1K":null}function _c(e){return e.replace(/#\d+/,"").replace(/\s*\[[^\]]*\]\s*$/,"").trim()}function $s(e){return _c(e.playerDisplayName??e.displayName)}function Ly(e){return Number((e??"").split("-")[0]||0)>=Sc}function Dy(e){return e.draftmancerName??e.displayName}function u1(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function km(e,t){const s=e.match(/\s+(?:[-–]\s+)?Table\s+(\d+)\s*$/i),r=s?` - Table ${s[1]}`:"",a=s?e.slice(0,s.index).trim():e,o=u1(t);let i=a.replace(/\s+[-–]\s+.+$/,"").trim();const l=i.replace(/^.*\bcube\b\s*/i,"").trim();l&&l!==i&&(i=l);const c=i.search(V3);return c>0&&(i=i.slice(c).trim()),(i.replace(new RegExp(`\\b${o}\\b`,"gi"),"").replace(/\s{2,}/g," ").trim()||i)+r}function G3(e,t,s){const r=u1(t),a=new RegExp(`\\b${r}\\b`,"i").test(e);let o=e;return!a&&s&&!t.startsWith(rs)&&(o=o.replace(new RegExp(`\\b${u1(s)}\\b`,"gi"),t)),o=o.replace(/\s*[-–]?\s*Table\s+\d+\s*$/i,"").replace(/#\d+/g,"").replace(s9," "),a&&(o=o.replace(new RegExp(`\\b${r}\\b`,"gi"),"")),o.replace(/\s{2,}/g," ").trim()}const V3=/\b(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Sept|Oct|Nov|Dec)[a-z]*\.?\s+\d{1,2}\b/i,s9=new RegExp(`\\s*[-–]?\\s*${V3.source}`,"gi");function n9(e){const t=G3(e.name,e.setCode),s=r9(e);return e.ordinal!=null?`#${e.ordinal} ${t}${s}`:t}function r9(e){return(e.tableIndex??1)>1?` - Table ${e.tableIndex}`:""}function K3(e,t){const s=t==null?void 0:t.find(r=>r.code.toLowerCase()===e.toLowerCase());return(s==null?void 0:s.code)??e.toUpperCase()}const rs="CUBE",a9=`${rs}-ALL`;function _n(e){return e.startsWith(`${rs}-`)}function ds(e){return Tc(e)===rs}function Tc(e){return _n(e)?rs:e}function o9(e){return _n(e)?e.slice(rs.length+1):null}const gj="/leaderboard",wp="/player";function kn(e){return e?`${gj}/${e}`:gj}function Gt(e,t){return`${wp}/${e}/${t}`}function q3(e){const t=new URLSearchParams(e);return t.delete("sort"),t.delete("dir"),t.toString()}function Dr(e,t,{checkForDefaultPrevented:s=!0}={}
vendor: 9,525 bytes, line 67
67){return function(a){if(e==null||e(a),s===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function bj(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Z3(...e){return t=>{let s=!1;const r=e.map(a=>{const o=bj(a,t);return!s&&typeof o=="function"&&(s=!0),o});if(s)return()=>{for(let a=0;a<r.length;a++){const o=r[a];typeof o=="function"?o():bj(e[a],null)}}}}function Oi(...e){return p.useCallback(Z3(...e),e)}function Y3(e,t=[]){let s=[];function r(o,i){const l=p.createContext(i),c=s.length;s=[...s,i];const d=f=>{var x;const{scope:h,children:m,...y}=f,b=((x=h==null?void 0:h[e])==null?void 0:x[c])||l,w=p.useMemo(()=>y,Object.values(y));return n.jsx(b.Provider,{value:w,children:m})};d.displayName=o+"Provider";function u(f,h){var b;const m=((b=h==null?void 0:h[e])==null?void 0:b[c])||l,y=p.useContext(m);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[d,u]}const a=()=>{const o=s.map(i=>p.createContext(i));return function(l){const c=(l==null?void 0:l[e])||o;return p.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[r,i9(a,...t)]}function i9(...e){const t=e[0];if(e.length===1)return t;const s=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const i=r.reduce((l,{useScope:c,scopeName:d})=>{const f=c(o)[`__scope${d}`];return{...l,...f}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return s.scopeName=t.scopeName,s}function l9(e){const t=c9(e),s=p.forwardRef((r,a)=>{const{children:o,...i}=r,l=p.Children.toArray(o),c=l.find(u9);if(c){const d=c.props.children,u=l.map(f=>f===c?p.Children.count(d)>1?p.Children.only(null):p.isValidElement(d)?d.props.children:null:f);return n.jsx(t,{...i,ref:a,children:p.isValidElement(d)?p.cloneElement(d,void 0,u):null})}return n.jsx(t,{...i,ref:a,children:o})});return s.displayName=`${e}.Slot`,s}function c9(e){const t=p.forwardRef((s,r)=>{const{children:a,...o}=s;if(p.isValidElement(a)){const i=h9(a),l=f9(o,a.props);return a.type!==p.Fragment&&(l.ref=r?Z3(r,i):i),p.cloneElement(a,l)}return p.Children.count(a)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Q3=Symbol("radix.slottable");function d9(e){const t=({children:s})=>n.jsx(n.Fragment,{children:s});return t.displayName=`${e}.Slottable`,t.__radixId=Q3,t}function u9(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Q3}function f9(e,t){const s={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?s[r]=(...l)=>{const c=o(...l);return a(...l),c}:a&&(s[r]=a):r==="style"?s[r]={...a,...o}:r==="className"&&(s[r]=[a,o].filter(Boolean).join(" "))}return{...e,...s}}function h9(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}var p9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],jo=p9.reduce((e,t)=>{const s=l9(`Primitive.${t}`),r=p.forwardRef((a,o)=>{const{asChild:i,...l}=a,c=i?s:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(c,{...l,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function m9(e,t){e&&It.flushSync(()=>e.dispatchEvent(t))}function Sm(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...s)=>{var r;return(r=t.current)==null?void 0:r.call(t,...s)},[])}function x9(e,t=globalThis==null?void 0:globalThis.document){const s=Sm(e);p.useEffect(()=>{const r=a=>{a.key==="Escape"&&s(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[s,t])}var g9="DismissableLayer",f1="dismissableLayer.update",b9="dismissableLayer.pointerDownOutside",y9="dismissableLayer.focusOutside",yj,J3=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),X3=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:s=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:i,onDismiss:l,...c}=e,d=p.useContext(J3),[u,f]=p.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=p.useState({}),y=Oi(t,C=>f(C)),b=Array.from(d.layers),[w]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),x=b.indexOf(w),g=u?b.indexOf(u):-1,v=d.layersWithOutsidePointerEventsDisabled.size>0,k=g>=x,S=j9(C=>{const _=C.target,T=[...d.branches].some(E=>E.contains(_));!k||T||(a==null||a(C),i==null||i(C),C.defaultPrevented||l==null||l())},h),N=k9(C=>{const _=C.target;[...d.branches].some(E=>E.contains(_))||(o==null||o(C),i==null||i(C),C.defaultPrevented||l==null||l())},h);return x9(C=>{g===d.layers.size-1&&(r==null||r(C),!C.defaultPrevented&&l&&(C.preventDefault(),l()))},h),p.useEffect(()=>{if(u)return s&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(yj=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),vj(),()=>{s&&d.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=yj)}},[u,h,s,d]),p.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),vj())},[u,d]),p.useEffect(()=>{const C=()=>m({});return document.addEventListener(f1,C),()=>document.removeEventListener(f1,C)},[]),n.jsx(jo.div,{...c,ref:y,style:{pointerEvents:v?k?"auto":"none":void 0,...e.style},onFocusCapture:Dr(e.onFocusCapture,N.onFocusCapture),onBlurCapture:Dr(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:Dr(e.onPointerDownCapture,S.onPointerDownCapture)})});X3.displayName=g9;var v9="DismissableLayerBranch",w9=p.forwardRef((e,t)=>{const s=p.useContext(J3),r=p.useRef(null),a=Oi(t,r);return p.useEffect(()=>{const o=r.current;if(o)return s.branches.add(o),()=>{s.branches.delete(o)}},[s.branches]),n.jsx(jo.div,{...e,ref:a})});w9.displayName=v9;function j9(e,t=globalThis==null?void 0:globalThis.document){const s=Sm(e),r=p.useRef(!1),a=p.useRef(()=>{});return p.useEffect(()=>{const o=l=>{if(l.target&&!r.current){let c=function(){eT(b9,s,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},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",a.current)}},[t,s]),{onPointerDownCapture:()=>r.current=!0}}function k9(e,t=globalThis==null?void 0:globalThis.document){const s=Sm(e),r=p.useRef(!1);return p.useEffect(()=>{const a=o=>{o.target&&!r.current&&eT(y9,s,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,s]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function vj(){const e=new CustomEvent(f1);document.dispatchEvent(e)}function eT(e,t,s,{discrete:r}){const a=s.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:s});t&&a.addEventListener(e,t,{once:!0}),r?m9(a,o):a.dispatchEvent(o)}var ao=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},S9=_b[" useId ".trim().toString()]||(()=>{}),N9=0;function C9(e){const[t,s]=p.useState(S9());return ao(()=>{s(r=>r??String(N9++))},[e]),t?`radix-${t}`:""}const _9=["top","right","bottom","left"],oo=Math.min,Ys=Math.max,jp=Math.round,Bf=Math.floor,xr=e=>({x:e,y:e}),T9={left:"right",right:"left",bottom:"top",top:"bottom"};function h1(e,t,s){return Ys(e,oo(t,s))}function Qr(e,t){return typeof e=="function"?e(t):e}function Jr(e){return e.split("-")[0]}function Ec(e){return e.split("-")[1]}function Iy(e){return e==="x"?"y":"x"}function My(e){return e==="y"?"height":"width"}function ur(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function $y(e){return Iy(ur(e))}function E9(e,t,s){s===void 0&&(s=!1);const r=Ec(e),a=$y(e),o=My(a);let i=a==="x"?r===(s?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=kp(i)),[i,kp(i)]}function R9(e){const t=kp(e);return[p1(e),t,p1(t)]}function p1(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const wj=["left","right"],jj=["right","left"],A9=["top","bottom"],P9=["bottom","top"];function O9(e,t,s){switch(e){case"top":case"bottom":return s?t?jj:wj:t?wj:jj;case"left":case"right":return t?A9:P9;default:return[]}}function L9(e,t,s,r){const a=Ec(e);let o=O9(Jr(e),s==="start",r);return a&&(o=o.map(i=>i+"-"+a),t&&(o=o.concat(o.map(p1)))),o}function kp(e){const t=Jr(e);return T9[t]+e.slice(t.length)}function D9(e){return{top:0,right:0,bottom:0,left:0,...e}}function tT(e){return typeof e!="number"?D9(e):{top:e,right:e,bottom:e,left:e}}function Sp(e){const{x:t,y:s,width:r,height:a}=e;return{width:r,height:a,top:s,left:t,right:t+r,bottom:s+a,x:t,y:s}}function kj(e,t,s){let{reference:r,floating:a}=e;const o=ur(t),i=$y(t),l=My(i),c=Jr(t),d=o==="y",u=r.x+r.width/2-a.width/2,f=r.y+r.height/2-a.height/2,h=r[l]/2-a[l]/2;let m;switch(c){case"top":m={x:u,y:r.y-a.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-a.width,y:f};break;default:m={x:r.x,y:r.y}}switch(Ec(t)){case"start":m[i]-=h*(s&&d?-1:1);break;case"end":m[i]+=h*(s&&d?-1:1);break}return m}async function I9(e,t){var s;
vendor: 9,950 bytes, line 67
67t===void 0&&(t={});const{x:r,y:a,platform:o,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=Qr(t,e),y=tT(m),w=l[h?f==="floating"?"reference":"floating":f],x=Sp(await o.getClippingRect({element:(s=await(o.isElement==null?void 0:o.isElement(w)))==null||s?w:w.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),g=f==="floating"?{x:r,y:a,width:i.floating.width,height:i.floating.height}:i.reference,v=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),k=await(o.isElement==null?void 0:o.isElement(v))?await(o.getScale==null?void 0:o.getScale(v))||{x:1,y:1}:{x:1,y:1},S=Sp(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:g,offsetParent:v,strategy:c}):g);return{top:(x.top-S.top+y.top)/k.y,bottom:(S.bottom-x.bottom+y.bottom)/k.y,left:(x.left-S.left+y.left)/k.x,right:(S.right-x.right+y.right)/k.x}}const M9=50,$9=async(e,t,s)=>{const{placement:r="bottom",strategy:a="absolute",middleware:o=[],platform:i}=s,l=i.detectOverflow?i:{...i,detectOverflow:I9},c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:u,y:f}=kj(d,r,c),h=r,m=0;const y={};for(let b=0;b<o.length;b++){const w=o[b];if(!w)continue;const{name:x,fn:g}=w,{x:v,y:k,data:S,reset:N}=await g({x:u,y:f,initialPlacement:r,placement:h,strategy:a,middlewareData:y,rects:d,platform:l,elements:{reference:e,floating:t}});u=v??u,f=k??f,y[x]={...y[x],...S},N&&m<M9&&(m++,typeof N=="object"&&(N.placement&&(h=N.placement),N.rects&&(d=N.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:a}):N.rects),{x:u,y:f}=kj(d,h,c)),b=-1)}return{x:u,y:f,placement:h,strategy:a,middlewareData:y}},U9=e=>({name:"arrow",options:e,async fn(t){const{x:s,y:r,placement:a,rects:o,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:u=0}=Qr(e,t)||{};if(d==null)return{};const f=tT(u),h={x:s,y:r},m=$y(a),y=My(m),b=await i.getDimensions(d),w=m==="y",x=w?"top":"left",g=w?"bottom":"right",v=w?"clientHeight":"clientWidth",k=o.reference[y]+o.reference[m]-h[m]-o.floating[y],S=h[m]-o.reference[m],N=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let C=N?N[v]:0;(!C||!await(i.isElement==null?void 0:i.isElement(N)))&&(C=l.floating[v]||o.floating[y]);const _=k/2-S/2,T=C/2-b[y]/2-1,E=oo(f[x],T),A=oo(f[g],T),P=E,M=C-b[y]-A,U=C/2-b[y]/2+_,F=h1(P,U,M),I=!c.arrow&&Ec(a)!=null&&U!==F&&o.reference[y]/2-(U<P?E:A)-b[y]/2<0,q=I?U<P?U-P:U-M:0;return{[m]:h[m]+q,data:{[m]:F,centerOffset:U-F-q,...I&&{alignmentOffset:q}},reset:I}}}),z9=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var s,r;const{placement:a,middlewareData:o,rects:i,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:b=!0,...w}=Qr(e,t);if((s=o.arrow)!=null&&s.alignmentOffset)return{};const x=Jr(a),g=ur(l),v=Jr(l)===l,k=await(c.isRTL==null?void 0:c.isRTL(d.floating)),S=h||(v||!b?[kp(l)]:R9(l)),N=y!=="none";!h&&N&&S.push(...L9(l,b,y,k));const C=[l,...S],_=await c.detectOverflow(t,w),T=[];let E=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&T.push(_[x]),f){const U=E9(a,i,k);T.push(_[U[0]],_[U[1]])}if(E=[...E,{placement:a,overflows:T}],!T.every(U=>U<=0)){var A,P;const U=(((A=o.flip)==null?void 0:A.index)||0)+1,F=C[U];if(F&&(!(f==="alignment"?g!==ur(F):!1)||E.every(O=>ur(O.placement)===g?O.overflows[0]>0:!0)))return{data:{index:U,overflows:E},reset:{placement:F}};let I=(P=E.filter(q=>q.overflows[0]<=0).sort((q,O)=>q.overflows[1]-O.overflows[1])[0])==null?void 0:P.placement;if(!I)switch(m){case"bestFit":{var M;const q=(M=E.filter(O=>{if(N){const H=ur(O.placement);return H===g||H==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(H=>H>0).reduce((H,B)=>H+B,0)]).sort((O,H)=>O[1]-H[1])[0])==null?void 0:M[0];q&&(I=q);break}case"initialPlacement":I=l;break}if(a!==I)return{reset:{placement:I}}}return{}}}};function Sj(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Nj(e){return _9.some(t=>e[t]>=0)}const B9=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:s,platform:r}=t,{strategy:a="referenceHidden",...o}=Qr(e,t);switch(a){case"referenceHidden":{const i=await r.detectOverflow(t,{...o,elementContext:"reference"}),l=Sj(i,s.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Nj(l)}}}case"escaped":{const i=await r.detectOverflow(t,{...o,altBoundary:!0}),l=Sj(i,s.floating);return{data:{escapedOffsets:l,escaped:Nj(l)}}}default:return{}}}}},sT=new Set(["left","top"]);async function F9(e,t){const{placement:s,platform:r,elements:a}=e,o=await(r.isRTL==null?void 0:r.isRTL(a.floating)),i=Jr(s),l=Ec(s),c=ur(s)==="y",d=sT.has(i)?-1:1,u=o&&c?-1:1,f=Qr(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof y=="number"&&(m=l==="end"?y*-1:y),c?{x:m*u,y:h*d}:{x:h*d,y:m*u}}const W9=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var s,r;const{x:a,y:o,placement:i,middlewareData:l}=t,c=await F9(t,e);return i===((s=l.offset)==null?void 0:s.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:{...c,placement:i}}}}},H9=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:s,y:r,placement:a,platform:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:x=>{let{x:g,y:v}=x;return{x:g,y:v}}},...d}=Qr(e,t),u={x:s,y:r},f=await o.detectOverflow(t,d),h=ur(Jr(a)),m=Iy(h);let y=u[m],b=u[h];if(i){const x=m==="y"?"top":"left",g=m==="y"?"bottom":"right",v=y+f[x],k=y-f[g];y=h1(v,y,k)}if(l){const x=h==="y"?"top":"left",g=h==="y"?"bottom":"right",v=b+f[x],k=b-f[g];b=h1(v,b,k)}const w=c.fn({...t,[m]:y,[h]:b});return{...w,data:{x:w.x-s,y:w.y-r,enabled:{[m]:i,[h]:l}}}}}},G9=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:s,y:r,placement:a,rects:o,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=Qr(e,t),u={x:s,y:r},f=ur(a),h=Iy(f);let m=u[h],y=u[f];const b=Qr(l,t),w=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(c){const v=h==="y"?"height":"width",k=o.reference[h]-o.floating[v]+w.mainAxis,S=o.reference[h]+o.reference[v]-w.mainAxis;m<k?m=k:m>S&&(m=S)}if(d){var x,g;const v=h==="y"?"width":"height",k=sT.has(Jr(a)),S=o.reference[f]-o.floating[v]+(k&&((x=i.offset)==null?void 0:x[f])||0)+(k?0:w.crossAxis),N=o.reference[f]+o.reference[v]+(k?0:((g=i.offset)==null?void 0:g[f])||0)-(k?w.crossAxis:0);y<S?y=S:y>N&&(y=N)}return{[h]:m,[f]:y}}}},V9=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var s,r;const{placement:a,rects:o,platform:i,elements:l}=t,{apply:c=()=>{},...d}=Qr(e,t),u=await i.detectOverflow(t,d),f=Jr(a),h=Ec(a),m=ur(a)==="y",{width:y,height:b}=o.floating;let w,x;f==="top"||f==="bottom"?(w=f,x=h===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(x=f,w=h==="end"?"top":"bottom");const g=b-u.top-u.bottom,v=y-u.left-u.right,k=oo(b-u[w],g),S=oo(y-u[x],v),N=!t.middlewareData.shift;let C=k,_=S;if((s=t.middlewareData.shift)!=null&&s.enabled.x&&(_=v),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=g),N&&!h){const E=Ys(u.left,0),A=Ys(u.right,0),P=Ys(u.top,0),M=Ys(u.bottom,0);m?_=y-2*(E!==0||A!==0?E+A:Ys(u.left,u.right)):C=b-2*(P!==0||M!==0?P+M:Ys(u.top,u.bottom))}await c({...t,availableWidth:_,availableHeight:C});const T=await i.getDimensions(l.floating);return y!==T.width||b!==T.height?{reset:{rects:!0}}:{}}}};function Nm(){return typeof window<"u"}function Rc(e){return nT(e)?(e.nodeName||"").toLowerCase():"#document"}function sn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function jr(e){var t;return(t=(nT(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function nT(e){return Nm()?e instanceof Node||e instanceof sn(e).Node:!1}function Zn(e){return Nm()?e instanceof Element||e instanceof sn(e).Element:!1}function aa(e){return Nm()?e instanceof HTMLElement||e instanceof sn(e).HTMLElement:!1}function Cj(e){return!Nm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof sn(e).ShadowRoot}function Yu(e){const{overflow:t,overflowX:s,overflowY:r,display:a}=Yn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+s)&&a!=="inline"&&a!=="contents"}function K9(e){return/^(table|td|th)$/.test(Rc(e))}function Cm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const q9=/transform|translate|scale|rotate|perspective|filter/,Z9=/paint|layout|strict|content/,Eo=e=>!!e&&e!=="none";let Vx;function Uy(e){const t=Zn(e)?Yn(e):e;return Eo(t.transform)||Eo(t.translate)||Eo(t.scale)||Eo(t.rotate)||Eo(t.perspective)||!zy()&&(Eo(t.backdropFilter)||Eo(t.filter))||q9.test(t.willChange||"")||Z9.test(t.contain||"")}function Y9(e){let t=io(e);for(;aa(t)&&!tc(t);){if(Uy(t))return t;if(Cm(t))return null;t=io(t)}return null}function zy(){return Vx==null&&(Vx=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Vx}function tc(e){return/^(html|body|#document)$/.test(Rc(e))}function Yn(e){return sn(e).getComputedStyle(e)}function _m(e){return Zn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function io(e){if(Rc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Cj(e)&&e.host||jr(e);return Cj(t)?t.host:t}function rT(e){const t=io(e);return tc(t)?e.ownerDocument?e.ownerDocument.body:e.body:aa(t)&&Yu(t)?t:rT(t)}function hu(e,t,s){var r;t===void 0&&(t=[]),s===void 0&&(s=!0);const a=rT(e),o=a===((r=e.ownerDocument)==null?void 0:r.body),i=sn(a);if(o){const l=m1(i);
vendor: 14,344 bytes, line 67
67return t.concat(i,i.visualViewport||[],Yu(a)?a:[],l&&s?hu(l):[])}else return t.concat(a,hu(a,[],s))}function m1(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function aT(e){const t=Yn(e);let s=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=aa(e),o=a?e.offsetWidth:s,i=a?e.offsetHeight:r,l=jp(s)!==o||jp(r)!==i;return l&&(s=o,r=i),{width:s,height:r,$:l}}function By(e){return Zn(e)?e:e.contextElement}function Nl(e){const t=By(e);if(!aa(t))return xr(1);const s=t.getBoundingClientRect(),{width:r,height:a,$:o}=aT(t);let i=(o?jp(s.width):s.width)/r,l=(o?jp(s.height):s.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const Q9=xr(0);function oT(e){const t=sn(e);return!zy()||!t.visualViewport?Q9:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function J9(e,t,s){return t===void 0&&(t=!1),!s||t&&s!==sn(e)?!1:t}function xi(e,t,s,r){t===void 0&&(t=!1),s===void 0&&(s=!1);const a=e.getBoundingClientRect(),o=By(e);let i=xr(1);t&&(r?Zn(r)&&(i=Nl(r)):i=Nl(e));const l=J9(o,s,r)?oT(o):xr(0);let c=(a.left+l.x)/i.x,d=(a.top+l.y)/i.y,u=a.width/i.x,f=a.height/i.y;if(o){const h=sn(o),m=r&&Zn(r)?sn(r):r;let y=h,b=m1(y);for(;b&&r&&m!==y;){const w=Nl(b),x=b.getBoundingClientRect(),g=Yn(b),v=x.left+(b.clientLeft+parseFloat(g.paddingLeft))*w.x,k=x.top+(b.clientTop+parseFloat(g.paddingTop))*w.y;c*=w.x,d*=w.y,u*=w.x,f*=w.y,c+=v,d+=k,y=sn(b),b=m1(y)}}return Sp({width:u,height:f,x:c,y:d})}function Tm(e,t){const s=_m(e).scrollLeft;return t?t.left+s:xi(jr(e)).left+s}function iT(e,t){const s=e.getBoundingClientRect(),r=s.left+t.scrollLeft-Tm(e,s),a=s.top+t.scrollTop;return{x:r,y:a}}function X9(e){let{elements:t,rect:s,offsetParent:r,strategy:a}=e;const o=a==="fixed",i=jr(r),l=t?Cm(t.floating):!1;if(r===i||l&&o)return s;let c={scrollLeft:0,scrollTop:0},d=xr(1);const u=xr(0),f=aa(r);if((f||!f&&!o)&&((Rc(r)!=="body"||Yu(i))&&(c=_m(r)),f)){const m=xi(r);d=Nl(r),u.x=m.x+r.clientLeft,u.y=m.y+r.clientTop}const h=i&&!f&&!o?iT(i,c):xr(0);return{width:s.width*d.x,height:s.height*d.y,x:s.x*d.x-c.scrollLeft*d.x+u.x+h.x,y:s.y*d.y-c.scrollTop*d.y+u.y+h.y}}function e$(e){return Array.from(e.getClientRects())}function t$(e){const t=jr(e),s=_m(e),r=e.ownerDocument.body,a=Ys(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Ys(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-s.scrollLeft+Tm(e);const l=-s.scrollTop;return Yn(r).direction==="rtl"&&(i+=Ys(t.clientWidth,r.clientWidth)-a),{width:a,height:o,x:i,y:l}}const _j=25;function s$(e,t){const s=sn(e),r=jr(e),a=s.visualViewport;let o=r.clientWidth,i=r.clientHeight,l=0,c=0;if(a){o=a.width,i=a.height;const u=zy();(!u||u&&t==="fixed")&&(l=a.offsetLeft,c=a.offsetTop)}const d=Tm(r);if(d<=0){const u=r.ownerDocument,f=u.body,h=getComputedStyle(f),m=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,y=Math.abs(r.clientWidth-f.clientWidth-m);y<=_j&&(o-=y)}else d<=_j&&(o+=d);return{width:o,height:i,x:l,y:c}}function n$(e,t){const s=xi(e,!0,t==="fixed"),r=s.top+e.clientTop,a=s.left+e.clientLeft,o=aa(e)?Nl(e):xr(1),i=e.clientWidth*o.x,l=e.clientHeight*o.y,c=a*o.x,d=r*o.y;return{width:i,height:l,x:c,y:d}}function Tj(e,t,s){let r;if(t==="viewport")r=s$(e,s);else if(t==="document")r=t$(jr(e));else if(Zn(t))r=n$(t,s);else{const a=oT(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Sp(r)}function lT(e,t){const s=io(e);return s===t||!Zn(s)||tc(s)?!1:Yn(s).position==="fixed"||lT(s,t)}function r$(e,t){const s=t.get(e);if(s)return s;let r=hu(e,[],!1).filter(l=>Zn(l)&&Rc(l)!=="body"),a=null;const o=Yn(e).position==="fixed";let i=o?io(e):e;for(;Zn(i)&&!tc(i);){const l=Yn(i),c=Uy(i);!c&&l.position==="fixed"&&(a=null),(o?!c&&!a:!c&&l.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||Yu(i)&&!c&&lT(e,i))?r=r.filter(u=>u!==i):a=l,i=io(i)}return t.set(e,r),r}function a$(e){let{element:t,boundary:s,rootBoundary:r,strategy:a}=e;const i=[...s==="clippingAncestors"?Cm(t)?[]:r$(t,this._c):[].concat(s),r],l=Tj(t,i[0],a);let c=l.top,d=l.right,u=l.bottom,f=l.left;for(let h=1;h<i.length;h++){const m=Tj(t,i[h],a);c=Ys(m.top,c),d=oo(m.right,d),u=oo(m.bottom,u),f=Ys(m.left,f)}return{width:d-f,height:u-c,x:f,y:c}}function o$(e){const{width:t,height:s}=aT(e);return{width:t,height:s}}function i$(e,t,s){const r=aa(t),a=jr(t),o=s==="fixed",i=xi(e,!0,o,t);let l={scrollLeft:0,scrollTop:0};const c=xr(0);function d(){c.x=Tm(a)}if(r||!r&&!o)if((Rc(t)!=="body"||Yu(a))&&(l=_m(t)),r){const m=xi(t,!0,o,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else a&&d();o&&!r&&a&&d();const u=a&&!r&&!o?iT(a,l):xr(0),f=i.left+l.scrollLeft-c.x-u.x,h=i.top+l.scrollTop-c.y-u.y;return{x:f,y:h,width:i.width,height:i.height}}function Kx(e){return Yn(e).position==="static"}function Ej(e,t){if(!aa(e)||Yn(e).position==="fixed")return null;if(t)return t(e);let s=e.offsetParent;return jr(e)===s&&(s=s.ownerDocument.body),s}function cT(e,t){const s=sn(e);if(Cm(e))return s;if(!aa(e)){let a=io(e);for(;a&&!tc(a);){if(Zn(a)&&!Kx(a))return a;a=io(a)}return s}let r=Ej(e,t);for(;r&&K9(r)&&Kx(r);)r=Ej(r,t);return r&&tc(r)&&Kx(r)&&!Uy(r)?s:r||Y9(e)||s}const l$=async function(e){const t=this.getOffsetParent||cT,s=this.getDimensions,r=await s(e.floating);return{reference:i$(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function c$(e){return Yn(e).direction==="rtl"}const d$={convertOffsetParentRelativeRectToViewportRelativeRect:X9,getDocumentElement:jr,getClippingRect:a$,getOffsetParent:cT,getElementRects:l$,getClientRects:e$,getDimensions:o$,getScale:Nl,isElement:Zn,isRTL:c$};function dT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function u$(e,t){let s=null,r;const a=jr(e);function o(){var l;clearTimeout(r),(l=s)==null||l.disconnect(),s=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),o();const d=e.getBoundingClientRect(),{left:u,top:f,width:h,height:m}=d;if(l||t(),!h||!m)return;const y=Bf(f),b=Bf(a.clientWidth-(u+h)),w=Bf(a.clientHeight-(f+m)),x=Bf(u),v={rootMargin:-y+"px "+-b+"px "+-w+"px "+-x+"px",threshold:Ys(0,oo(1,c))||1};let k=!0;function S(N){const C=N[0].intersectionRatio;if(C!==c){if(!k)return i();C?i(!1,C):r=setTimeout(()=>{i(!1,1e-7)},1e3)}C===1&&!dT(d,e.getBoundingClientRect())&&i(),k=!1}try{s=new IntersectionObserver(S,{...v,root:a.ownerDocument})}catch{s=new IntersectionObserver(S,v)}s.observe(e)}return i(!0),o}function f$(e,t,s,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=By(e),u=a||o?[...d?hu(d):[],...t?hu(t):[]]:[];u.forEach(x=>{a&&x.addEventListener("scroll",s,{passive:!0}),o&&x.addEventListener("resize",s)});const f=d&&l?u$(d,s):null;let h=-1,m=null;i&&(m=new ResizeObserver(x=>{let[g]=x;g&&g.target===d&&m&&t&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var v;(v=m)==null||v.observe(t)})),s()}),d&&!c&&m.observe(d),t&&m.observe(t));let y,b=c?xi(e):null;c&&w();function w(){const x=xi(e);b&&!dT(b,x)&&s(),b=x,y=requestAnimationFrame(w)}return s(),()=>{var x;u.forEach(g=>{a&&g.removeEventListener("scroll",s),o&&g.removeEventListener("resize",s)}),f==null||f(),(x=m)==null||x.disconnect(),m=null,c&&cancelAnimationFrame(y)}}const h$=W9,p$=H9,m$=z9,x$=V9,g$=B9,Rj=U9,b$=G9,y$=(e,t,s)=>{const r=new Map,a={platform:d$,...s},o={...a.platform,_c:r};return $9(e,t,{...a,platform:o})};var v$=typeof document<"u",w$=function(){},Ah=v$?p.useLayoutEffect:w$;function Np(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let s,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(s=e.length,s!==t.length)return!1;for(r=s;r--!==0;)if(!Np(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),s=a.length,s!==Object.keys(t).length)return!1;for(r=s;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=s;r--!==0;){const o=a[r];if(!(o==="_owner"&&e.$$typeof)&&!Np(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function uT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Aj(e,t){const s=uT(e);return Math.round(t*s)/s}function qx(e){const t=p.useRef(e);return Ah(()=>{t.current=e}),t}function j$(e){e===void 0&&(e={});const{placement:t="bottom",strategy:s="absolute",middleware:r=[],platform:a,elements:{reference:o,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,f]=p.useState({x:0,y:0,strategy:s,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=p.useState(r);Np(h,r)||m(r);const[y,b]=p.useState(null),[w,x]=p.useState(null),g=p.useCallback(O=>{O!==N.current&&(N.current=O,b(O))},[]),v=p.useCallback(O=>{O!==C.current&&(C.current=O,x(O))},[]),k=o||y,S=i||w,N=p.useRef(null),C=p.useRef(null),_=p.useRef(u),T=c!=null,E=qx(c),A=qx(a),P=qx(d),M=p.useCallback(()=>{if(!N.current||!C.current)return;const O={placement:t,strategy:s,middleware:h};A.current&&(O.platform=A.current),y$(N.current,C.current,O).then(H=>{const B={...H,isPositioned:P.current!==!1};U.current&&!Np(_.current,B)&&(_.current=B,It.flushSync(()=>{f(B)}))})},[h,t,s,A,P]);Ah(()=>{d===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,f(O=>({...O,isPositioned:!1})))},[d]);const U=p.useRef(!1);Ah(()=>(U.current=!0,()=>{U.current=!1}),[]),Ah(()=>{if(k&&(N.current=k),S&&(C.current=S),k&&S){if(E.current)return E.current(k,S,M);M()}},[k,S,M,E,T]);const F=p.useMemo(()=>({reference:N,floating:C,setReference:g,setFloating:v}),[g,v]),I=p.useMemo(()=>({reference:k,floating:S}),[k,S]),q=p.useMemo(()=>{const O={position:s,left:0,top:0};if(!I.floating)return O;const H=Aj(I.floating,u.x),B=Aj(I.floating,u.y);return l?{...O,transform:"translate("+H+"px, "+B+"px)",...uT(I.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:H,top:B}},[s,l,I.floating,u.x,u.y]);return p.useMemo(()=>({...u,update:M,refs:F,elements:I,floatingStyles:q}),[u,M,F,I,q])}const k$=e=>{function t(s){return{}.hasOwnProperty.call(s,"current")}return{name:"arrow",options:e,fn(s){const{element:r,padding:a}=typeof e=="function"?e(s):e;return r&&t(r)?r.current!=null?Rj({element:r.current,padding:a}).fn(s):{}:r?Rj({element:r,padding:a}).fn(s):{}}}},S$=(e,t)=>{const s=h$(e);return{name:s.name,fn:s.fn,options:[e,t]}},N$=(e,t)=>{const s=p$(e);return{name:s.name,fn:s.fn,options:[e,t]}},C$=(e,t)=>({fn:b$(e).fn,options:[e,t]}),_$=(e,t)=>{const s=m$(e);return{name:s.name,fn:s.fn,options:[e,t]}},T$=(e,t)=>{const s=x$(e);return{name:s.name,fn:s.fn,options:[e,t]}},E$=(e,t)=>{const s=g$(e);return{name:s.name,fn:s.fn,options:[e,t]}},R$=(e,t)=>{const s=k$(e);return{name:s.name,fn:s.fn,options:[e,t]}};var A$="Arrow",fT=p.forwardRef((e,t)=>{const{children:s,width:r=10,height:a=5,...o}=e;return n.jsx(jo.svg,{...o,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?s:n.jsx("polygon",{points:"0,0 30,0 15,10"})})});fT.displayName=A$;var P$=fT;function O$(e){const[t,s]=p.useState(void 0);return ao(()=>{if(e){s({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const o=a[0];let i,l;if("borderBoxSize"in o){const c=o.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,l=d.blockSize}else i=e.offsetWidth,l=e.offsetHeight;s({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else s(void 0)},[e]),t}var Fy="Popper",[hT,pT]=Y3(Fy),[L$,mT]=hT(Fy),xT=e=>{const{__scopePopper:t,children:s}=e,[r,a]=p.useState(null);return n.jsx(L$,{scope:t,anchor:r,onAnchorChange:a,children:s})};xT.displayName=Fy;var gT="PopperAnchor",bT=p.forwardRef((e,t)=>{const{__scopePopper:s,virtualRef:r,...a}=e,o=mT(gT,s),i=p.useRef(null),l=Oi(t,i),c=p.useRef(null);return p.useEffect(()=>{const d=c.current;c.current=(r==null?void 0:r.current)||i.current,d!==c.current&&o.onAnchorChange(c.current)}),r?null:n.jsx(jo.div,{...a,ref:l})});bT.displayName=gT;var Wy="PopperContent",[D$,I$]=hT(Wy),yT=p.forwardRef((e,t)=>{var W,J,Z,Y,ae,pe;const{__scopePopper:s,side:r="bottom",sideOffset:a=0,align:o="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:y,...b}=e,w=mT(Wy,s),[x,g]=p.useState(null),v=Oi(t,ye=>g(ye)),[k,S]=p.useState(null),N=O$(k),C=(N==null?void 0:N.width)??0,_=(N==null?void 0:N.height)??0,T=r+(o!=="center"?"-"+o:""),E=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},A=Array.isArray(d)?d:[d],P=A.length>0,M={padding:E,boundary:A.filter($$),altBoundary:P},{refs:U,floatingStyles:F,placement:I,isPositioned:q,middlewareData:O}=j$({strategy:"fixed",placement:T,whileElementsMounted:(...ye)=>f$(...ye,{animationFrame:m==="always"}),elements:{reference:w.anchor},middleware:[S$({mainAxis:a+_,alignmentAxis:i}),c&&N$({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?C$():void 0,...M}),c&&_$({...M}),T$({...M,apply:({elements:ye,rects:De,availableWidth:Fe,availableHeight:tt})=>{const{width:st,height:ie}=De.reference,Se=ye.floating.style;Se.setProperty("--radix-popper-available-width",`${Fe}px`),Se.setProperty("--radix-popper-available-height",`${tt}px`),Se.setProperty("--radix-popper-anchor-width",`${st}px`),Se.setProperty("--radix-popper-anchor-height",`${ie}px`)}}),k&&R$({element:k,padding:l}),U$({arrowWidth:C,arrowHeight:_}),h&&E$({strategy:"referenceHidden",...M})]}),[H,B]=jT(I),D=Sm(y);ao(()=>{q&&(D==null||D())},[q,D]);const L=(W=O.arrow)==null?void 0:W.x,$=(J=O.arrow)==null?void 0:J.y,V=((Z=O.arrow)==null?void 0:Z.centerOffset)!==0,[z,K]=p.useState();return ao(()=>{x&&K(window.getComputedStyle(x).zIndex)},[x]),n.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:q?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:z,"--radix-popper-transform-origin":[(Y=O.transformOrigin)==null?void 0:Y.x,(ae=O.transformOrigin)==null?void 0:ae.y].join(" "),...((pe=O.hide)==null?void 0:pe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:n.jsx(D$,{scope:s,placedSide:H,onArrowChange:S,arrowX:L,arrowY:$,shouldHideArrow:V,children:n.jsx(jo.div,{"data-side":H,"data-align":B,...b,ref:v,style:{...b.style,animation:q?void 0:"none"}})})})});yT.displayName=Wy;var vT="PopperArrow",M$={top:"bottom",right:"left",bottom:"top",left:"r
67ight"},wT=p.forwardRef(function(t,s){const{__scopePopper:r,...a}=t,o=I$(vT,r),i=M$[o.placedSide];return n.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:n.jsx(P$,{...a,ref:s,style:{...a.style,display:"block"}})})});wT.displayName=vT;function $$(e){return e!==null}var U$=e=>({name:"transformOrigin",options:e,fn(t){var w,x,g;const{placement:s,rects:r,middlewareData:a}=t,i=((w=a.arrow)==null?void 0:w.centerOffset)!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,u]=jT(s),f={start:"0%",center:"50%",end:"100%"}[u],h=(((x=a.arrow)==null?void 0:x.x)??0)+l/2,m=(((g=a.arrow)==null?void 0:g.y)??0)+c/2;let y="",b="";return d==="bottom"?(y=i?f:`${h}px`,b=`${-c}px`):d==="top"?(y=i?f:`${h}px`,b=`${r.floating.height+c}px`):d==="right"?(y=`${-c}px`,b=i?f:`${m}px`):d==="left"&&(y=`${r.floating.width+c}px`,b=i?f:`${m}px`),{data:{x:y,y:b}}}});function jT(e){const[t,s="center"]=e.split("-");return[t,s]}var z$=xT,B$=bT,F$=yT,W$=wT,H$="Portal",kT=p.forwardRef((e,t)=>{var l;const{container:s,...r}=e,[a,o]=p.useState(!1);ao(()=>o(!0),[]);const i=s||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return i?KI.createPortal(n.jsx(jo.div,{...r,ref:t}),i):null});kT.displayName=H$;function G$(e,t){return p.useReducer((s,r)=>t[s][r]??s,e)}var Hy=e=>{const{present:t,children:s}=e,r=V$(t),a=typeof s=="function"?s({present:r.isPresent}):p.Children.only(s),o=Oi(r.ref,K$(a));return typeof s=="function"||r.isPresent?p.cloneElement(a,{ref:o}):null};Hy.displayName="Presence";function V$(e){const[t,s]=p.useState(),r=p.useRef(null),a=p.useRef(e),o=p.useRef("none"),i=e?"mounted":"unmounted",[l,c]=G$(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const d=Ff(r.current);o.current=l==="mounted"?d:"none"},[l]),ao(()=>{const d=r.current,u=a.current;if(u!==e){const h=o.current,m=Ff(d);e?c("MOUNT"):m==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&h!==m?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),ao(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,f=m=>{const b=Ff(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&b&&(c("ANIMATION_END"),!a.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},h=m=>{m.target===t&&(o.current=Ff(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:p.useCallback(d=>{r.current=d?getComputedStyle(d):null,s(d)},[])}}function Ff(e){return(e==null?void 0:e.animationName)||"none"}function K$(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}var q$=_b[" useInsertionEffect ".trim().toString()]||ao;function Z$({prop:e,defaultProp:t,onChange:s=()=>{},caller:r}){const[a,o,i]=Y$({defaultProp:t,onChange:s}),l=e!==void 0,c=l?e:a;{const u=p.useRef(e!==void 0);p.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=p.useCallback(u=>{var f;if(l){const h=Q$(u)?u(e):u;h!==e&&((f=i.current)==null||f.call(i,h))}else o(u)},[l,e,o,i]);return[c,d]}function Y$({defaultProp:e,onChange:t}){const[s,r]=p.useState(e),a=p.useRef(s),o=p.useRef(t);return q$(()=>{o.current=t},[t]),p.useEffect(()=>{var i;a.current!==s&&((i=o.current)==null||i.call(o,s),a.current=s)},[s,a]),[s,r,o]}function Q$(e){return typeof e=="function"}var J$=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"}),X$="VisuallyHidden",ST=p.forwardRef((e,t)=>
vendor: 9,313 bytes, lines 67-97
67n.jsx(jo.span,{...e,ref:t,style:{...J$,...e.style}}));ST.displayName=X$;var eU=ST,[Em]=Y3("Tooltip",[pT]),Rm=pT(),NT="TooltipProvider",tU=700,x1="tooltip.open",[sU,Gy]=Em(NT),CT=e=>{const{__scopeTooltip:t,delayDuration:s=tU,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:o}=e,i=p.useRef(!0),l=p.useRef(!1),c=p.useRef(0);return p.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),n.jsx(sU,{scope:t,isOpenDelayedRef:i,delayDuration:s,onOpen:p.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:p.useCallback(d=>{l.current=d},[]),disableHoverableContent:a,children:o})};CT.displayName=NT;var pu="Tooltip",[nU,Qu]=Em(pu),_T=e=>{const{__scopeTooltip:t,children:s,open:r,defaultOpen:a,onOpenChange:o,disableHoverableContent:i,delayDuration:l}=e,c=Gy(pu,e.__scopeTooltip),d=Rm(t),[u,f]=p.useState(null),h=C9(),m=p.useRef(0),y=i??c.disableHoverableContent,b=l??c.delayDuration,w=p.useRef(!1),[x,g]=Z$({prop:r,defaultProp:a??!1,onChange:C=>{C?(c.onOpen(),document.dispatchEvent(new CustomEvent(x1))):c.onClose(),o==null||o(C)},caller:pu}),v=p.useMemo(()=>x?w.current?"delayed-open":"instant-open":"closed",[x]),k=p.useCallback(()=>{window.clearTimeout(m.current),m.current=0,w.current=!1,g(!0)},[g]),S=p.useCallback(()=>{window.clearTimeout(m.current),m.current=0,g(!1)},[g]),N=p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{w.current=!0,g(!0),m.current=0},b)},[b,g]);return p.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),n.jsx(z$,{...d,children:n.jsx(nU,{scope:t,contentId:h,open:x,stateAttribute:v,trigger:u,onTriggerChange:f,onTriggerEnter:p.useCallback(()=>{c.isOpenDelayedRef.current?N():k()},[c.isOpenDelayedRef,N,k]),onTriggerLeave:p.useCallback(()=>{y?S():(window.clearTimeout(m.current),m.current=0)},[S,y]),onOpen:k,onClose:S,disableHoverableContent:y,children:s})})};_T.displayName=pu;var g1="TooltipTrigger",TT=p.forwardRef((e,t)=>{const{__scopeTooltip:s,...r}=e,a=Qu(g1,s),o=Gy(g1,s),i=Rm(s),l=p.useRef(null),c=Oi(t,l,a.onTriggerChange),d=p.useRef(!1),u=p.useRef(!1),f=p.useCallback(()=>d.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),n.jsx(B$,{asChild:!0,...i,children:n.jsx(jo.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:c,onPointerMove:Dr(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:Dr(e.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:Dr(e.onPointerDown,()=>{a.open&&a.onClose(),d.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Dr(e.onFocus,()=>{d.current||a.onOpen()}),onBlur:Dr(e.onBlur,a.onClose),onClick:Dr(e.onClick,a.onClose)})})});TT.displayName=g1;var Vy="TooltipPortal",[rU,aU]=Em(Vy,{forceMount:void 0}),ET=e=>{const{__scopeTooltip:t,forceMount:s,children:r,container:a}=e,o=Qu(Vy,t);return n.jsx(rU,{scope:t,forceMount:s,children:n.jsx(Hy,{present:s||o.open,children:n.jsx(kT,{asChild:!0,container:a,children:r})})})};ET.displayName=Vy;var sc="TooltipContent",RT=p.forwardRef((e,t)=>{const s=aU(sc,e.__scopeTooltip),{forceMount:r=s.forceMount,side:a="top",...o}=e,i=Qu(sc,e.__scopeTooltip);return n.jsx(Hy,{present:r||i.open,children:i.disableHoverableContent?n.jsx(AT,{side:a,...o,ref:t}):n.jsx(oU,{side:a,...o,ref:t})})}),oU=p.forwardRef((e,t)=>{const s=Qu(sc,e.__scopeTooltip),r=Gy(sc,e.__scopeTooltip),a=p.useRef(null),o=Oi(t,a),[i,l]=p.useState(null),{trigger:c,onClose:d}=s,u=a.current,{onPointerInTransitChange:f}=r,h=p.useCallback(()=>{l(null),f(!1)},[f]),m=p.useCallback((y,b)=>{const w=y.currentTarget,x={x:y.clientX,y:y.clientY},g=uU(x,w.getBoundingClientRect()),v=fU(x,g),k=hU(b.getBoundingClientRect()),S=mU([...v,...k]);l(S),f(!0)},[f]);return p.useEffect(()=>()=>h(),[h]),p.useEffect(()=>{if(c&&u){const y=w=>m(w,u),b=w=>m(w,c);return c.addEventListener("pointerleave",y),u.addEventListener("pointerleave",b),()=>{c.removeEventListener("pointerleave",y),u.removeEventListener("pointerleave",b)}}},[c,u,m,h]),p.useEffect(()=>{if(i){const y=b=>{const w=b.target,x={x:b.clientX,y:b.clientY},g=(c==null?void 0:c.contains(w))||(u==null?void 0:u.contains(w)),v=!pU(x,i);g?h():v&&(h(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,u,i,d,h]),n.jsx(AT,{...e,ref:o})}),[iU,lU]=Em(pu,{isInside:!1}),cU=d9("TooltipContent"),AT=p.forwardRef((e,t)=>{const{__scopeTooltip:s,children:r,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:i,...l}=e,c=Qu(sc,s),d=Rm(s),{onClose:u}=c;return p.useEffect(()=>(document.addEventListener(x1,u),()=>document.removeEventListener(x1,u)),[u]),p.useEffect(()=>{if(c.trigger){const f=h=>{const m=h.target;m!=null&&m.contains(c.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,u]),n.jsx(X3,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:n.jsxs(F$,{"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:[n.jsx(cU,{children:r}),n.jsx(iU,{scope:s,isInside:!0,children:n.jsx(eU,{id:c.contentId,role:"tooltip",children:a||r})})]})})});RT.displayName=sc;var PT="TooltipArrow",dU=p.forwardRef((e,t)=>{const{__scopeTooltip:s,...r}=e,a=Rm(s);return lU(PT,s).isInside?null:n.jsx(W$,{...a,...r,ref:t})});dU.displayName=PT;function uU(e,t){const s=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(s,r,a,o)){case o:return"left";case a:return"right";case s:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function fU(e,t,s=5){const r=[];switch(t){case"top":r.push({x:e.x-s,y:e.y+s},{x:e.x+s,y:e.y+s});break;case"bottom":r.push({x:e.x-s,y:e.y-s},{x:e.x+s,y:e.y-s});break;case"left":r.push({x:e.x+s,y:e.y-s},{x:e.x+s,y:e.y+s});break;case"right":r.push({x:e.x-s,y:e.y-s},{x:e.x-s,y:e.y+s});break}return r}function hU(e){const{top:t,right:s,bottom:r,left:a}=e;return[{x:a,y:t},{x:s,y:t},{x:s,y:r},{x:a,y:r}]}function pU(e,t){const{x:s,y:r}=e;let a=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const l=t[o],c=t[i],d=l.x,u=l.y,f=c.x,h=c.y;u>r!=h>r&&s<(f-d)*(r-u)/(h-u)+d&&(a=!a)}return a}function mU(e){const t=e.slice();return t.sort((s,r)=>s.x<r.x?-1:s.x>r.x?1:s.y<r.y?-1:s.y>r.y?1:0),xU(t)}function xU(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 o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(a.y-i.y)>=(o.y-i.y)*(a.x-i.x))t.pop();else break}t.push(a)}t.pop();const s=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;s.length>=2;){const o=s[s.length-1],i=s[s.length-2];if((o.x-i.x)*(a.y-i.y)>=(o.y-i.y)*(a.x-i.x))s.pop();else break}s.push(a)}return s.pop(),t.length===1&&s.length===1&&t[0].x===s[0].x&&t[0].y===s[0].y?t:t.concat(s)}var gU=CT,bU=_T,yU=TT,vU=ET,wU=RT;/**
68 * @license lucide-react v1.14.0 - ISC
69 *
70 * This source code is licensed under the ISC license.
71 * See the LICENSE file in the root directory of this source tree.
72 */const OT=(...e)=>e.filter((t,s,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===s).join(" ").trim();/**
73 * @license lucide-react v1.14.0 - ISC
74 *
75 * This source code is licensed under the ISC license.
76 * See the LICENSE file in the root directory of this source tree.
77 */const jU=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
78 * @license lucide-react v1.14.0 - ISC
79 *
80 * This source code is licensed under the ISC license.
81 * See the LICENSE file in the root directory of this source tree.
82 */const kU=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,r)=>r?r.toUpperCase():s.toLowerCase());/**
83 * @license lucide-react v1.14.0 - ISC
84 *
85 * This source code is licensed under the ISC license.
86 * See the LICENSE file in the root directory of this source tree.
87 */const Pj=e=>{const t=kU(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
88 * @license lucide-react v1.14.0 - ISC
89 *
90 * This source code is licensed under the ISC license.
91 * See the LICENSE file in the root directory of this source tree.
92 */var Zx={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"};/**
93 * @license lucide-react v1.14.0 - ISC
94 *
95 * This source code is licensed under the ISC license.
96 * See the LICENSE file in the root directory of this source tree.
97 */const SU=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},NU=p.createContext({}),CU=()=>p.useContext(NU),_U=p.forwardRef(({color:e,size:t,strokeWidth:s,absoluteStrokeWidth:r,className:a="",children:o,iconNode:i,...l},c)=>
97{const{size:d=24,strokeWidth:u=2,absoluteStrokeWidth:f=!1,color:h="currentColor",className:m=""}=CU()??{},y=r??f?Number(s??u)*24/Number(t??d):s??u;return p.createElement("svg",{ref:c,...Zx,width:t??d??Zx.width,height:t??d??Zx.height,stroke:e??h,strokeWidth:y,className:OT("lucide",m,a),...!o&&!SU(l)&&{"aria-hidden":"true"},...l},[...i.map(([b,w])=>p.createElement(b,w)),...Array.isArray(o)?o:[o]])});/**
98 * @license lucide-react v1.14.0 - ISC
99 *
100 * This source code is licensed under the ISC license.
101 * See the LICENSE file in the root directory of this source tree.
102 */const ue=(e,t)=>{const s=p.forwardRef(({className:r,...a},o)=>p.createElement(_U,{ref:o,iconNode:t,className:OT(`lucide-${jU(Pj(e))}`,`lucide-${e}`,r),...a}));return s.displayName=Pj(e),s};/**
103 * @license lucide-react v1.14.0 - ISC
104 *
105 * This source code is licensed under the ISC license.
106 * See the LICENSE file in the root directory of this source tree.
107 */const TU=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],EU=ue("arrow-down",TU);/**
108 * @license lucide-react v1.14.0 - ISC
109 *
110 * This source code is licensed under the ISC license.
111 * See the LICENSE file in the root directory of this source tree.
112 */const RU=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],nc=ue("arrow-right",RU);/**
113 * @license lucide-react v1.14.0 - ISC
114 *
115 * This source code is licensed under the ISC license.
116 * See the LICENSE file in the root directory of this source tree.
117 */const AU=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],LT=ue("arrow-up-right",AU);/**
118 * @license lucide-react v1.14.0 - ISC
119 *
120 * This source code is licensed under the ISC license.
121 * See the LICENSE file in the root directory of this source tree.
122 */const PU=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],OU=ue("arrow-up",PU);/**
123 * @license lucide-react v1.14.0 - ISC
124 *
125 * This source code is licensed under the ISC license.
126 * See the LICENSE file in the root directory of this source tree.
127 */const LU=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Am=ue("book-open",LU);/**
128 * @license lucide-react v1.14.0 - ISC
129 *
130 * This source code is licensed under the ISC license.
131 * See the LICENSE file in the root directory of this source tree.
132 */const DU=[["path",{d:"m14 18 4 4 4-4",key:"1waygx"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M18 14v8",key:"irew45"}],["path",{d:"M21 11.354V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.343",key:"bse4f3"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]],IU=ue("calendar-arrow-down",DU);/**
133 * @license lucide-react v1.14.0 - ISC
134 *
135 * This source code is licensed under the ISC license.
136 * See the LICENSE file in the root directory of this source tree.
137 */const MU=[["path",{d:"m14 18 4-4 4 4",key:"ftkppy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M18 22v-8",key:"su0gjh"}],["path",{d:"M21 11.343V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h9",key:"1exg90"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]],$U=ue("calendar-arrow-up",MU);/**
138 * @license lucide-react v1.14.0 - ISC
139 *
140 * This source code is licensed under the ISC license.
141 * See the LICENSE file in the root directory of this source tree.
142 */const UU=[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]],DT=ue("calendar-range",UU);/**
143 * @license lucide-react v1.14.0 - ISC
144 *
145 * This source code is licensed under the ISC license.
146 * See the LICENSE file in the root directory of this source tree.
147 */const zU=[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]],IT=ue("captions",zU);/**
148 * @license lucide-react v1.14.0 - ISC
149 *
150 * This source code is licensed under the ISC license.
151 * See the LICENSE file in the root directory of this source tree.
152 */const BU=[["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"}]],Ky=ue("chart-column",BU);/**
153 * @license lucide-react v1.14.0 - ISC
154 *
155 * This source code is licensed under the ISC license.
156 * See the LICENSE file in the root directory of this source tree.
157 */const FU=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],qy=ue("check",FU);/**
158 * @license lucide-react v1.14.0 - ISC
159 *
160 * This source code is licensed under the ISC license.
161 * See the LICENSE file in the root directory of this source tree.
162 */const WU=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],fs=ue("chevron-down",WU);/**
163 * @license lucide-react v1.14.0 - ISC
164 *
165 * This source code is licensed under the ISC license.
166 * See the LICENSE file in the root directory of this source tree.
167 */const HU=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Zy=ue("chevron-left",HU);/**
168 * @license lucide-react v1.14.0 - ISC
169 *
170 * This source code is licensed under the ISC license.
171 * See the LICENSE file in the root directory of this source tree.
172 */const GU=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],rc=ue("chevron-right",GU);/**
173 * @license lucide-react v1.14.0 - ISC
174 *
175 * This source code is licensed under the ISC license.
176 * See the LICENSE file in the root directory of this source tree.
177 */const VU=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Yy=ue("chevron-up",VU);/**
178 * @license lucide-react v1.14.0 - ISC
179 *
180 * This source code is licensed under the ISC license.
181 * See the LICENSE file in the root directory of this source tree.
182 */const KU=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],qU=ue("chevrons-right",KU);/**
183 * @license lucide-react v1.14.0 - ISC
184 *
185 * This source code is licensed under the ISC license.
186 * See the LICENSE file in the root directory of this source tree.
187 */const ZU=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}
187]],YU=ue("chevrons-left",ZU);/**
188 * @license lucide-react v1.14.0 - ISC
189 *
190 * This source code is licensed under the ISC license.
191 * See the LICENSE file in the root directory of this source tree.
192 */const QU=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],JU=ue("chevrons-up-down",QU);/**
193 * @license lucide-react v1.14.0 - ISC
194 *
195 * This source code is licensed under the ISC license.
196 * See the LICENSE file in the root directory of this source tree.
197 */const XU=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ez=ue("circle-play",XU);/**
198 * @license lucide-react v1.14.0 - ISC
199 *
200 * This source code is licensed under the ISC license.
201 * See the LICENSE file in the root directory of this source tree.
202 */const tz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Cp=ue("circle-question-mark",tz);/**
203 * @license lucide-react v1.14.0 - ISC
204 *
205 * This source code is licensed under the ISC license.
206 * See the LICENSE file in the root directory of this source tree.
207 */const sz=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],nz=ue("clipboard-list",sz);/**
208 * @license lucide-react v1.14.0 - ISC
209 *
210 * This source code is licensed under the ISC license.
211 * See the LICENSE file in the root directory of this source tree.
212 */const rz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],az=ue("clock",rz);/**
213 * @license lucide-react v1.14.0 - ISC
214 *
215 * This source code is licensed under the ISC license.
216 * See the LICENSE file in the root directory of this source tree.
217 */const oz=[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48",key:"bq4yh3"}],["path",{d:"M15 6h1v4",key:"11y1tn"}],["path",{d:"m6.134 14.768.866-.5 2 3.464",key:"17snzx"}],["circle",{cx:"16",cy:"8",r:"6",key:"14bfc9"}]],iz=ue("coins",oz);/**
218 * @license lucide-react v1.14.0 - ISC
219 *
220 * This source code is licensed under the ISC license.
221 * See the LICENSE file in the root directory of this source tree.
222 */const lz=[["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"}]],MT=ue("copy",lz);/**
223 * @license lucide-react v1.14.0 - ISC
224 *
225 * This source code is licensed under the ISC license.
226 * See the LICENSE file in the root directory of this source tree.
227 */const cz=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Oj=ue("download",cz);/**
228 * @license lucide-react v1.14.0 - ISC
229 *
230 * This source code is licensed under the ISC license.
231 * See the LICENSE file in the root directory of this source tree.
232 */const dz=[["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"}]],$T=ue("external-link",dz);/**
233 * @license lucide-react v1.14.0 - ISC
234 *
235 * This source code is licensed under the ISC license.
236 * See the LICENSE file in the root directory of this source tree.
237 */const uz=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],fz=ue("flag",uz);/**
238 * @license lucide-react v1.14.0 - ISC
239 *
240 * This source code is licensed under the ISC license.
241 * See the LICENSE file in the root directory of this source tree.
242 */const hz=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],Qy=ue("graduation-cap",hz);/**
243 * @license lucide-react v1.14.0 - ISC
244 *
245 * This source code is licensed under the ISC license.
246 * See the LICENSE file in the root directory of this source tree.
247 */const pz=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],UT=ue("hammer",pz);/**
248 * @license lucide-react v1.14.0 - ISC
249 *
250 * This source code is licensed under the ISC license.
251 * See the LICENSE file in the root directory of this source tree.
252 */const mz=[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]],Ac=ue("headphones",mz);/**
253 * @license lucide-react v1.14.0 - ISC
254 *
255 * This source code is licensed under the ISC license.
256 * See the LICENSE file in the root directory of this source tree.
257 */const xz=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],gz=ue("house",xz);/**
258 * @license lucide-react v1.14.0 - ISC
259 *
260 * This source code is licensed under the ISC license.
261 * See the LICENSE file in the root directory of this source tree.
262 */const bz=[["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"}]],yz=ue("image",bz);/**
263 * @license lucide-react v1.14.0 - ISC
264 *
265 * This source code is licensed under the ISC license.
266 * See the LICENSE file in the root directory of this source tree.
267 */const vz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],wz=ue("info",vz);/**
268 * @license lucide-react v1.14.0 - ISC
269 *
270 * This source code is licensed under the ISC license.
271 * See the LICENSE file in the root directory of this source tree.
272 */const jz=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],zT=ue("layers",jz);/**
273 * @license lucide-react v1.14.0 - ISC
274 *
275 * This source code is licensed under the ISC license.
276 * See the LICENSE file in the root directory of this source tree.
277 */const kz=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Sz=ue("layout-grid",kz);/**
278 * @license lucide-react v1.14.0 - ISC
279 *
280 * This source code is licensed under the ISC license.
281 * See the LICENSE file in the root directory of this source tree.
282 */const Nz=[["path",{d:"M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z",key:"nnexq3"}],["path",{d:"M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12",key:"mt58a7"}]],BT=ue("leaf",Nz);/**
283 * @license lucide-react v1.14.0 - ISC
284 *
285 * This source code is licensed under the ISC license.
286 * See the LICENSE file in the root directory of this source tree.
287 */const Cz=[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}
287],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]],Ph=ue("library",Cz);/**
288 * @license lucide-react v1.14.0 - ISC
289 *
290 * This source code is licensed under the ISC license.
291 * See the LICENSE file in the root directory of this source tree.
292 */const _z=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],Tz=ue("list-checks",_z);/**
293 * @license lucide-react v1.14.0 - ISC
294 *
295 * This source code is licensed under the ISC license.
296 * See the LICENSE file in the root directory of this source tree.
297 */const Ez=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],FT=ue("list-ordered",Ez);/**
298 * @license lucide-react v1.14.0 - ISC
299 *
300 * This source code is licensed under the ISC license.
301 * See the LICENSE file in the root directory of this source tree.
302 */const Rz=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Jy=ue("loader-circle",Rz);/**
303 * @license lucide-react v1.14.0 - ISC
304 *
305 * This source code is licensed under the ISC license.
306 * See the LICENSE file in the root directory of this source tree.
307 */const Az=[["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"}]],Pz=ue("lock",Az);/**
308 * @license lucide-react v1.14.0 - ISC
309 *
310 * This source code is licensed under the ISC license.
311 * See the LICENSE file in the root directory of this source tree.
312 */const Oz=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],WT=ue("log-out",Oz);/**
313 * @license lucide-react v1.14.0 - ISC
314 *
315 * This source code is licensed under the ISC license.
316 * See the LICENSE file in the root directory of this source tree.
317 */const Lz=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Dz=ue("maximize-2",Lz);/**
318 * @license lucide-react v1.14.0 - ISC
319 *
320 * This source code is licensed under the ISC license.
321 * See the LICENSE file in the root directory of this source tree.
322 */const Iz=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],Mz=ue("messages-square",Iz);/**
323 * @license lucide-react v1.14.0 - ISC
324 *
325 * This source code is licensed under the ISC license.
326 * See the LICENSE file in the root directory of this source tree.
327 */const $z=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],Xy=ue("mic",$z);/**
328 * @license lucide-react v1.14.0 - ISC
329 *
330 * This source code is licensed under the ISC license.
331 * See the LICENSE file in the root directory of this source tree.
332 */const Uz=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],zz=ue("minimize-2",Uz);/**
333 * @license lucide-react v1.14.0 - ISC
334 *
335 * This source code is licensed under the ISC license.
336 * See the LICENSE file in the root directory of this source tree.
337 */const Bz=[["path",{d:"M15.033 9.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56V7.648a.645.645 0 0 1 .967-.56z",key:"vbtd3f"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]],HT=ue("monitor-play",Bz);/**
338 * @license lucide-react v1.14.0 - ISC
339 *
340 * This source code is licensed under the ISC license.
341 * See the LICENSE file in the root directory of this source tree.
342 */const Fz=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],Wz=ue("music",Fz);/**
343 * @license lucide-react v1.14.0 - ISC
344 *
345 * This source code is licensed under the ISC license.
346 * See the LICENSE file in the root directory of this source tree.
347 */const Hz=[["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"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],GT=ue("package",Hz);/**
348 * @license lucide-react v1.14.0 - ISC
349 *
350 * This source code is licensed under the ISC license.
351 * See the LICENSE file in the root directory of this source tree.
352 */const Gz=[["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"}]],VT=ue("pencil",Gz);/**
353 * @license lucide-react v1.14.0 - ISC
354 *
355 * This source code is licensed under the ISC license.
356 * See the LICENSE file in the root directory of this source tree.
357 */const Vz=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],KT=ue("refresh-cw",Vz);/**
358 * @license lucide-react v1.14.0 - ISC
359 *
360 * This source code is licensed under the ISC license.
361 * See the LICENSE file in the root directory of this source tree.
362 */const Kz=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],qT=ue("rocket",Kz);/**
363 * @license lucide-react v1.14.0 - ISC
364 *
365 * This source code is licensed under the ISC license.
366 * See the LICENSE file in the root directory of this source tree.
367 */const qz=[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Zz=ue("search-x",qz);/**
368 * @license lucide-react v1.14.0 - ISC
369 *
370 * This source code is licensed under the ISC license.
371 * See the LICENSE file in the root directory of this source tree.
372 */const Yz=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ac=ue("search",Yz);/**
373 * @license lucide-react v1.14.0 - ISC
374 *
375 * This source code is licensed under the ISC license.
376 * See the LICENSE file in the root directory of this source tree.
377 */const Qz=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Jz=ue("settings-2",Qz);/**
378 * @license lucide-react v1.14.0 - ISC
379 *
380 * This source code is licensed under the ISC license.
381 * See the LICENSE file in the root directory of this source tree.
382 */const Xz=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],eB=ue("settings",Xz);/**
383 * @license lucide-react v1.14.0 - ISC
384 *
385 * This source code is licensed under the ISC license.
386 * See the LICENSE file in the root directory of this source tree.
387 */const tB=[["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"}]],sB=ue("shuffle",tB);/**
388 * @license lucide-react v1.14.0 - ISC
389 *
390 * This source code is licensed under the ISC license.
391 * See the LICENSE file in the root directory of this source tree.
392 */const nB=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}
392],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],b1=ue("sliders-horizontal",nB);/**
393 * @license lucide-react v1.14.0 - ISC
394 *
395 * This source code is licensed under the ISC license.
396 * See the LICENSE file in the root directory of this source tree.
397 */const rB=[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]],aB=ue("swords",rB);/**
398 * @license lucide-react v1.14.0 - ISC
399 *
400 * This source code is licensed under the ISC license.
401 * See the LICENSE file in the root directory of this source tree.
402 */const oB=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],iB=ue("trash-2",oB);/**
403 * @license lucide-react v1.14.0 - ISC
404 *
405 * This source code is licensed under the ISC license.
406 * See the LICENSE file in the root directory of this source tree.
407 */const lB=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],cB=ue("trending-up",lB);/**
408 * @license lucide-react v1.14.0 - ISC
409 *
410 * This source code is licensed under the ISC license.
411 * See the LICENSE file in the root directory of this source tree.
412 */const dB=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],ev=ue("trophy",dB);/**
413 * @license lucide-react v1.14.0 - ISC
414 *
415 * This source code is licensed under the ISC license.
416 * See the LICENSE file in the root directory of this source tree.
417 */const uB=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],fB=ue("user",uB);/**
418 * @license lucide-react v1.14.0 - ISC
419 *
420 * This source code is licensed under the ISC license.
421 * See the LICENSE file in the root directory of this source tree.
422 */const hB=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],pB=ue("users",hB);/**
423 * @license lucide-react v1.14.0 - ISC
424 *
425 * This source code is licensed under the ISC license.
426 * See the LICENSE file in the root directory of this source tree.
427 */const mB=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],xB=ue("wrench",mB);/**
428 * @license lucide-react v1.14.0 - ISC
429 *
430 * This source code is licensed under the ISC license.
431 * See the LICENSE file in the root directory of this source tree.
432 */const gB=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],rn=ue("x",gB);/**
433 * @license lucide-react v1.14.0 - ISC
434 *
435 * This source code is licensed under the ISC license.
436 * See the LICENSE file in the root directory of this source tree.
437 */const bB=[["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"}]],ZT=ue("zap",bB);/**
438 * @license lucide-react v1.14.0 - ISC
439 *
440 * This source code is licensed under the ISC license.
441 * See the LICENSE file in the root directory of this source tree.
442 */const yB=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],vB=ue("zoom-in",yB);/**
443 * @license lucide-react v1.14.0 - ISC
444 *
445 * This source code is licensed under the ISC license.
446 * See the LICENSE file in the root directory of this source tree.
447 */const wB=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],jB=ue("zoom-out",wB);
447function YT(){return n.jsxs("section",{children:[n.jsxs("h2",{className:"font-display text-[16px] md:text-[18px] text-text tracking-[0.18em] mb-3 md:mb-4",children:["LEADERBOARD ",n.jsx("span",{className:"text-green",children:"POINTS"})]}),n.jsx(kB,{})]})}function kB(){return n.jsxs("div",{className:"flex flex-col gap-5 md:gap-6",children:[n.jsx("div",{className:"bg-surface border border-border2 px-2.5 py-4 md:px-6 md:py-5 font-mono tracking-tight",children:n.jsxs("div",{className:"flex flex-nowrap items-center justify-center md:justify-start whitespace-nowrap",style:{fontSize:"clamp(9px, 2.8vw, 17px)"},children:[n.jsxs("span",{className:"relative inline-block mr-[0.4em] align-middle",children:[n.jsx("span",{className:"relative -top-[0.1em] text-text text-[2em] leading-none",children:"Σ"}),n.jsx("span",{className:"absolute left-1/2 -translate-x-1/2 top-full -mt-[0.1em] text-green text-[0.6em] tracking-normal leading-none",children:"queues"})]}),n.jsx("span",{className:"text-text",children:"Trophies"}),n.jsx("span",{className:"text-green mx-[0.35em]",children:"×"}),n.jsx("span",{className:"text-text",children:"Weight"}),n.jsx("span",{className:"text-green mx-[0.35em]",children:"×"}),n.jsx("span",{className:"text-text",children:"Trophy Rate"}),n.jsx("span",{className:"text-green mx-[0.35em]",children:"×"}),n.jsx("span",{className:"text-text",children:"Confidence"}),n.jsx("span",{className:"text-green mx-[0.35em] text-[1.3em] align-middle",children:"+"}),n.jsx("span",{className:"text-text",children:"Pod"})]})}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8 lg:gap-12",children:[n.jsxs("div",{className:"flex flex-col gap-2 text-[13px] md:text-[14px] text-muted leading-[1.6]",children:[n.jsxs("p",{children:["Each queue is scored based on ",n.jsx("span",{className:"text-text",children:"trophies"}),", then summed into a single total.",n.jsx("br",{}),"The goal is to reward performance while considering volume."]}),n.jsxs("p",{children:[n.jsx("span",{className:"text-text",children:"Weight"})," values events by difficulty, cost, and prestige."]}),n.jsxs("p",{children:[n.jsx("span",{className:"text-text",children:"Confidence"})," factor"," ",n.jsx("code",{className:"font-mono text-muted text-[11px] md:text-[12px] whitespace-nowrap",children:"trophies / (trophies + 2)"})," ","provides sample-size protection."]}),n.jsx("p",{children:"Filtering by format or deck colors recalculates points using only the matching events."})]}),n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("div",{className:"font-mono text-[10px] text-muted tracking-[0.24em] pb-2 flex justify-between",children:[n.jsx("span",{children:"QUEUE"}),n.jsx("span",{children:"WEIGHT"})]}),n.jsx(fn,{label:"Premier Draft",value:"10"}),n.jsx(fn,{label:"Platinum Trophy",value:"11",nested:!0}),n.jsx(fn,{label:"Diamond Trophy",value:"13",nested:!0}),n.jsx(fn,{label:"Mythic Trophy",value:"15",nested:!0}),n.jsx(fn,{label:"Traditional Draft",value:"8"}),n.jsx(fn,{label:"Sealed",note:"Includes Arena Direct",value:"10"}),n.jsx(fn,{label:"Quick & Pick Two Draft",value:"4"}),n.jsx(fn,{label:"ALCQ Draft 1",value:"30"}),n.jsx(fn,{label:"ALCQ Draft 2",note:"Per Game Win",value:"10"})]})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 lg:gap-12",children:[n.jsx("div",{className:"flex flex-col gap-2 text-[13px] md:text-[14px] text-muted leading-[1.6]",children:n.jsxs("p",{children:[n.jsx("span",{className:"text-text",children:"Pod Drafts"})," score on their own, adding flat points directly to the total with no other factors applied. Points count match wins, so two wins pay the same whether the third match was lost or forfeited by an opponent who dropped. The pod total rounds down, so half points bank until a second one-win finish."]})}),n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("div",{className:"font-mono text-[10px] text-muted tracking-[0.24em] pb-2 flex justify-between",children:[n.jsx("span",{children:"POD DRAFT"}),n.jsx("span",{children:"POINTS"})]}),n.jsx(fn,{label:"Trophy",value:"5"}),n.jsx(fn,{label:"2 Wins",value:"2"}),n.jsx(fn,{label:"1 Win",value:n.jsx("span",{className:"text-[18px] md:text-[20px]",children:"½"})})]})]}),n.jsx("p",{className:"text-dim italic leading-[1.6] text-right whitespace-nowrap -my-2 md:-my-3",style:{fontSize:"clamp(10px, 3.2vw, 13px)"},children:"Scoring may change based on community feedback."})]})}function fn({label:e,note:t,value:s,nested:r}){return n.jsxs("div",{className:`flex items-baseline gap-2 py-1.5${r?" pl-4 md:pl-5":""}`,children:[n.jsx("span",{className:r?"text-[12px] md:text-[13px] text-muted shrink-0":"font-display text-[13px] md:text-[15px] tracking-[0.04em] text-text shrink-0",children:e}),t&&n.jsx("span",{className:"text-[11px] md:text-[12px] text-muted italic shrink-0",children:t}),n.jsx("span",{className:"flex-1 border-b border-dotted border-dim relative -top-1.5"}),n.jsx("span",{className:"font-num text-[13px] md:text-[14px] text-muted tabular-nums",children:s})]})}const gi={openedInApp:!0},Ju=e=>{var a;const t=ln(),r=((a=Rt().state)==null?void 0:a.openedInApp)===!0;return()=>{if(r){t(-1);return}t(e,{replace:!0})}},QT="#about";function SB(){const e=Rt(),t=e.hash===QT,s=Ju({pathname:e.pathname,search:e.search});return p.useEffect(()=>{if(!t)return;const r=o=>{o.key==="Escape"&&s()};document.addEventListener("keydown",r);const a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",r),document.body.style.overflow=a}},[t,s]),t?It.createPortal(n.jsxs("div",{className:"fixed inset-0 z-50 flex items-start md:items-center justify-center p-3 md:p-6 overflow-y-auto animate-fadeIn",children:[n.jsx("div",{className:"absolute inset-0 bg-black/70",onClick:s,"aria-hidden":"true"}),n.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Leaderboard points",className:"relative z-10 w-full max-w-[1040px] my-auto bg-bg border border-border2 themed-scrollbar max-h-[92vh] overflow-y-auto p-5 md:p-8",children:[n.jsx("button",{type:"button",onClick:s,"aria-label":"Close",className:"absolute top-3 right-3 text-muted hover:text-text transition-colors p-1 bg-transparent border-0 cursor-pointer",children:n.jsx(rn,{size:18})}),n.jsx(YT,{})]})]}),document.body):null}function Pm(e,t){var s={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(s[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])&&(s[r[a]]=e[r[a]]);return s}function NB(e,t,s,r){function a(o){return o instanceof s?o:new s(function(i){i(o)})}
447return new(s||(s=Promise))(function(o,i){function l(u){try{d(r.next(u))}catch(f){i(f)}}function c(u){try{d(r.throw(u))}catch(f){i(f)}}function d(u){u.done?o(u.value):a(u.value).then(l,c)}d((r=r.apply(e,t||[])).next())})}const CB=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class tv extends Error{constructor(t,s="FunctionsError",r){super(t),this.name=s,this.context=r}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class _B extends tv{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Lj extends tv{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Dj extends tv{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var y1;(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"})(y1||(y1={}));class TB{constructor(t,{headers:s={},customFetch:r,region:a=y1.Any}={}){this.url=t,this.headers=s,this.region=a,this.fetch=CB(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return NB(this,arguments,void 0,function*(s,r={}){var a;let o,i;try{const{headers:l,method:c,body:d,signal:u,timeout:f}=r;let h={},{region:m}=r;m||(m=this.region);const y=new URL(`${this.url}/${s}`);m&&m!=="any"&&(h["x-region"]=m,y.searchParams.set("forceFunctionRegion",m));let b;d&&(l&&!Object.prototype.hasOwnProperty.call(l,"Content-Type")||!l)?typeof Blob<"u"&&d instanceof Blob||d instanceof ArrayBuffer?(h["Content-Type"]="application/octet-stream",b=d):typeof d=="string"?(h["Content-Type"]="text/plain",b=d):typeof FormData<"u"&&d instanceof FormData?b=d:(h["Content-Type"]="application/json",b=JSON.stringify(d)):d&&typeof d!="string"&&!(typeof Blob<"u"&&d instanceof Blob)&&!(d instanceof ArrayBuffer)&&!(typeof FormData<"u"&&d instanceof FormData)?b=JSON.stringify(d):b=d;let w=u;f&&(i=new AbortController,o=setTimeout(()=>i.abort(),f),u?(w=i.signal,u.addEventListener("abort",()=>i.abort())):w=i.signal);const x=yield this.fetch(y.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},h),this.headers),l),body:b,signal:w}).catch(S=>{throw new _B(S)}),g=x.headers.get("x-relay-error");if(g&&g==="true")throw new Lj(x);if(!x.ok)throw new Dj(x);let v=((a=x.headers.get("Content-Type"))!==null&&a!==void 0?a:"text/plain").split(";")[0].trim(),k;return v==="application/json"?k=yield x.json():v==="application/octet-stream"||v==="application/pdf"?k=yield x.blob():v==="text/event-stream"?k=x:v==="multipart/form-data"?k=yield x.formData():k=yield x.text(),{data:k,error:null,response:x}}catch(l){return{data:null,error:l,response:l instanceof Dj||l instanceof Lj?l.context:void 0}}finally{o&&clearTimeout(o)}})}}const JT=3,Ij=e=>Math.min(1e3*2**e,3e4),EB=[520,503],XT=["GET","HEAD","OPTIONS"];var RB=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.co
447de=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function Mj(e,t){return new Promise(s=>{if(t!=null&&t.aborted){s();return}const r=setTimeout(()=>{t==null||t.removeEventListener("abort",a),s()},e);function a(){clearTimeout(r),s()}t==null||t.addEventListener("abort",a)})}function AB(e,t,s,r){return!(!r||s>=JT||!XT.includes(e)||!EB.includes(t))}var PB=class{constructor(e){var t,s,r,a,o;this.shouldThrowOnError=!1,this.retryEnabled=!0,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=(s=e.isMaybeSingle)!==null&&s!==void 0?s:!1,this.shouldStripNulls=(r=e.shouldStripNulls)!==null&&r!==void 0?r:!1,this.urlLengthLimit=(a=e.urlLengthLimit)!==null&&a!==void 0?a:8e3,this.retryEnabled=(o=e.retry)!==null&&o!==void 0?o:!0,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var s=this;if(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"),this.shouldStripNulls){const i=this.headers.get("Accept");i==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!i||i==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const r=this.fetch;let o=(async()=>{let i=0;for(;;){const d=new Headers(s.headers);i>0&&d.set("X-Retry-Count",String(i));let u;try{u=await r(s.url.toString(),{method:s.method,headers:d,body:JSON.stringify(s.body,(f,h)=>typeof h=="bigint"?h.toString():h),signal:s.signal})}catch(f){if((f==null?void 0:f.name)==="AbortError"||(f==null?void 0:f.code)==="ABORT_ERR"||!XT.includes(s.method))throw f;if(s.retryEnabled&&i<JT){const h=Ij(i);i++,await Mj(h,s.signal);continue}throw f}if(AB(s.method,u.status,i,s.retryEnabled)){var l,c;const f=(l=(c=u.headers)===null||c===void 0?void 0:c.get("Retry-After"))!==null&&l!==void 0?l:null,h=f!==null?Math.max(0,parseInt(f,10)||0)*1e3:Ij(i);await u.text(),i++,await Mj(h,s.signal);continue}return await s.processResponse(u)}})();return this.shouldThrowOnError||(o=o.catch(i=>{var l;let c="",d="",u="";const f=i==null?void 0:i.cause;if(f){var h,m,y,b;const g=(h=f==null?void 0:f.message)!==null&&h!==void 0?h:"",v=(m=f==null?void 0:f.code)!==null&&m!==void 0?m:"";c=`${(y=i==null?void 0:i.name)!==null&&y!==void 0?y:"FetchError"}: ${i==null?void 0:i.message}`,c+=`
448
449Caused by: ${(b=f==null?void 0:f.name)!==null&&b!==void 0?b:"Error"}: ${g}`,v&&(c+=` (${v})`),f!=null&&f.stack&&(c+=`
450${f.stack}`)}else{var w;c=(w=i==null?void 0:i.stack)!==null&&w!==void 0?w:""}const x=this.url.toString().length;return(i==null?void 0:i.name)==="AbortError"||(i==null?void 0:i.code)==="ABORT_ERR"?(u="",d="Request was aborted (timeout or manual cancellation)",x>this.urlLengthLimit&&(d+=`. Note: Your request URL is ${x} 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.`)):((f==null?void 0:f.name)==="HeadersOverflowError"||(f==null?void 0:f.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",d="HTTP headers exceeded server limits (typically 16KB)",x>this.urlLengthLimit&&(d+=`. Your request URL is ${x} 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.`)),{success:!1,error:{message:`${(l=i==null?void 0:i.name)!==null&&l!==void 0?l:"FetchError"}: ${i==null?void 0:i.message}`,details:c,hint:d,code:u},data:null,count:null,status:0,statusText:""}}
450)),o.then(e,t)}async processResponse(e){var t=this;let s=null,r=null,a=null,o=e.status,i=e.statusText;if(e.ok){var l,c;if(t.method!=="HEAD"){var d;const h=await e.text();h===""||(t.headers.get("Accept")==="text/csv"||t.headers.get("Accept")&&(!((d=t.headers.get("Accept"))===null||d===void 0)&&d.includes("application/vnd.pgrst.plan+text"))?r=h:r=JSON.parse(h))}const u=(l=t.headers.get("Prefer"))===null||l===void 0?void 0:l.match(/count=(exact|planned|estimated)/),f=(c=e.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");u&&f&&f.length>1&&(a=parseInt(f[1])),t.isMaybeSingle&&Array.isArray(r)&&(r.length>1?(s={code:"PGRST116",details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},r=null,a=null,o=406,i="Not Acceptable"):r.length===1?r=r[0]:r=null)}else{const u=await e.text();try{s=JSON.parse(u),Array.isArray(s)&&e.status===404&&(r=[],s=null,o=200,i="OK")}catch{e.status===404&&u===""?(o=204,i="No Content"):s={message:u}}if(s&&t.shouldThrowOnError)throw new RB(s)}return{success:s===null,error:s,data:r,count:a,status:o,statusText:i}}returns(){return this}overrideTypes(){return this}},OB=class extends PB{select(e){let t=!1;const s=(e??"*").split("").map(r=>/\s/.test(r)&&!t?"":(r==='"'&&(t=!t),r)).join("");return this.url.searchParams.set("select",s),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:s,foreignTable:r,referencedTable:a=r}={}){const o=a?`${a}.order`:"order",i=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${i?`${i},`:""}${e}.${t?"asc":"desc"}${s===void 0?"":s?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:s=t}={}){const r=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:s,referencedTable:r=s}={}){const a=typeof r>"u"?"offset":`${r}.offset`,o=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(a,`${e}`),this.url.searchParams.set(o,`${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.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:s=!1,buffers:r=!1,wal:a=!1,format:o="text"}={}){var i;const l=[e?"analyze":null,t?"verbose":null,s?"settings":null,r?"buffers":null,a?"wal":null].filter(Boolean).join("|"),c=(i=this.headers.get("Accept"))!==null&&i!==void 0?i:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${o}; for="${c}"; options=${l};`),o==="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 $j=new RegExp("[,()]");var Qi=class extends OB{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 s=Array.from(new Set(t)).map(r=>typeof r=="string"&&$j.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`in.(${s})`),this}notIn(e,t){const s=Array.from(new Set(t)).map(r=>typeof r=="string"&&$j.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`not.in.(${s})`),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:s,type:r}={}){let a="";r==="plain"?a="pl":r==="phrase"?a="ph":r==="websearch"&&(a="w");const o=s===void 0?"":`(${s})`;return this.url.searchParams.append(e,`${a}fts${o}.${t}`),this}match(e){return Object.entries(e).filter(([t,s])=>
450s!==void 0).forEach(([t,s])=>{this.url.searchParams.append(t,`eq.${s}`)}),this}not(e,t,s){return this.url.searchParams.append(e,`not.${t}.${s}`),this}or(e,{foreignTable:t,referencedTable:s=t}={}){const r=s?`${s}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,s){return this.url.searchParams.append(e,`${t}.${s}`),this}},LB=class{constructor(e,{headers:t={},schema:s,fetch:r,urlLengthLimit:a=8e3,retry:o}){this.url=e,this.headers=new Headers(t),this.schema=s,this.fetch=r,this.urlLengthLimit=a,this.retry=o}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:s=!1,count:r}=t??{},a=s?"HEAD":"GET";let o=!1;const i=(e??"*").split("").map(d=>/\s/.test(d)&&!o?"":(d==='"'&&(o=!o),d)).join(""),{url:l,headers:c}=this.cloneRequestState();return l.searchParams.set("select",i),r&&c.append("Prefer",`count=${r}`),new Qi({method:a,url:l,headers:c,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:s=!0}={}){var r;const a="POST",{url:o,headers:i}=this.cloneRequestState();if(t&&i.append("Prefer",`count=${t}`),s||i.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}"`);o.searchParams.set("columns",c.join(","))}}return new Qi({method:a,url:o,headers:i,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:s=!1,count:r,defaultToNull:a=!0}={}){var o;const i="POST",{url:l,headers:c}=this.cloneRequestState();if(c.append("Prefer",`resolution=${s?"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 Qi({method:i,url:l,headers:c,schema:this.schema,body:e,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var s;const r="PATCH",{url:a,headers:o}=this.cloneRequestState();return t&&o.append("Prefer",`count=${t}`),new Qi({method:r,url:a,headers:o,schema:this.schema,body:e,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const s="DELETE",{url:r,headers:a}=this.cloneRequestState();return e&&a.append("Prefer",`count=${e}`),new Qi({method:s,url:r,headers:a,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function mu(e){"@babel/helpers - typeof";return mu=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},mu(e)}function DB(e,t){if(mu(e)!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var r=s.call(e,t);if(mu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function IB(e){var t=DB(e,"string");return mu(t)=="symbol"?t:t+""}function MB(e,t,s){return(t=IB(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function Uj(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),s.push.apply(s,r)}return s}function Wf(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?Uj(Object(s),!0).forEach(function(r){MB(e,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Uj(Object(s)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(s,r))})}return e}var $B=class eE{constructor(t,{headers:s={},schema:r,fetch:a,timeout:o,urlLengthLimit:i=8e3,retry:l}={}){this.url=t,this.headers=new Headers(s),this.schemaName=r,this.urlLengthLimit=i;const c=a??globalThis.fetch;o!==void 0&&o>0?this.fetch=(d,u)=>{const f=new AbortController,h=setTimeout(()=>f.abort(),o),m=u==null?void 0:u.signal;if(m){if(m.aborted)return clearTimeout(h),c(d,u);const y=()=>{clearTimeout(h),f.abort()};return m.addEventListener("abort",y,{once:!0}),c(d,Wf(Wf({},u),{}
450,{signal:f.signal})).finally(()=>{clearTimeout(h),m.removeEventListener("abort",y)})}return c(d,Wf(Wf({},u),{},{signal:f.signal})).finally(()=>clearTimeout(h))}:this.fetch=c,this.retry=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 LB(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new eE(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,s={},{head:r=!1,get:a=!1,count:o}={}){var i;let l;const c=new URL(`${this.url}/rpc/${t}`);let d;const u=m=>m!==null&&typeof m=="object"&&(!Array.isArray(m)||m.some(u)),f=r&&Object.values(s).some(u);f?(l="POST",d=s):r||a?(l=r?"HEAD":"GET",Object.entries(s).filter(([m,y])=>y!==void 0).map(([m,y])=>[m,Array.isArray(y)?`{${y.join(",")}}`:`${y}`]).forEach(([m,y])=>{c.searchParams.append(m,y)})):(l="POST",d=s);const h=new Headers(this.headers);return f?h.set("Prefer",o?`count=${o},return=minimal`:"return=minimal"):o&&h.set("Prefer",`count=${o}`),new Qi({method:l,url:c,headers:h,schema:this.schemaName,body:d,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class UB{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const s=globalThis;if(typeof globalThis<"u"&&typeof s.WebSocket<"u")return{type:"native",wsConstructor:s.WebSocket};const r=typeof global<"u"?global:void 0;if(r&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};if(typeof globalThis<"u"&&typeof s.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"&&s.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 a=globalThis.process;if(a){const o=a.versions;if(o&&o.node){const i=o.node,l=parseInt(i.replace(/^v/,"").split(".")[0]);return l>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${l} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${l} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
451import ws from "ws"
452new 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.wsConstructor)return t.wsConstructor;let s=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(s+=`
453
454Suggested solution: ${t.workaround}`),new Error(s)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const zB="2.105.4",BB=`realtime-js/${zB}`,FB="1.0.0",tE="2.0.0",WB=tE,HB=1e4,GB=100,Sa={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},sE={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},v1={connecting:"connecting",closing:"closing",closed:"closed"};class VB{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,s){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return s(this._binaryEncodeUserBroadcastPush(t));let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return s(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(t){var s;return this._isArrayBuffer((s=t.payload)===null||s===void 0?void 0:s.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var s,r;const a=(r=(s=t.payload)===null||s===void 0?void 0:s.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,a)}_encodeJsonUserBroadcastPush(t){var s,r;const a=(r=(s=t.payload)===null||s===void 0?void 0:s.payload)!==null&&r!==void 0?r:{},i=new TextEncoder().encode(JSON.stringify(a)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,i)}_encodeUserBroadcastPush(t,s,r){var a,o;const i=t.topic,l=(a=t.ref)!==null&&a!==void 0?a:"",c=(o=t.join_ref)!==null&&o!==void 0?o:"",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(i.length>255)throw new Error(`topic length ${i.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 h=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+l.length+i.length+d.length+f.length,m=new ArrayBuffer(this.HEADER_LENGTH+h);let y=new DataView(m),b=0;y.setUint8(b++,this.KINDS.userBroadcastPush),y.setUint8(b++,c.length),y.setUint8(b++,l.length),y.setUint8(b++,i.length),y.setUint8(b++,d.length),y.setUint8(b++,f.length),y.setUint8(b++,s),Array.from(c,x=>y.setUint8(b++,x.charCodeAt(0))),Array.from(l,x=>y.setUint8(b++,x.charCodeAt(0))),Array.from(i,x=>y.setUint8(b++,x.charCodeAt(0))),Array.from(d,x=>y.setUint8(b++,x.charCodeAt(0))),Array.from(f,x=>y.setUint8(b++,x.charCodeAt(0)));var w=new Uint8Array(m.byteLength+r.byteLength);return w.set(new Uint8Array(m),0),w.set(new Uint8Array(r),m.byteLength),w.buffer}decode(t,s){if(this._isArrayBuffer(t)){let r=this._binaryDecode(t);return s(r)}if(typeof t=="string"){const r=JSON.parse(t),[a,o,i,l,c]=r;
454return s({join_ref:a,ref:o,topic:i,event:l,payload:c})}return s({})}_binaryDecode(t){const s=new DataView(t),r=s.getUint8(0),a=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,s,a)}}_decodeUserBroadcast(t,s,r){const a=s.getUint8(1),o=s.getUint8(2),i=s.getUint8(3),l=s.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+o));c=c+o;const f=r.decode(t.slice(c,c+i));c=c+i;const h=t.slice(c,t.byteLength),m=l===this.JSON_ENCODING?JSON.parse(r.decode(h)):h,y={type:this.BROADCAST_EVENT,event:u,payload:m};return i>0&&(y.meta=JSON.parse(f)),{join_ref:null,ref:null,topic:d,event:this.BROADCAST_EVENT,payload:y}}_isArrayBuffer(t){var s;return t instanceof ArrayBuffer||((s=t==null?void 0:t.constructor)===null||s===void 0?void 0:s.name)==="ArrayBuffer"}_pick(t,s){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([r])=>s.includes(r)))}}var pt;(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"})(pt||(pt={}));const zj=(e,t,s={})=>{var r;const a=(r=s.skipTypes)!==null&&r!==void 0?r:[];return t?Object.keys(t).reduce((o,i)=>(o[i]=KB(i,e,t,a),o),{}):{}},KB=(e,t,s,r)=>{const a=t.find(l=>
vendor: 5,523 bytes, line 454
454l.name===e),o=a==null?void 0:a.type,i=s[e];return o&&!r.includes(o)?nE(o,i):w1(i)},nE=(e,t)=>{if(e.charAt(0)==="_"){const s=e.slice(1,e.length);return QB(t,s)}switch(e){case pt.bool:return qB(t);case pt.float4:case pt.float8:case pt.int2:case pt.int4:case pt.int8:case pt.numeric:case pt.oid:return ZB(t);case pt.json:case pt.jsonb:return YB(t);case pt.timestamp:return JB(t);case pt.abstime:case pt.date:case pt.daterange:case pt.int4range:case pt.int8range:case pt.money:case pt.reltime:case pt.text:case pt.time:case pt.timestamptz:case pt.timetz:case pt.tsrange:case pt.tstzrange:return w1(t);default:return w1(t)}},w1=e=>e,qB=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},ZB=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},YB=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},QB=(e,t)=>{if(typeof e!="string")return e;const s=e.length-1,r=e[s];if(e[0]==="{"&&r==="}"){let o;const i=e.slice(1,s);try{o=JSON.parse("["+i+"]")}catch{o=i?i.split(","):[]}return o.map(l=>nE(t,l))}return e},JB=e=>typeof e=="string"?e.replace(" ","T"):e,rE=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};var Dd=e=>typeof e=="function"?e:function(){return e},XB=typeof self<"u"?self:null,Ji=typeof window<"u"?window:null,ar=XB||Ji||globalThis,eF="2.0.0",tF=1e4,sF=1e3,cr={connecting:0,open:1,closing:2,closed:3},As={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Rr={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},j1={longpoll:"longpoll",websocket:"websocket"},nF={complete:4},k1="base64url.bearer.phx.",Hf=class{constructor(e,t,s,r){this.channel=e,this.event=t,this.payload=s||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:s}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},aE=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},rF=class{constructor(e,t,s){this.state=As.closed,this.topic=e,this.params=Dd(t||{}),this.socket=s,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Hf(this,Rr.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new aE(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=As.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this.joinPush.receive("error",r=>{this.state=As.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=As.closed,this.socket.remove(this)}),this.onError(r=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.isJoining()&&this.joinPush.reset(),this.state=As.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new Hf(this,Rr.leave,Dd({}),this.timeout).send(),this.state=As.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Rr.reply,(r,a)=>{this.trigger(this.replyEventName(a),r)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}
vendor: 18,287 bytes, lines 454-455
454teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=As.closed,this.bindings=[]}onClose(e){this.on(Rr.close,e)}onError(e){return this.on(Rr.error,t=>e(t))}on(e,t){let s=this.bindingRef++;return this.bindings.push({event:e,ref:s,callback:t}),s}off(e,t){this.bindings=this.bindings.filter(s=>!(s.event===e&&(typeof t>"u"||t===s.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,s=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new Hf(this,e,function(){return t},s);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=As.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Rr.close,"leave")},s=new Hf(this,Rr.leave,Dd({}),e);return s.receive("ok",()=>t()).receive("timeout",()=>t()),s.send(),this.canPush()||s.trigger("ok",{}),s}onMessage(e,t,s){return t}filterBindings(e,t,s){return!0}isMember(e,t,s,r){return this.topic!==e?!1:r&&r!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:s,joinRef:r}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=As.joining,this.joinPush.resend(e))}trigger(e,t,s,r){let a=this.onMessage(e,t,s,r);if(t&&!a)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let o=this.bindings.filter(i=>i.event===e&&this.filterBindings(i,t,s));for(let i=0;i<o.length;i++)o[i].callback(a,s,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===As.closed}isErrored(){return this.state===As.errored}isJoined(){return this.state===As.joined}isJoining(){return this.state===As.joining}isLeaving(){return this.state===As.leaving}},_p=class{static request(e,t,s,r,a,o,i){if(ar.XDomainRequest){let l=new ar.XDomainRequest;return this.xdomainRequest(l,e,t,r,a,o,i)}else if(ar.XMLHttpRequest){let l=new ar.XMLHttpRequest;return this.xhrRequest(l,e,t,s,r,a,o,i)}else{if(ar.fetch&&ar.AbortController)return this.fetchRequest(e,t,s,r,a,o,i);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,s,r,a,o,i){let l={method:e,headers:s,body:r},c=null;return a&&(c=new AbortController,setTimeout(()=>c.abort(),a),l.signal=c.signal),ar.fetch(t,l).then(d=>d.text()).then(d=>this.parseJSON(d)).then(d=>i&&i(d)).catch(d=>{d.name==="AbortError"&&o?o():i&&i(null)}),c}static xdomainRequest(e,t,s,r,a,o,i){return e.timeout=a,e.open(t,s),e.onload=()=>{let l=this.parseJSON(e.responseText);i&&i(l)},o&&(e.ontimeout=o),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,s,r,a,o,i,l){e.open(t,s,!0),e.timeout=o;for(let[c,d]of Object.entries(r))e.setRequestHeader(c,d);return e.onerror=()=>l&&l(null),e.onreadystatechange=()=>{if(e.readyState===nF.complete&&l){let c=this.parseJSON(e.responseText);l(c)}},i&&(e.ontimeout=i),e.send(a),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let s=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let a=t?`${t}[${r}]`:r,o=e[r];typeof o=="object"?s.push(this.serialize(o,a)):s.push(encodeURIComponent(a)+"="+encodeURIComponent(o))}return s.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let s=e.match(/\?/)?"&":"?";return`${e}${s}${this.serialize(t)}`}},aF=e=>{let t="",s=new Uint8Array(e),r=s.byteLength;for(let a=0;a<r;a++)t+=String.fromCharCode(s[a]);return btoa(t)},Wi=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(k1)&&(this.authToken=atob(t[1].slice(k1.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=cr.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+j1.websocket),"$1/"+j1.longpoll)}endpointURL(){return _p.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,s){this.close(e,t,s),this.readyState=cr.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===cr.open||this.readyState===cr.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:s,token:r,messages:a}=t;if(s===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=r}else s=0;switch(s){case 200:a.forEach(o=>{setTimeout(()=>this.onmessage({data:o}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=cr.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${s}`)}})}send(e){typeof e!="string"&&(e=aF(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(`
455`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,s){for(let a of this.reqs)a.abort();this.readyState=cr.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(e,t,s,r,a){let o,i=()=>{this.reqs.delete(o),r()};o=_p.request(e,this.endpointURL(),t,s,this.timeout,i,l=>{this.reqs.delete(o),this.isActive()&&a(l)}),this.reqs.add(o)}},oF=class bd{constructor(t,s={}){let r=s.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,a=>{let{onJoin:o,onLeave:i,onSync:l}=this.caller;this.joinRef=this.channel.joinRef(),this.state=bd.syncState(this.state,a,o,i),this.pendingDiffs.forEach(c=>{this.state=bd.syncDiff(this.state,c,o,i)}),this.pendingDiffs=[],l()}),this.channel.on(r.diff,a=>{let{onJoin:o,onLeave:i,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(a):(this.state=bd.syncDiff(this.state,a,o,i),l())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return bd.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,s,r,a){let o=this.clone(t),i={},l={};return this.map(o,(c,d)=>{s[c]||(l[c]=d)}),this.map(s,(c,d)=>{let u=o[c];if(u){let f=d.metas.map(b=>b.phx_ref),h=u.metas.map(b=>b.phx_ref),m=d.metas.filter(b=>h.indexOf(b.phx_ref)<0),y=u.metas.filter(b=>f.indexOf(b.phx_ref)<0);m.length>0&&(i[c]=d,i[c].metas=m),y.length>0&&(l[c]=this.clone(u),l[c].metas=y)}else i[c]=d}),this.syncDiff(o,{joins:i,leaves:l},r,a)}static syncDiff(t,s,r,a){let{joins:o,leaves:i}=this.clone(s);return r||(r=function(){}),a||(a=function(){}),this.map(o,(l,c)=>{let d=t[l];if(t[l]=this.clone(c),d){let u=t[l].metas.map(h=>h.phx_ref),f=d.metas.filter(h=>u.indexOf(h.phx_ref)<0);t[l].metas.unshift(...f)}r(l,d,c)}),this.map(i,(l,c)=>{let d=t[l];if(!d)return;let u=c.metas.map(f=>f.phx_ref);d.metas=d.metas.filter(f=>u.indexOf(f.phx_ref)<0),a(l,d,c),d.metas.length===0&&delete t[l]}),t}static list(t,s){return s||(s=function(r,a){return a}),this.map(t,(r,a)=>s(r,a))}static map(t,s){return Object.getOwnPropertyNames(t).map(r=>s(r,t[r]))}static clone(t){return JSON.parse(JSON.stringify(t))}},Gf={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(s))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[s,r,a,o,i]=JSON.parse(e);return t({join_ref:s,ref:r,topic:a,event:o,payload:i})}},binaryEncode(e){let{join_ref:t,ref:s,event:r,topic:a,payload:o}=e,i=this.META_LENGTH+t.length+s.length+a.length+r.length,l=new ArrayBuffer(this.HEADER_LENGTH+i),c=new DataView(l),d=0;c.setUint8(d++,this.KINDS.push),c.setUint8(d++,t.length),c.setUint8(d++,s.length),c.setUint8(d++,a.length),c.setUint8(d++,r.length),Array.from(t,f=>c.setUint8(d++,f.charCodeAt(0))),Array.from(s,f=>c.setUint8(d++,f.charCodeAt(0))),Array.from(a,f=>c.setUint8(d++,f.charCodeAt(0))),Array.from(r,f=>c.setUint8(d++,f.charCodeAt(0)));var u=new Uint8Array(l.byteLength+o.byteLength);return u.set(new Uint8Array(l),0),u.set(new Uint8Array(o),l.byteLength),u.buffer},binaryDecode(e){let t=new DataView(e),s=t.getUint8(0),r=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,s){let r=t.getUint8(1),a=t.getUint8(2),o=t.getUint8(3),i=this.HEADER_LENGTH+this.META_LENGTH-1,l=s.decode(e.slice(i,i+r));i=i+r;let c=s.decode(e.slice(i,i+a));i=i+a;let d=s.decode(e.slice(i,i+o));i=i+o;let u=e.slice(i,e.byteLength);return{join_ref:l,ref:null,topic:c,event:d,payload:u}},decodeReply(e,t,s){let r=t.getUint8(1),a=t.getUint8(2),o=t.getUint8(3),i=t.getUint8(4),l=this.HEADER_LENGTH+this.META_LENGTH,c=s.decode(e.slice(l,l+r));l=l+r;let d=s.decode(e.slice(l,l+a));l=l+a;let u=s.decode(e.slice(l,l+o));l=l+o;let f=s.decode(e.slice(l,l+i));l=l+i;let h=e.slice(l,e.byteLength),m={status:f,response:h};return{join_ref:c,ref:d,topic:u,event:Rr.reply,payload:m}},decodeBroadcast(e,t,s){let r=t.getUint8(1),a=t.getUint8(2),o=this.HEADER_LENGTH+2,i=s.decode(e.slice(o,o+r));o=o+r;let l=s.decode(e.slice(o,o+a));o=o+a;let c=e.slice(o,e.byteLength);return{join_ref:null,ref:null,topic:i,event:l,payload:c}}},iF=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||tF,this.transport=t.transport||ar.WebSocket||Wi,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let s=null;try{s=ar&&ar.sessionStorage}catch{}this.sessionStore=t.sessionStorage||s,this.establishedConnections=0,this.defaultEncoder=Gf.encode.bind(Gf),this.defaultDecoder=Gf.decode.bind(Gf),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==Wi?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;Ji&&Ji.addEventListener&&(Ji.addEventListener("pagehide",a=>{this.conn&&(this.disconnect(),r=this.connectClock)}),Ji.addEventListener("pageshow",a=>{r===this.connectClock&&(r=null,this.connect())}),Ji.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=a=>t.rejoinAfterMs?t.rejoinAfterMs(a):[1e3,2e3,5e3][a-1]||1e4,this.reconnectAfterMs=a=>t.reconnectAfterMs?t.reconnectAfterMs(a):[10,50,100,150,200,250,500,1e3,2e3][a-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(a,o,i)=>{console.log(`${a}: ${o}`,i)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=Dd(t.params||{}),this.endPoint=`${e}/${j1.websocket}`,this.vsn=t.vsn||eF,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new aE(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return Wi}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=_p.appendParams(_p.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,s){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,s)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Dd(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Wi?this.connectWithFallback(Wi,this.longPollFallbackMs):this.transportConnect())}log(e,t,s){this.logger&&this.logger(e,t,s)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let r=this.onMessage(a=>{a.ref===t&&(this.off([r]),e(Date.now()-s))});return!0}transportName(e){switch(e){case Wi:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${k1}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let s=!1,r=!0,a,o,i=this.transportName(e),l=c=>{this.log("transport",`falling back to ${i}...`,c),this.off([a,o]),r=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${i}`))return l("memorized");this.fallbackTimer=setTimeout(l,t),o=this.onError(c=>{this.log("transport","error",c),r&&!s&&(clearTimeout(this.fallbackTimer),l(c))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(s=!0,!r){let c=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${c}`,"true"),this.log("transport",`established ${c} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(l,t),this.ping(c=>{this.log("transport","connected to primary after",c),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),sF,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,s){if(!this.conn)return e&&e();const r=this.conn;this.waitForBufferDone(r,()=>{t?r.close(t,s||""):r.close(),this.waitForSocketClosed(r,()=>{this.conn===r&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,s=1){if(s===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,s+1)},150*s)}waitForSocketClosed(e,t,s=1){if(s===5||e.readyState===cr.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,s+1)},150*s)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,s=this.establishedConnections;this.triggerStateCallbacks("error",e,t,s),(t===this.transport||s>0)&&this.triggerChanError(e)}
vendor: 4,126 bytes, line 455
455triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(Rr.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case cr.connecting:return"connecting";case cr.open:return"open";case cr.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([s])=>e.indexOf(s)===-1)}channel(e,t={}){let s=new rF(e,t,this);return this.channels.push(s),s}push(e){if(this.hasLogger()){let{topic:t,event:s,payload:r,ref:a,join_ref:o}=e;this.log("push",`${t} ${s} (${o}, ${a})`,r)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:s,event:r,payload:a,ref:o,join_ref:i}=t;if(o&&o===this.pendingHeartbeatRef){const l=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(a.status==="ok"?"ok":"error",l)}catch(c){this.log("error","error in heartbeat callback",c)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${a.status||""} ${s} ${r} ${o&&"("+o+")"||""}`.trim(),a);for(let l=0;l<this.channels.length;l++){const c=this.channels[l];c.isMember(s,r,a,i)&&c.trigger(r,a,o,i)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([s,r])=>{try{r(...t)}catch(a){this.log("error",`error in ${e} callback`,a)}})}catch(s){this.log("error",`error triggering ${e} callbacks`,s)}}leaveOpenTopic(e){let t=this.channels.find(s=>s.topic===e&&(s.isJoined()||s.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class Id{constructor(t,s){const r=cF(s);this.presence=new oF(t.getChannel(),r),this.presence.onJoin((a,o,i)=>{const l=Id.onJoinPayload(a,o,i);t.getChannel().trigger("presence",l)}),this.presence.onLeave((a,o,i)=>{const l=Id.onLeavePayload(a,o,i);t.getChannel().trigger("presence",l)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return Id.transformState(this.presence.state)}static transformState(t){return t=lF(t),Object.getOwnPropertyNames(t).reduce((s,r)=>{const a=t[r];return s[r]=Oh(a),s},{})}static onJoinPayload(t,s,r){const a=Bj(s),o=Oh(r);return{event:"join",key:t,currentPresences:a,newPresences:o}}static onLeavePayload(t,s,r){const a=Bj(s),o=Oh(r);return{event:"leave",key:t,currentPresences:a,leftPresences:o}}}function Oh(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function lF(e){return JSON.parse(JSON.stringify(e))}function cF(e){return(e==null?void 0:e.events)&&{events:e.events}}function Bj(e){return e!=null&&e.metas?Oh(e):[]}var Fj;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(Fj||(Fj={}));class dF{get state(){return this.presenceAdapter.state}constructor(t,s){this.channel=t,this.presenceAdapter=new Id(this.channel.channelAdapter,s)}}function uF(e){if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);
455if(e&&typeof e=="object"){const t=e;if(typeof t.code=="number"){const s=typeof t.reason=="string"&&t.reason?` (${t.reason})`:"";return new Error(`socket closed: ${t.code}${s}`,{cause:e})}return new Error("channel error: transport failure",{cause:e})}return new Error("channel error: connection lost")}class fF{constructor(t,s,r){const a=hF(r);this.channel=t.getSocket().channel(s,a),this.socket=t}get state(){return this.channel.state}set state(t){this.channel.state=t}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(t,s){return this.channel.on(t,s)}off(t,s){this.channel.off(t,s)}subscribe(t){return this.channel.join(t)}unsubscribe(t){return this.channel.leave(t)}teardown(){this.channel.teardown()}onClose(t){this.channel.onClose(t)}onError(t){return this.channel.onError(t)}push(t,s,r){let a;try{a=this.channel.push(t,s,r)}catch{throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>GB){const o=this.channel.pushBuffer.shift();o.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${o.event}`,o.payload())}return a}updateJoinPayload(t){const s=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},s),t)}canPush(){return this.socket.isConnected()&&this.state===Sa.joined}isJoined(){return this.state===Sa.joined}isJoining(){return this.state===Sa.joining}isClosed(){return this.state===Sa.closed}isLeaving(){return this.state===Sa.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function hF(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var Wj;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(Wj||(Wj={}));var pl;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(pl||(pl={}));var Ar;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Ar||(Ar={}));class Md{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(t,s={config:{}},r){var a,o;if(this.topic=t,this.params=s,this.socket=r,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},s.config),this.channelAdapter=new fF(this.socket.socketAdapter,t,this.params),this.presence=new dF(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=rE(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((o=(a=this.params.config)===null||a===void 0?void 0:a.broadcast)===null||o===void 0)&&o.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(t,s=this.timeout){var r,a,o;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:i,presence:l,private:c}}=this.params,d=(a=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(m=>m.filter))!==null&&a!==void 0?a:[],u=!!this.bindings[pl.PRESENCE]&&this.bindings[pl.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,f={},h={broadcast:i,presence:Object.assign(Object.assign({},l),{enabled:u}),postgres_changes:d,private:c};this.socket.accessTokenValue&&(f.access_token=this.socket.accessTokenValue),this._onError(m=>{t==null||t(Ar.CHANNEL_ERROR,uF(m))}),this._onClose(()=>t==null?void 0:t(Ar.CLOSED)),this.updateJoinPayload(Object.assign({config:h},f)),this._updateFilterMessage(),this.channelAdapter.subscribe(s).receive("ok",async({postgres_changes:m})=>
455{if(this.socket._isManualToken()||this.socket.setAuth(),m===void 0){t==null||t(Ar.SUBSCRIBED);return}this._updatePostgresBindings(m,t)}).receive("error",m=>{this.state=Sa.errored;const y=Object.values(m).join(", ")||"error";t==null||t(Ar.CHANNEL_ERROR,new Error(y,{cause:m}))}).receive("timeout",()=>{t==null||t(Ar.TIMED_OUT)})}return this}_updatePostgresBindings(t,s){var r;const a=this.bindings.postgres_changes,o=(r=a==null?void 0:a.length)!==null&&r!==void 0?r:0,i=[];for(let l=0;l<o;l++){const c=a[l],{filter:{event:d,schema:u,table:f,filter:h}}=c,m=t&&t[l];if(m&&m.event===d&&Md.isFilterValueEqual(m.schema,u)&&Md.isFilterValueEqual(m.table,f)&&Md.isFilterValueEqual(m.filter,h))i.push(Object.assign(Object.assign({},c),{id:m.id}));else{this.unsubscribe(),this.state=Sa.errored,s==null||s(Ar.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=i,this.state!=Sa.errored&&s&&s(Ar.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,s={}){return await this.send({type:"presence",event:"track",payload:t},s.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,s,r){const a=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),o=t===pl.PRESENCE||t===pl.POSTGRES_CHANGES;if(a&&o)throw this.socket.log("channel",`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(t,s,r)}async httpSend(t,s,r={}){var a;if(s==null)return Promise.reject(new Error("Payload is required for httpSend()"));const o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const i={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:s,private:this.private}]})},l=await this._fetchWithTimeout(this.broadcastEndpointURL,i,(a=r.timeout)!==null&&a!==void 0?a:this.timeout);if(l.status===202)return{success:!0};let c=l.statusText;try{const d=await l.json();c=d.error||d.message||c}catch{}return Promise.reject(new Error(c))}async send(t,s={}){var r,a;if(!this.channelAdapter.canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated 
455in the future. Please use httpSend() explicitly for REST delivery.");const{event:o,payload:i}=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:o,payload:i,private:this.private}]})};try{const d=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(r=s.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 instanceof Error&&d.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var i,l,c;const d=this.channelAdapter.push(t.type,t,s.timeout||this.timeout);t.type==="broadcast"&&!(!((c=(l=(i=this.params)===null||i===void 0?void 0:i.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&o("ok"),d.receive("ok",()=>o("ok")),d.receive("error",()=>o("error")),d.receive("timeout",()=>o("timed out"))})}updateJoinPayload(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(s=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>s("ok")).receive("timeout",()=>s("timed out")).receive("error",()=>s("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,s,r){const a=new AbortController,o=setTimeout(()=>a.abort(),r),i=await this.socket.fetch(t,Object.assign(Object.assign({},s),{signal:a.signal}));return clearTimeout(o),i}_on(t,s,r){const a=t.toLocaleLowerCase(),o=this.channelAdapter.on(t,r),i={type:a,filter:s,callback:r,ref:o};return this.bindings[a]?this.bindings[a].push(i):this.bindings[a]=[i],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,s,r)=>{var a,o,i,l,c,d,u;const f=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(f,r))return!1;const h=(a=this.bindings[f])===null||a===void 0?void 0:a.find(m=>m.ref===t.ref);if(!h)return!0;if(["broadcast","presence","postgres_changes"].includes(f))if("id"in h){const m=h.id,y=(o=h.filter)===null||o===void 0?void 0:o.event;return m&&((i=s.ids)===null||i===void 0?void 0:i.includes(m))&&(y==="*"||(y==null?void 0:y.toLocaleLowerCase())===((l=s.data)===null||l===void 0?void 0:l.type.toLocaleLowerCase()))}else{const m=(d=(c=h==null?void 0:h.filter)===null||c===void 0?void 0:c.event)===null||d===void 0?void 0:d.toLocaleLowerCase();return m==="*"||m===((u=s==null?void 0:s.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return h.type.toLocaleLowerCase()===f})}_notThisChannelEvent(t,s){const{close:r,error:a,leave:o,join:i}=sE;return s&&[r,a,o,i].includes(t)&&s!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,s,r)=>{if(typeof s=="object"&&"ids"in s){const a=s.data,{schema:o,table:i,commit_timestamp:l,type:c,errors:d}=a;return Object.assign(Object.assign({},{schema:o,table:i,commit_timestamp:l,eventType:c,new:{},old:{},errors:d}),this._getPayloadRecords(a))}return s})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const s in t.bindings)for(const r of t.bindings[s])this._on(r.type,r.filter,r.callback)}static isFilterValueEqual(t,s){return(t??void 0)===(s??void 0)}_getPayloadRecords(t){const s={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(s.new=zj(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(s.old=zj(t.columns,t.old_record)),s}}class pF{constructor(t,s){this.socket=new iF(t,s)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,s,r,a=1e4){return new Promise(o=>{setTimeout(()=>
455o("timeout"),a),this.socket.disconnect(()=>{t(),o("ok")},s,r)})}push(t){this.socket.push(t)}log(t,s,r){this.socket.log(t,s,r)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==v1.connecting}isDisconnecting(){return this.socket.connectionState()==v1.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const Hj={HEARTBEAT_INTERVAL:25e3},mF=[1e3,2e3,5e3,1e4],xF=1e4;function gF(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem(t){return e.has(t)?e.get(t):null},key(t){var s;return(s=Array.from(e.keys())[t])!==null&&s!==void 0?s:null},removeItem(t){e.delete(t)},setItem(t,s){e.set(t,String(s))}}}function bF(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return gF()}const yF=`
456  addEventListener("message", (e) => {
457    if (e.data.event === "start") {
458      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
459    }
460  });`;class vF{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(t,s){var r;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new VB,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=o=>o?(...i)=>o(...i):(...i)=>fetch(...i),!(!((r=s==null?void 0:s.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=s.params.apikey;const a=this._initializeOptions(s);this.socketAdapter=new pF(t,a),this.httpEndpoint=rE(t),this.fetch=this._resolveFetch(s==null?void 0:s.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(t){const s=t.message;throw s.includes("Node.js")?new Error(`${s}
461
462To use Realtime in Node.js, you need to provide a WebSocket implementation:
463
464Option 1: Use Node.js 22+ which has native WebSocket support
465Option 2: Install and provide the "ws" package:
466
467  npm install ws
468
469  import ws from "ws"
470  const client = new RealtimeClient(url, {
471    ...options,
472    transport: ws
473  })`):new Error(`WebSocket not available: ${s}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,s){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,s)}getChannels(){return this.channels}async removeChannel(t){const s=await t.unsubscribe();return s==="ok"&&t.teardown(),s}async removeAllChannels(){const t=this.channels.map(async r=>{const a=await r.unsubscribe();return r.teardown(),a}),s=await Promise.all(t);return await this.disconnect(),s}log(t,s,r){this.socketAdapter.log(t,s,r)}connectionState(){return this.socketAdapter.connectionState()||v1.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,s={config:{}}){const r=`realtime:${t}`,a=this.getChannels().find(o=>o.topic===r);if(a)return a;{const o=new Md(`realtime:${t}`,s,this);return this._cancelPendingDisconnect(),this.channels.push(o),o}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(s=>s.topic!==t.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}
473this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(t=null){let s,r=!1;if(t)s=t,r=!0;else if(this.accessToken)try{s=await this.accessToken()}catch(a){this.log("error","Error fetching access token from callback",a),s=this.accessTokenValue}else s=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=s&&(this.accessTokenValue=s,this.channels.forEach(a=>{const o={access_token:s,version:BB};s&&a.updateJoinPayload(o),a.joinedOnce&&a.channelAdapter.isJoined()&&a.channelAdapter.push(sE.access_token,{access_token:s})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(s=>{this.log("error",`Error setting auth in ${t}`,s)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(s=>{this.log("error","error waiting for auth on connect",s)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(t=>{t.ref&&t.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(t){return(s,r)=>{s=="sent"&&this._setAuthSafely(),t&&t(s,r)}}_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=s=>{this.log("worker","worker error",s.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=s=>{s.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(t){let s;if(t)s=t;else{const r=new Blob([yF],{type:"application/javascript"});s=URL.createObjectURL(r)}return s}_initializeOptions(t){var s,r,a,o,i,l,c,d,u,f,h,m;this.worker=(s=t==null?void 0:t.worker)!==null&&s!==void 0?s:!1,this.accessToken=(r=t==null?void 0:t.accessToken)!==null&&r!==void 0?r:null;const y={};y.timeout=(a=t==null?void 0:t.timeout)!==null&&a!==void 0?a:HB,y.heartbeatIntervalMs=(o=t==null?void 0:t.heartbeatIntervalMs)!==null&&o!==void 0?o:Hj.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(i=t==null?void 0:t.disconnectOnEmptyChannelsAfterMs)!==null&&i!==void 0?i:2*((l=t==null?void 0:t.heartbeatIntervalMs)!==null&&l!==void 0?l:Hj.HEARTBEAT_INTERVAL),y.transport=(c=t==null?void 0:t.transport)!==null&&c!==void 0?c:UB.getWebSocketConstructor(),y.params=t==null?void 0:t.params,y.logger=t==null?void 0:t.logger,y.heartbeatCallback=this._wrapHeartbeatCallback(t==null?void 0:t.heartbeatCallback),y.sessionStorage=(d=t==null?void 0:t.sessionStorage)!==null&&d!==void 0?d:bF(),y.reconnectAfterMs=(u=t==null?void 0:t.reconnectAfterMs)!==null&&u!==void 0?u:g=>mF[g-1]||xF;let b,w;const x=(f=t==null?void 0:t.vsn)!==null&&f!==void 0?f:WB;switch(x){case FB:b=(g,v)=>v(JSON.stringify(g)),w=(g,v)=>v(JSON.parse(g));break;case tE:b=this.serializer.encode.bind(this.serializer),w=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${y.vsn}`)}if(y.vsn=x,y.encode=(h=t==null?void 0:t.encode)!==null&&h!==void 0?h:b,y.decode=(m=t==null?void 0:t.decode)!==null&&m!==void 0?m:w,y.beforeReconnect=this._reconnectAuth.bind(this),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,y.params=Object.assign(Object.assign({},y.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl,y.autoSendHeartbeat=!this.worker}return y}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}
473var xu=class extends Error{constructor(e,t){var s;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)&&((s=t.icebergType)==null?void 0:s.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function wF(e,t,s){const r=new URL(t,e);if(s)for(const[a,o]of Object.entries(s))o!==void 0&&r.searchParams.set(a,o);return r.toString()}async function jF(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 kF(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:s,path:r,query:a,body:o,headers:i}){const l=wF(e.baseUrl,r,a),c=await jF(e.auth),d=await t(l,{method:s,headers:{...o?{"Content-Type":"application/json"}:{},...c,...i},body:o?JSON.stringify(o):void 0}),u=await d.text(),f=(d.headers.get("content-type")||"").includes("application/json"),h=f&&u?JSON.parse(u):u;if(!d.ok){const m=f?h:void 0,y=m==null?void 0:m.error;throw new xu((y==null?void 0:y.message)??`Request failed with status ${d.status}`,{status:d.status,icebergType:y==null?void 0:y.type,icebergCode:y==null?void 0:y.code,details:m})}return{status:d.status,headers:d.headers,data:h}}}}function Vf(e){return e.join("�")}var SF=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:Vf(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 s={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Vf(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Vf(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Vf(e.namespace)}`}),!0}catch(t){if(t instanceof xu&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(s){if(s instanceof xu&&s.status===409)return;throw s}}};function Hi(e){return e.join("�")}var NF=class{constructor(e,t="",s){this.client=e,this.prefix=t,this.accessDelegation=s}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 s={};return this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Hi(e.namespace)}/tables`,body:t,headers:s})).data.metadata}async updateTable(e,t){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Hi(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":s.data["metadata-location"],metadata:s.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(s){if(s instanceof xu&&s.status===404)return!1;throw s}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(s){if(s instanceof xu&&s.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw s}}},CF=class{constructor(e){var r;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const s=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=kF({baseUrl:s,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(r=e.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new SF(this.client,t),this.tableOps=new NF(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)}
473async 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)}};function gu(e){"@babel/helpers - typeof";return gu=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},gu(e)}function _F(e,t){if(gu(e)!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var r=s.call(e,t);if(gu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function TF(e){var t=_F(e,"string");return gu(t)=="symbol"?t:t+""}function EF(e,t,s){return(t=TF(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function Gj(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),s.push.apply(s,r)}return s}function Re(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?Gj(Object(s),!0).forEach(function(r){EF(e,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Gj(Object(s)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(s,r))})}return e}var Om=class extends Error{constructor(e,t="storage",s,r){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=s,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function Lm(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var S1=class extends Om{constructor(e,t,s,r="storage"){super(e,r,t,s),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=s}toJSON(){return Re({},super.toJSON())}},oE=class extends Om{constructor(e,t,s="storage"){super(e,s),this.name=s==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function Tp(e,t,s){const r=Re({},e),a=t.toLowerCase();for(const o of Object.keys(r))o.toLowerCase()===a&&delete r[o];return r[a]=s,r}function RF(e){const t={};for(const[s,r]of Object.entries(e))t[s.toLowerCase()]=r;return t}const AF=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),PF=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)},N1=e=>{if(Array.isArray(e))return e.map(s=>N1(s));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([s,r])=>{const a=s.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));t[a]=N1(r)}),t},OF=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),Vj=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error;if(typeof t.error=="object"&&t.error!==null){const s=t.error;if(typeof s.message=="string")return s.message}}return JSON.stringify(e)},LF=async(e,t,s,r)=>{if(e!==null&&typeof e=="object"&&"json"in e&&typeof e.json=="function"){const a=e;let o=parseInt(String(a.status),10);Number.isFinite(o)||(o=500),a.json().then(i=>{const l=(i==null?void 0:i.statusCode)||(i==null?void 0:i.code)||o+"";t(new S1(Vj(i),o,l,r))}).catch(()=>{const i=o+"";t(new S1(a.statusText||`HTTP ${o} error`,o,i,r))})}else t(new oE(Vj(e),e,r))},DF=(e,t,s,r)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!r)return Re(Re({},a),s);if(PF(r)){var o;const i=(t==null?void 0:t.headers)||{};let l;for(const[c,d]of Object.entries(i))c.toLowerCase()==="content-type"&&(l=d);a.headers=Tp(i,"Content-Type",(o=l)!==null&&o!==void 0?o:"application/json"),a.body=JSON.stringify(r)}else a.body=r;return t!=null&&t.duplex&&(a.duplex=t.duplex),Re(Re({},a),s)};async function ad(e,t,s,r,a,o,i){return new Promise((l,c)=>{e(s,DF(t,r,a,o)).then(d=>{if(!d.ok)throw d;if(r!=null&&r.noResolveJson)return d;if(i==="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=>LF(d,c,r,i))})}function iE(e="storage"){return{get:async(t,s,r,a)=>ad(t,"GET",s,r,a,void 0,e),post:async(t,s,r,a,o)=>ad(t,"POST",s,a,o,r,e),put:async(t,s,r,a,o)=>ad(t,"PUT",s,a,o,r,e),head:async(t,s,r,a)=>ad(t,"HEAD",s,Re(Re({},r),{},{noResolveJson:!0}),a,void 0,e),remove:async(t,s,r,a,o)=>ad(t,"DELETE",s,a,o,r,e)}}const IF=iE("storage"),{get:bu,post:Mn,put:C1,head:MF,remove:sv}=IF,Qs=iE("vectors");var Pc=class{constructor(e,t={},s,r="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=RF(t),this.fetch=AF(s),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Tp(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(s){if(t.shouldThrowOnError)throw s;if(Lm(s))return{data:null,error:s};throw s}}},$F=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(Lm(t))return{data:null,error:t};throw t}}};let lE;lE=Symbol.toStringTag;var UF=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[lE]="BlobDownloadBuilder",this.promise=null}asStream(){return new $F(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(Lm(t))return{data:null,error:t};throw t}}};const zF={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Kj={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var BF=class extends Pc{constructor(e,t={},s,r){super(e,t,r,"storage"),this.bucketId=s}async uploadOrUpdate(e,t,s,r){var a=this;return a.handleOperation(async()=>{let o;const i=Re(Re({},Kj),r);let l=Re(Re({},a.headers),e==="POST"&&{"x-upsert":String(i.upsert)});const c=i.metadata;if(typeof Blob<"u"&&s instanceof Blob?(o=new FormData,o.append("cacheControl",i.cacheControl),c&&o.append("metadata",a.encodeMetadata(c)),o.append("",s)):typeof FormData<"u"&&s instanceof FormData?(o=s,o.has("cacheControl")||o.append("cacheControl",i.cacheControl),c&&!o.has("metadata")&&o.append("metadata",a.encodeMetadata(c))):(o=s,l["cache-control"]=`max-age=${i.cacheControl}`,l["content-type"]=i.contentType,c&&(l["x-metadata"]=a.toBase64(a.encodeMetadata(c))),(typeof ReadableStream<"u"&&o instanceof ReadableStream||o&&typeof o=="object"&&"pipe"in o&&typeof o.pipe=="function")&&!i.duplex&&(i.duplex="half")),r!=null&&r.headers)for(const[h,m]of Object.entries(r.headers))l=Tp(l,h,m);const d=a._removeEmptyFolders(t),u=a._getFinalPath(d),f=await(e=="PUT"?C1:Mn)(a.fetch,`${a.url}/object/${u}`,o,Re({headers:l},i!=null&&i.duplex?{duplex:i.duplex}:{}));return{path:d,id:f.Id,fullPath:f.Key}})}async upload(e,t,s){return this.uploadOrUpdate("POST",e,t,s)}async uploadToSignedUrl(e,t,s,r){var a=this;const o=a._removeEmptyFolders(e),i=a._getFinalPath(o),l=new URL(a.url+`/object/upload/sign/${i}`);return l.searchParams.set("token",t),a.handleOperation(async()=>{let c;const d=Re(Re({},Kj),r);let u=Re(Re({},a.headers),{"x-upsert":String(d.upsert)});const f=d.metadata;if(typeof Blob<"u"&&s instanceof Blob?(c=new FormData,c.append("cacheControl",d.cacheControl),f&&c.append("metadata",a.encodeMetadata(f)),c.append("",s)):typeof FormData<"u"&&s instanceof FormData?(c=s,c.has("cacheControl")||c.append("cacheControl",d.cacheControl),f&&!c.has("metadata")&&c.append("metadata",a.encodeMetadata(f))):(c=s,u["cache-control"]=`max-age=${d.cacheControl}`,u["content-type"]=d.contentType,f&&(u["x-metadata"]=a.toBase64(a.encodeMetadata(f))),(typeof ReadableStream<"u"&&c instanceof ReadableStream||c&&typeof c=="object"&&"pipe"in c&&typeof c.pipe=="function")&&!d.duplex&&(d.duplex="half")),r!=null&&r.headers)for(const[h,m]of Object.entries(r.headers))u=Tp(u,h,m);return{path:o,fullPath:(await C1(a.fetch,l.toString(),c,Re({headers:u},d!=null&&d.duplex?{duplex:d.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var s=this;return s.handleOperation(async()=>{let r=s._getFinalPath(e);const a=Re({},s.headers);t!=null&&t.upsert&&(a["x-upsert"]="true");const o=await Mn(s.fetch,`${s.url}/object/upload/sign/${r}`,{},{headers:a}),i=new URL(s.url+o.url),l=i.searchParams.get("token");if(!l)throw new Om("No token returned by API");return{signedUrl:i.toString(),path:e,token:l}})}
473async update(e,t,s){return this.uploadOrUpdate("PUT",e,t,s)}async move(e,t,s){var r=this;return r.handleOperation(async()=>await Mn(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:s==null?void 0:s.destinationBucket},{headers:r.headers}))}async copy(e,t,s){var r=this;return r.handleOperation(async()=>({path:(await Mn(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:s==null?void 0:s.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(e,t,s){var r=this;return r.handleOperation(async()=>{let a=r._getFinalPath(e);const o=typeof(s==null?void 0:s.transform)=="object"&&s.transform!==null&&Object.keys(s.transform).length>0;let i=await Mn(r.fetch,`${r.url}/object/sign/${a}`,Re({expiresIn:t},o?{transform:s.transform}:{}),{headers:r.headers});const l=new URLSearchParams;s!=null&&s.download&&l.set("download",s.download===!0?"":s.download),(s==null?void 0:s.cacheNonce)!=null&&l.set("cacheNonce",String(s.cacheNonce));const c=l.toString();return{signedUrl:encodeURI(`${r.url}${i.signedURL}${c?`&${c}`:""}`)}})}async createSignedUrls(e,t,s){var r=this;return r.handleOperation(async()=>{const a=await Mn(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:e},{headers:r.headers}),o=new URLSearchParams;s!=null&&s.download&&o.set("download",s.download===!0?"":s.download),(s==null?void 0:s.cacheNonce)!=null&&o.set("cacheNonce",String(s.cacheNonce));const i=o.toString();return a.map(l=>Re(Re({},l),{},{signedUrl:l.signedURL?encodeURI(`${r.url}${l.signedURL}${i?`&${i}`:""}`):null}))})}download(e,t,s){const r=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",a=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(a,t.transform),(t==null?void 0:t.cacheNonce)!=null&&a.set("cacheNonce",String(t.cacheNonce));const o=a.toString(),i=this._getFinalPath(e),l=()=>bu(this.fetch,`${this.url}/${r}/${i}${o?`?${o}`:""}`,{headers:this.headers,noResolveJson:!0},s);return new UF(l,this.shouldThrowOnError)}async info(e){var t=this;const s=t._getFinalPath(e);return t.handleOperation(async()=>N1(await bu(t.fetch,`${t.url}/object/info/${s}`,{headers:t.headers})))}async exists(e){var t=this;const s=t._getFinalPath(e);try{return await MF(t.fetch,`${t.url}/object/${s}`,{headers:t.headers}),{data:!0,error:null}}catch(a){if(t.shouldThrowOnError)throw a;if(Lm(a)){var r;const o=a instanceof S1?a.status:a instanceof oE?(r=a.originalError)===null||r===void 0?void 0:r.status:void 0;if(o!==void 0&&[400,404].includes(o))return{data:!1,error:a}}throw a}}getPublicUrl(e,t){const s=this._getFinalPath(e),r=new URLSearchParams;t!=null&&t.download&&r.set("download",t.download===!0?"":t.download),t!=null&&t.transform&&this.applyTransformOptsToQuery(r,t.transform),(t==null?void 0:t.cacheNonce)!=null&&r.set("cacheNonce",String(t.cacheNonce));const a=r.toString(),o=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${o}/public/${s}`)+(a?`?${a}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await sv(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,s){var r=this;return r.handleOperation(async()=>{const a=Re(Re(Re({},zF),t),{},{prefix:e||""});return await Mn(r.fetch,`${r.url}/object/list/${r.bucketId}`,a,{headers:r.headers},s)})}async listV2(e,t){var s=this;return s.handleOperation(async()=>{const r=Re({},e);return await Mn(s.fetch,`${s.url}/object/list-v2/${s.bucketId}`,r,{headers:s.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,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("qual
473ity",t.quality.toString()),e}};const FF="2.105.4",Xu={"X-Client-Info":`storage-js/${FF}`};var WF=class extends Pc{constructor(e,t={},s,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 o=a.href.replace(/\/$/,""),i=Re(Re({},Xu),t);super(o,i,s,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const s=t.listBucketOptionsToQueryString(e);return await bu(t.fetch,`${t.url}/bucket${s}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await bu(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var s=this;return s.handleOperation(async()=>await Mn(s.fetch,`${s.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:s.headers}))}async updateBucket(e,t){var s=this;return s.handleOperation(async()=>await C1(s.fetch,`${s.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:s.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await Mn(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await sv(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():""}},HF=class extends Pc{constructor(e,t={},s){const r=e.replace(/\/$/,""),a=Re(Re({},Xu),t);super(r,a,s,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Mn(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const s=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&s.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&s.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&s.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&s.set("sortOrder",e.sortOrder),e!=null&&e.search&&s.set("search",e.search);const r=s.toString(),a=r?`${t.url}/bucket?${r}`:`${t.url}/bucket`;return await bu(t.fetch,a,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await sv(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!OF(e))throw new Om("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 s=new CF({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(s,{get(a,o){const i=a[o];return typeof i!="function"?i:async(...l)=>{try{return{data:await i.apply(a,l),error:null}}catch(c){if(r)throw c;return{data:null,error:c}}}}})}},GF=class extends Pc{constructor(e,t={},s){const r=e.replace(/\/$/,""),a=Re(Re({},Xu),{},{"Content-Type":"application/json"},t);super(r,a,s,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await Qs.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var s=this;return s.handleOperation(async()=>await Qs.post(s.fetch,`${s.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:s.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await Qs.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var s=this;return s.handleOperation(async()=>await Qs.post(s.fetch,`${s.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:s.headers})||{})}},VF=class extends Pc{constructor(e,t={},s){const r=e.replace(/\/$/,""),a=Re(Re({},Xu),{},{"Content-Type":"application/json"},t);super(r,a,s,"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 Qs.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await Qs.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");
473if(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 Qs.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await Qs.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 Qs.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},KF=class extends Pc{constructor(e,t={},s){const r=e.replace(/\/$/,""),a=Re(Re({},Xu),{},{"Content-Type":"application/json"},t);super(r,a,s,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Qs.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Qs.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await Qs.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Qs.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},qF=class extends KF{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new ZF(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,s=this;return t().call(s,e)}async getBucket(e){var t=()=>super.getBucket,s=this;return t().call(s,e)}async listBuckets(e={}){var t=()=>super.listBuckets,s=this;return t().call(s,e)}async deleteBucket(e){var t=()=>super.deleteBucket,s=this;return t().call(s,e)}},ZF=class extends GF{constructor(e,t,s,r){super(e,t,r),this.vectorBucketName=s}async createIndex(e){var t=()=>super.createIndex,s=this;return t().call(s,Re(Re({},e),{},{vectorBucketName:s.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,s=this;return t().call(s,Re(Re({},e),{},{vectorBucketName:s.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,s=this;return t().call(s,s.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,s=this;return t().call(s,s.vectorBucketName,e)}index(e){return new YF(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},YF=class extends VF{constructor(e,t,s,r,a){super(e,t,a),this.vectorBucketName=s,this.indexName=r}async putVectors(e){var t=()=>super.putVectors,s=this;return t().call(s,Re(Re({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async getVectors(e){var t=()=>super.getVectors,s=this;return t().call(s,Re(Re({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,s=this;return t().call(s,Re(Re({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,s=this;return t().call(s,Re(Re({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,s=this;return t().call(s,Re(Re({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}},QF=class extends WF{constructor(e,t={},s,r){super(e,t,s,r)}from(e){return new BF(this.url,this.headers,e,this.fetch)}get vectors(){return new qF(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new HF(this.url+"/iceberg",this.headers,this.fetch)}};const cE="2.105.4",Xi=30*1e3,_1=3,Yx=_1*Xi,JF="http://localhost:9999",XF="supabase.auth.token",eW={"X-Client-Info":`gotrue-js/${cE}`},T1="X-Supabase-Api-Version",dE={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},tW=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,sW=10*60*1e3;class yu extends Error{constructor(t,s,r){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=s,this.code=r}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function ce(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class nW extends yu{constructor(t,s,r){super(t,s,r),this.name="AuthApiError",this.status=s,this.code=r}}function rW(e){return ce(e)&&e.name==="AuthApiError"}
473class Fn extends yu{constructor(t,s){super(t),this.name="AuthUnknownError",this.originalError=s}}class oa extends yu{constructor(t,s,r,a){super(t,r,a),this.name=s,this.status=r}}class es extends oa{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Kf(e){return ce(e)&&e.name==="AuthSessionMissingError"}class Gi extends oa{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class qf extends oa{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class Zf extends oa{constructor(t,s=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function aW(e){return ce(e)&&e.name==="AuthImplicitGrantRedirectError"}class qj extends oa{constructor(t,s=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class oW extends oa{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 E1 extends oa{constructor(t,s){super(t,"AuthRetryableFetchError",s,void 0)}}function Qx(e){return ce(e)&&e.name==="AuthRetryableFetchError"}class Zj extends oa{constructor(t,s,r){super(t,"AuthWeakPasswordError",s,"weak_password"),this.reasons=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class R1 extends oa{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Ep="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Yj=` 	
474\r=`.split(""),iW=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<Yj.length;t+=1)e[Yj[t].charCodeAt(0)]=-2;for(let t=0;t<Ep.length;t+=1)e[Ep[t].charCodeAt(0)]=t;return e})();function Qj(e,t,s){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;s(Ep[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;s(Ep[r]),t.queuedBits-=6}}function uE(e,t,s){const r=iW[e];if(r>-1)for(t.queue=t.queue<<6|r,t.queuedBits+=6;t.queuedBits>=8;)s(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 Jj(e){const t=[],s=i=>{t.push(String.fromCodePoint(i))},r={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},o=i=>{dW(i,r,s)};for(let i=0;i<e.length;i+=1)uE(e.charCodeAt(i),a,o);return t.join("")}function lW(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 cW(e,t){for(let s=0;s<e.length;s+=1){let r=e.charCodeAt(s);if(r>55295&&r<=56319){const a=(r-55296)*1024&65535;r=(e.charCodeAt(s+1)-56320&65535|a)+65536,s+=1}lW(r,t)}}
474function dW(e,t,s){if(t.utf8seq===0){if(e<=127){s(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&&s(t.codepoint)}}function Cl(e){const t=[],s={queue:0,queuedBits:0},r=a=>{t.push(a)};for(let a=0;a<e.length;a+=1)uE(e.charCodeAt(a),s,r);return new Uint8Array(t)}function uW(e){const t=[];return cW(e,s=>t.push(s)),new Uint8Array(t)}function Ho(e){const t=[],s={queue:0,queuedBits:0},r=a=>{t.push(a)};return e.forEach(a=>Qj(a,s,r)),Qj(null,s,r),t.join("")}function fW(e){return Math.round(Date.now()/1e3)+e}function hW(){return Symbol("auth-callback")}const is=()=>typeof window<"u"&&typeof document<"u",Ro={tested:!1,writable:!1},fE=()=>{if(!is())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Ro.tested)return Ro.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Ro.tested=!0,Ro.writable=!0}catch{Ro.tested=!0,Ro.writable=!1}return Ro.writable};function pW(e){const t={},s=new URL(e);if(s.hash&&s.hash[0]==="#")try{new URLSearchParams(s.hash.substring(1)).forEach((a,o)=>{t[o]=a})}catch{}return s.searchParams.forEach((r,a)=>{t[a]=r}),t}const hE=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),mW=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",el=async(e,t,s)=>{await e.setItem(t,JSON.stringify(s))},Ao=async(e,t)=>{const s=await e.getItem(t);if(!s)return null;try{return JSON.parse(s)}catch{return null}},os=async(e,t)=>{await e.removeItem(t)};class Dm{constructor(){this.promise=new Dm.promiseConstructor((t,s)=>{this.resolve=t,this.reject=s})}}Dm.promiseConstructor=Promise;function Yf(e){const t=e.split(".");if(t.length!==3)throw new R1("Invalid JWT structure");for(let r=0;r<t.length;r++)if(!tW.test(t[r]))throw new R1("JWT not in base64url format");return{header:JSON.parse(Jj(t[0])),payload:JSON.parse(Jj(t[1])),signature:Cl(t[2]),raw:{header:t[0],payload:t[1]}}}async function xW(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function gW(e,t){return new Promise((r,a)=>{(async()=>{for(let o=0;o<1/0;o++)try{const i=await e(o);if(!t(o,null,i)){r(i);return}}catch(i){if(!t(o,i)){a(i);return}}})()})}function bW(e){return("0"+e.toString(16)).substr(-2)}function yW(){const t=new Uint32Array(56);if(typeof crypto>"u"){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=s.length;let a="";for(let o=0;o<56;o++)a+=s.charAt(Math.floor(Math.random()*r));return a}return crypto.getRandomValues(t),Array.from(t,bW).join("")}async function vW(e){const s=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",s),a=new Uint8Array(r);return Array.from(a).map(o=>String.fromCharCode(o)).join("")}async function wW(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 s=await vW(e);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Vi(e,t,s=!1){const r=yW();let a=r;s&&(a+="/recovery"),await el(e,`${t}-code-verifier`,a);const o=await wW(r);return[o,r===o?"plain":"s256"]}const jW=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function kW(e){const t=e.headers.get(T1);if(!t||!t.match(jW))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function SW(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 NW(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 CW=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function kr(e){if(!CW.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Dn(e){if(!e.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function Jx(){const e={};return new Proxy(e,{get:(t,s)=>{if(s==="__isUserNotAvailableProxy")return!0;
474if(typeof s=="symbol"){const r=s.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 "${s}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function _W(e,t){return new Proxy(e,{get:(s,r,a)=>{if(r==="__isInsecureUserWarningProxy")return!0;if(typeof r=="symbol"){const o=r.toString();if(o==="Symbol(Symbol.toPrimitive)"||o==="Symbol(Symbol.toStringTag)"||o==="Symbol(util.inspect.custom)"||o==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(s,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(s,r,a)}})}function Xj(e){return JSON.parse(JSON.stringify(e))}const Mo=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error}return JSON.stringify(e)},TW=[502,503,504,520,521,522,523,524,530];async function ek(e){var t;if(!mW(e))throw new E1(Mo(e),0);if(TW.includes(e.status))throw new E1(Mo(e),e.status);let s;try{s=await e.json()}catch(o){throw new Fn(Mo(o),o)}let r;const a=kW(e);if(a&&a.getTime()>=dE["2024-01-01"].timestamp&&typeof s=="object"&&s&&typeof s.code=="string"?r=s.code:typeof s=="object"&&s&&typeof s.error_code=="string"&&(r=s.error_code),r){if(r==="weak_password")throw new Zj(Mo(s),e.status,((t=s.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(r==="session_not_found")throw new es}else if(typeof s=="object"&&s&&typeof s.weak_password=="object"&&s.weak_password&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.reasons.reduce((o,i)=>o&&typeof i=="string",!0))throw new Zj(Mo(s),e.status,s.weak_password.reasons);throw new nW(Mo(s),e.status||500,r)}const EW=(e,t,s,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),s))};async function ge(e,t,s,r){var a;const o=Object.assign({},r==null?void 0:r.headers);o[T1]||(o[T1]=dE["2024-01-01"].name),r!=null&&r.jwt&&(o.Authorization=`Bearer ${r.jwt}`);const i=(a=r==null?void 0:r.query)!==null&&a!==void 0?a:{};r!=null&&r.redirectTo&&(i.redirect_to=r.redirectTo);const l=Object.keys(i).length?"?"+new URLSearchParams(i).toString():"",c=await RW(e,t,s+l,{headers:o,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 RW(e,t,s,r,a,o){const i=EW(t,r,a,o);let l;try{l=await e(s,Object.assign({},i))}catch(c){throw console.error(c),new E1(Mo(c),0)}if(l.ok||await ek(l),r!=null&&r.noResolveJson)return l;try{return await l.json()}catch(c){await ek(c)}}function pn(e){var t;let s=null;OW(e)&&(s=Object.assign({},e),e.expires_at||(s.expires_at=fW(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:s,user:r},error:null}}function tk(e){const t=pn(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((s,r)=>s&&typeof r=="string",!0)&&(t.data.weak_password=e.weak_password),t}function Na(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function AW(e){return{data:e,error:null}}function PW(e){const{action_link:t,email_otp:s,hashed_token:r,redirect_to:a,verification_type:o}=e,i=Pm(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:t,email_otp:s,hashed_token:r,redirect_to:a,verification_type:o},c=Object.assign({},i);return{data:{properties:l,user:c},error:null}}function sk(e){return e}function OW(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const Xx=["global","local","others"];class LW{constructor({url:t="",headers:s={},fetch:r,experimental:a}){this.url=t,this.headers=s,this.fetch=hE(r),this.experimental=a??{},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)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}
vendor: 4,780 bytes, line 474
474async signOut(t,s=Xx[0]){if(Xx.indexOf(s)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Xx.join(", ")}`);try{return await ge(this.fetch,"POST",`${this.url}/logout?scope=${s}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(r){if(ce(r))return{data:null,error:r};throw r}}async inviteUserByEmail(t,s={}){try{return await ge(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:s.data},headers:this.headers,redirectTo:s.redirectTo,xform:Na})}catch(r){if(ce(r))return{data:{user:null},error:r};throw r}}async generateLink(t){try{const{options:s}=t,r=Pm(t,["options"]),a=Object.assign(Object.assign({},r),s);return"newEmail"in r&&(a.new_email=r==null?void 0:r.newEmail,delete a.newEmail),await ge(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:PW,redirectTo:s==null?void 0:s.redirectTo})}catch(s){if(ce(s))return{data:{properties:null,user:null},error:s};throw s}}async createUser(t){try{return await ge(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Na})}catch(s){if(ce(s))return{data:{user:null},error:s};throw s}}async listUsers(t){var s,r,a,o,i,l,c;try{const d={nextPage:null,lastPage:0,total:0},u=await ge(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(s=t==null?void 0:t.page)===null||s===void 0?void 0:s.toString())!==null&&r!==void 0?r:"",per_page:(o=(a=t==null?void 0:t.perPage)===null||a===void 0?void 0:a.toString())!==null&&o!==void 0?o:""},xform:sk});if(u.error)throw u.error;const f=await u.json(),h=(i=u.headers.get("x-total-count"))!==null&&i!==void 0?i:0,m=(c=(l=u.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return m.length>0&&(m.forEach(y=>{const b=parseInt(y.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(y.split(";")[1].split("=")[1]);d[`${w}Page`]=b}),d.total=parseInt(h)),{data:Object.assign(Object.assign({},f),d),error:null}}catch(d){if(ce(d))return{data:{users:[]},error:d};throw d}}async getUserById(t){kr(t);try{return await ge(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Na})}catch(s){if(ce(s))return{data:{user:null},error:s};throw s}}async updateUserById(t,s){kr(t);try{return await ge(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:s,headers:this.headers,xform:Na})}catch(r){if(ce(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,s=!1){kr(t);try{return await ge(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:s},xform:Na})}catch(r){if(ce(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){kr(t.userId);try{const{data:s,error:r}=await ge(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:a=>({data:{factors:a},error:null})});return{data:s,error:r}}catch(s){if(ce(s))return{data:null,error:s};throw s}}async _deleteFactor(t){kr(t.userId),kr(t.id);try{return{data:await ge(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(s){if(ce(s))return{data:null,error:s};throw s}}async _listOAuthClients(t){var s,r,a,o,i,l,c;try{const d={nextPage:null,lastPage:0,total:0},u=await ge(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(s=t==null?void 0:t.page)===null||s===void 0?void 0:s.toString())!==null&&r!==void 0?r:"",per_page:(o=(a=t==null?void 0:t.perPage)===null||a===void 0?void 0:a.toString())!==null&&o!==void 0?o:""},xform:sk});if(u.error)throw u.error;const f=await u.json(),h=(i=u.headers.get("x-total-count"))!==null&&i!==void 0?i:0,m=(c=(l=u.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return m.length>0&&(m.forEach(y=>{const b=parseInt(y.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(y.split(";")[1].split("=")[1]);d[`${w}Page`]=b}),d.total=parseInt(h)),{data:Object.assign(Object.assign({},f),d),error:null}}catch(d){if(ce(d))return{data:{clients:[]},error:d};throw d}}async _createOAuthClient(t){try{return await ge(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(ce(s))return{data:null,error:s};throw s}}async _getOAuthClient(t){try{return await ge(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(ce(s))return{data:null,error:s};throw s}}async _updateOAuthClient(t,s){try{return await ge(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:s,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ce(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(t){try{return await ge(this.fetch,"DELET
474E",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(ce(s))return{data:null,error:s};throw s}}async _regenerateOAuthClientSecret(t){try{return await ge(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(ce(s))return{data:null,error:s};throw s}}async _listCustomProviders(t){try{const s={};return t!=null&&t.type&&(s.type=t.type),await ge(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:s,xform:r=>{var a;return{data:{providers:(a=r==null?void 0:r.providers)!==null&&a!==void 0?a:[]},error:null}}})}catch(s){if(ce(s))return{data:{providers:[]},error:s};throw s}}async _createCustomProvider(t){try{return await ge(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(ce(s))return{data:null,error:s};throw s}}async _getCustomProvider(t){try{return await ge(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(ce(s))return{data:null,error:s};throw s}}async _updateCustomProvider(t,s){try{return await ge(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:s,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ce(r))return{data:null,error:r};throw r}}async _deleteCustomProvider(t){try{return await ge(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(ce(s))return{data:null,error:s};throw s}}async _adminListPasskeys(t){Dn(this.experimental),kr(t.userId);try{return await ge(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(ce(s))return{data:null,error:s};throw s}}async _adminDeletePasskey(t){Dn(this.experimental),kr(t.userId),kr(t.passkeyId);try{return await ge(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(ce(s))return{data:null,error:s};throw s}}}function nk(e={}){return{getItem:t=>e[t]||null,setItem:(t,s)=>{e[t]=s},removeItem:t=>{delete e[t]}}}const er={debug:!!(globalThis&&fE()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class pE extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class rk extends pE{}async function DW(e,t,s){er.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;let a;t>0&&(a=setTimeout(()=>{r.abort(),er.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 o=>{if(o){clearTimeout(a),er.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,o.name);try{return await s()}finally{er.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,o.name)}}else{if(t===0)throw er.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new rk(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(er.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"),clearTimeout(a),await s()}})}catch(o){if(t>0&&clearTimeout(a),o!==null&&typeof o=="object"&&"name"in o&&o.name==="AbortError"&&t>0){if(r.signal.aborted)return er.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",e),console.warn(`@
474supabase/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){er.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,i.name);try{return await s()}finally{er.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 s()}));throw er.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new rk(`Lock "${e}" was released because another request stole it`)}throw o}}function IW(){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 mE(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function MW(e){return parseInt(e,16)}function $W(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function UW(e){var t;const{chainId:s,domain:r,expirationTime:a,issuedAt:o=new Date,nonce:i,notBefore:l,requestId:c,resources:d,scheme:u,uri:f,version:h}=e;{if(!Number.isInteger(s))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${s}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(i&&i.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${i}`);if(!f)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(h!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${h}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(`
475`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const m=mE(e.address),y=u?`${u}://${r}`:r,b=e.statement?`${e.statement}
476`:"",w=`${y} wants you to sign in with your Ethereum account:
477${m}
478
479${b}`;let x=`URI: ${f}
480Version: ${h}
481Chain ID: ${s}${i?`
482Nonce: ${i}`:""}
483Issued At: ${o.toISOString()}`;if(a&&(x+=`
484Expiration Time: ${a.toISOString()}`),l&&(x+=`
485Not Before: ${l.toISOString()}`),c&&(x+=`
486Request ID: ${c}`),d){let g=`
487Resources:`;for(const v of d){if(!v||typeof v!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${v}`);g+=`
488- ${v}`}x+=g}return`${w}
489${x}`}class Wt extends Error{constructor({message:t,code:s,cause:r,name:a}){var o;super(t,{cause:r}),this.__isWebAuthnError=!0,this.name=(o=a??(r instanceof Error?r.name:void 0))!==null&&o!==void 0?o:"Unknown Error",this.code=s}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Rp extends Wt{constructor(t,s){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s,message:t}),this.name="WebAuthnUnknownError",this.originalError=s}}function zW({error:e,options:t}){var s,r,a;const{publicKey:o}=t;if(!o)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Wt({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((s=o.authenticatorSelection)===null||s===void 0?void 0:s.requireResidentKey)===!0)return new Wt({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=o.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new Wt({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=o.authenticatorSelection)===null||a===void 0?void 0:a.userVerification)==="required")return new Wt({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 Wt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Wt({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return o.pubKeyCredParams.filter(l=>l.type==="public-key").length===0?new Wt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Wt({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 i=window.location.hostname;if(xE(i)){if(o.rp.id!==i)return new Wt({message:`The RP ID "${o.rp.id}
489" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Wt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(o.user.id.byteLength<1||o.user.id.byteLength>64)return new Wt({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 Wt({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 Wt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function BW({error:e,options:t}){const{publicKey:s}=t;if(!s)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Wt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Wt({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const r=window.location.hostname;if(xE(r)){if(s.rpId!==r)return new Wt({message:`The RP ID "${s.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Wt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Wt({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 Wt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class FW{createNewAbortSignal(){if(this.controller){const s=new Error("Cancelling existing WebAuthn API call for new one");s.name="AbortError",this.controller.abort(s)}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 A1=new FW;function ak(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:s,excludeCredentials:r}=e,a=Pm(e,["challenge","user","excludeCredentials"]),o=Cl(t).buffer,i=Object.assign(Object.assign({},s),{id:Cl(s.id).buffer}),l=Object.assign(Object.assign({},a),{challenge:o,user:i});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:Cl(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return l}function ok(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:s}=e,r=Pm(e,["challenge","allowCredentials"]),a=Cl(t).buffer,o=Object.assign(Object.assign({},r),{challenge:a});if(s&&s.length>0){o.allowCredentials=new Array(s.length);for(let i=0;i<s.length;i++){const l=s[i];o.allowCredentials[i]=Object.assign(Object.assign({},l),{id:Cl(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return o}function ik(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const s=e;return{id:e.id,rawId:e.id,response:{attestationObject:Ho(new Uint8Array(e.response.attestationObject)),clientDataJSON:Ho(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=s.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function lk(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const s=e,r=e.getClientExtensionResults(),a=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Ho(new Uint8Array(a.authenticatorData)),clientDataJSON:Ho(new Uint8Array(a.clientDataJSON)),signature:Ho(new Uint8Array(a.signature)),userHandle:a.userHandle?Ho(new Uint8Array(a.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(t=s.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function xE(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Ap(){var e,t;return!!(is()&&"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 gE(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Rp("Browser returned unexpected credential type",t)}:{data:null,error:new Rp("Empty credential response",t)}}
489catch(t){return{data:null,error:zW({error:t,options:e})}}}async function bE(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Rp("Browser returned unexpected credential type",t)}:{data:null,error:new Rp("Empty credential response",t)}}catch(t){return{data:null,error:BW({error:t,options:e})}}}const WW={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},HW={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Pp(...e){const t=a=>a!==null&&typeof a=="object"&&!Array.isArray(a),s=a=>a instanceof ArrayBuffer||ArrayBuffer.isView(a),r={};for(const a of e)if(a)for(const o in a){const i=a[o];if(i!==void 0)if(Array.isArray(i))r[o]=i;else if(s(i))r[o]=i;else if(t(i)){const l=r[o];t(l)?r[o]=Pp(l,i):r[o]=Pp(i)}else r[o]=i}return r}function GW(e,t){return Pp(WW,e,t||{})}function VW(e,t){return Pp(HW,e,t||{})}class KW{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:s,friendlyName:r,signal:a},o){var i;try{const{data:l,error:c}=await this.client.mfa.challenge({factorId:t,webauthn:s});if(!l)return{data:null,error:c};const d=a??A1.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 m=(await this.client.getUser()).data.user,y=((i=m==null?void 0:m.user_metadata)===null||i===void 0?void 0:i.name)||(m==null?void 0:m.email)||(m==null?void 0:m.id)||"User";u.name=`${u.id}:${y}`}}u.displayName||(u.displayName=u.name)}switch(l.webauthn.type){case"create":{const u=GW(l.webauthn.credential_options.publicKey,o==null?void 0:o.create),{data:f,error:h}=await gE({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:h}}case"request":{const u=VW(l.webauthn.credential_options.publicKey,o==null?void 0:o.request),{data:f,error:h}=await bE(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:h}}}}catch(l){return ce(l)?{data:null,error:l}:{data:null,error:new Fn("Unexpected error in challenge",l)}}}async _verify({challengeId:t,factorId:s,webauthn:r}){return this.client.mfa.verify({factorId:s,challengeId:t,webauthn:r})}async _authenticate({factorId:t,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:a}={}},o){if(!s)return{data:null,error:new yu("rpId is required for WebAuthn authentication")};try{if(!Ap())return{data:null,error:new Fn("Browser does not support WebAuthn",null)};const{data:i,error:l}=await this.challenge({factorId:t,webauthn:{rpId:s,rpOrigins:r},signal:a},{request:o});if(!i)return{data:null,error:l};const{webauthn:c}=i;return this._verify({factorId:t,challengeId:i.challengeId,webauthn:{type:c.type,rpId:s,rpOrigins:r,credential_response:c.credential_response}})}catch(i){return ce(i)?{data:null,error:i}:{data:null,error:new Fn("Unexpected error in authenticate",i)}}}async _register({friendlyName:t,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:a}={}},o){if(!s)return{data:null,error:new yu("rpId is required for WebAuthn registration")};try{if(!Ap())return{data:null,error:new Fn("Browser does not support WebAuthn",null)};const{data:i,error:l}=await this._enroll({friendlyName:t});if(!i)return await this.client.mfa.listFactors().then(u=>{var f;return(f=u.data)===null||f===void 0?void 0:f.all.find(h=>h.factor_type==="webauthn"&&h.friendly_name===t&&h.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:i.id,friendlyName:i.friendly_name,webauthn:{rpId:s,rpOrigins:r},signal:a},{create:o});return c?this._verify({factorId:i.id,challengeId:c.challengeId,webauthn:{rpId:s,rpOrigins:r,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:d}}catch(i){return ce(i)?{data:null,error:i}:{data:null,error:new Fn("Unexpected error in register",i)}}}}IW();const qW={url:JF,storageKey:XF,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:eW,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function ck(e,t,s){return await s()}const Ki={};class vu{get jwks(){var t,s;return(s=(t=Ki[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&s!==void 0?s:{keys:[]}}set jwks(t){Ki[this.storageKey]=Object.assign(Object.assign({},Ki[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,s;return(s=(t=Ki[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&s!==void 0?s:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Ki[this.storageKey]=Object.assign(Object.assign({},Ki[this.storageKey]),{cachedAt:t})}constructor(t){var s,r,a,o;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({},qW),t);if(this.storageKey=i.storageKey,this.instanceID=(s=vu.nextInstanceID[this.storageKey])!==null&&s!==void 0?s:0,vu.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&is()){const l=`${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(l),this.logDebugMessages&&console.trace(l)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.experimental=(r=i.experimental)!==null&&r!==void 0?r:{},this.admin=new LW({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=hE(i.fetch),this.lock=i.lock||ck,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&&is()&&(!((a=globalThis==null?void 0:globalThis.navigator)===null||a===void 0)&&a.locks)?this.lock=DW:this.lock=ck,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 KW(this)}
489,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.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:fE()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=nk(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=nk(this.memoryStorage)),is()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(l){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",l)}(o=this.broadcastChannel)===null||o===void 0||o.addEventListener("message",async l=>{this._debug("received broadcast notification from other tab or client",l);try{await this._notifyAllSubscribers(l.data.event,l.data.session,!1)}catch(c){this._debug("#broadcastChannel","error",c)}})}i.skipAutoInitialize||this.initialize().catch(l=>{this._debug("#initialize()","error",l)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${cE}) ${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 s={},r="none";if(is()&&(s=pW(window.location.href),this._isImplicitGrantCallback(s)?r="implicit":await this._isPKCECallback(s)&&(r="pkce")),is()&&this.detectSessionInUrl&&r!=="none"){const{data:a,error:o}=await this._getSessionFromURL(s,r);if(o){if(this._debug("#_initialize()","error detecting session from URL",o),aW(o)){const c=(t=o.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:o}}return{error:o}}const{session:i,redirectType:l}=a;return this._debug("#_initialize()","detected session in URL",i,"redirect type",l),await this._saveSession(i),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",i):await this._notifyAllSubscribers("SIGNED_IN",i)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(s){return ce(s)?this._returnResult({error:s}):this._returnResult({error:new Fn("Unexpected error during initialization",s)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var s,r,a;try{const o=await ge(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.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:pn}),{data:i,error:l}=o;if(l||!i)return this._returnResult({data:{user:null,session:null},error:l});const c=i.session,d=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:d,session:c},error:null})}catch(o){if(ce(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signUp(t){var s,r,a;try{let o;if("email"in t){const{email:u,password:f,options:h}=t;let m=null,y=null;this.flowType==="pkce"&&([m,y]=await Vi(this.storage,this.storageKey)),o=await ge(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:h==null?void 0:h.emailRedirectTo,body:{email:u,password:f,data:(s=h==null?void 0:h.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},code_challenge:m,code_challenge_method:y},xform:pn})}else if("phone"in t){const{phone:u,password:f,options:h}=t;o=await ge(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:f,data:(r=h==null?void 0:h.data)!==null&&r!==void 0?r:{},channel:(a=h==null?void 0:h.channel)!==null&&a!==void 0?a:"sms",gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken}},xform:pn})}else throw new qf("You must provide either an email or phone number and a password");const{data:i,error:l}=o;if(l||!i)return await os(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:l});const c=i.session,d=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:d,session:c},error:null})}catch(o){if(await os(this.storage,`${this.storageKey}-code-verifier`),ce(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signInWithPassword(t){try{let s;if("email"in t){const{email:o,password:i,options:l}=t;s=await ge(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:o,password:i,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:tk})}else if("phone"in t){const{phone:o,password:i,options:l}=t;s=await ge(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:o,password:i,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:tk})}else throw new qf("You must provide either an email or phone number and a password");const{data:r,error:a}=s;
489if(a)return this._returnResult({data:{user:null,session:null},error:a});if(!r||!r.session||!r.user){const o=new Gi;return this._returnResult({data:{user:null,session:null},error:o})}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(s){if(ce(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOAuth(t){var s,r,a,o;return await this._handleProviderSignIn(t.provider,{redirectTo:(s=t.options)===null||s===void 0?void 0:s.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:(o=t.options)===null||o===void 0?void 0:o.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:s}=t;switch(s){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${s}"`)}}async signInWithEthereum(t){var s,r,a,o,i,l,c,d,u,f,h;let m,y;if("message"in t)m=t.message,y=t.signature;else{const{chain:b,wallet:w,statement:x,options:g}=t;let v;if(is())if(typeof w=="object")v=w;else{const T=window;if("ethereum"in T&&typeof T.ethereum=="object"&&"request"in T.ethereum&&typeof T.ethereum.request=="function")v=T.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 w!="object"||!(g!=null&&g.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");v=w}const k=new URL((s=g==null?void 0:g.url)!==null&&s!==void 0?s:window.location.href),S=await v.request({method:"eth_requestAccounts"}).then(T=>T).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!S||S.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const N=mE(S[0]);let C=(r=g==null?void 0:g.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!C){const T=await v.request({method:"eth_chainId"});C=MW(T)}const _={domain:k.host,address:N,statement:x,uri:k.href,version:"1",chainId:C,nonce:(a=g==null?void 0:g.signInWithEthereum)===null||a===void 0?void 0:a.nonce,issuedAt:(i=(o=g==null?void 0:g.signInWithEthereum)===null||o===void 0?void 0:o.issuedAt)!==null&&i!==void 0?i:new Date,expirationTime:(l=g==null?void 0:g.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(c=g==null?void 0:g.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(d=g==null?void 0:g.signInWithEthereum)===null||d===void 0?void 0:d.requestId,resources:(u=g==null?void 0:g.signInWithEthereum)===null||u===void 0?void 0:u.resources};m=UW(_),y=await v.request({method:"personal_sign",params:[$W(m),N]})}try{const{data:b,error:w}=await ge(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:m,signature:y},!((f=t.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(h=t.options)===null||h===void 0?void 0:h.captchaToken}}:null),xform:pn});if(w)throw w;if(!b||!b.session||!b.user){const x=new Gi;return this._returnResult({data:{user:null,session:null},error:x})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:w})}catch(b){if(ce(b))return this._returnResult({data:{user:null,session:null},error:b});throw b}}async signInWithSolana(t){var s,r,a,o,i,l,c,d,u,f,h,m;let y,b;if("message"in t)y=t.message,b=t.signature;else{const{chain:w,wallet:x,statement:g,options:v}=t;let k;if(is())if(typeof x=="object")k=x;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"))k=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 x!="object"||!(v!=null&&v.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");k=x}const S=new URL((s=v==null?void 0:v.url)!==null&&s!==void 0?s:window.location.href);
489if("signIn"in k&&k.signIn){const N=await k.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},v==null?void 0:v.signInWithSolana),{version:"1",domain:S.host,uri:S.href}),g?{statement:g}:null));let C;if(Array.isArray(N)&&N[0]&&typeof N[0]=="object")C=N[0];else if(N&&typeof N=="object"&&"signedMessage"in N&&"signature"in N)C=N;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in C&&"signature"in C&&(typeof C.signedMessage=="string"||C.signedMessage instanceof Uint8Array)&&C.signature instanceof Uint8Array)y=typeof C.signedMessage=="string"?C.signedMessage:new TextDecoder().decode(C.signedMessage),b=C.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in k)||typeof k.signMessage!="function"||!("publicKey"in k)||typeof k!="object"||!k.publicKey||!("toBase58"in k.publicKey)||typeof k.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");y=[`${S.host} wants you to sign in with your Solana account:`,k.publicKey.toBase58(),...g?["",g,""]:[""],"Version: 1",`URI: ${S.href}`,`Issued At: ${(a=(r=v==null?void 0:v.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&a!==void 0?a:new Date().toISOString()}`,...!((o=v==null?void 0:v.signInWithSolana)===null||o===void 0)&&o.notBefore?[`Not Before: ${v.signInWithSolana.notBefore}`]:[],...!((i=v==null?void 0:v.signInWithSolana)===null||i===void 0)&&i.expirationTime?[`Expiration Time: ${v.signInWithSolana.expirationTime}`]:[],...!((l=v==null?void 0:v.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${v.signInWithSolana.chainId}`]:[],...!((c=v==null?void 0:v.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${v.signInWithSolana.nonce}`]:[],...!((d=v==null?void 0:v.signInWithSolana)===null||d===void 0)&&d.requestId?[`Request ID: ${v.signInWithSolana.requestId}`]:[],...!((f=(u=v==null?void 0:v.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||f===void 0)&&f.length?["Resources",...v.signInWithSolana.resources.map(C=>`- ${C}`)]:[]].join(`
490`);const N=await k.signMessage(new TextEncoder().encode(y),"utf8");if(!N||!(N instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");b=N}}try{const{data:w,error:x}=await ge(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:y,signature:Ho(b)},!((h=t.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(m=t.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:pn});if(x)throw x;if(!w||!w.session||!w.user){const g=new Gi;return this._returnResult({data:{user:null,session:null},error:g})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:x})}catch(w){if(ce(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async _exchangeCodeForSession(t){const s=await Ao(this.storage,`${this.storageKey}-code-verifier`),[r,a]=(s??"").split("/");try{if(!r&&this.flowType==="pkce")throw new oW;const{data:o,error:i}=await ge(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:r},xform:pn});if(await os(this.storage,`${this.storageKey}-code-verifier`),i)throw i;if(!o||!o.session||!o.user){const l=new Gi;return this._returnResult({data:{user:null,session:null,redirectType:null},error:l})}return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers(a==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",o.session)),this._returnResult({data:Object.assign(Object.assign({},o),{redirectType:a??null}),error:i})}catch(o){if(await os(this.storage,`${this.storageKey}-code-verifier`),ce(o))return this._returnResult({data:{user:null,session:null,redirectType:null},error:o});throw o}}async signInWithIdToken(t){try{const{options:s,provider:r,token:a,access_token:o,nonce:i}=t,l=await ge(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:a,access_token:o,nonce:i,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},xform:pn}),{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 Gi;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(s){if(ce(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOtp(t){var s,r,a,o,i;try{if("email"in t){const{email:l,options:c}=t;let d=null,u=null;this.flowType==="pkce"&&([d,u]=await Vi(this.storage,this.storageKey));const{error:f}=await ge(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(s=c==null?void 0:c.data)!==null&&s!==void 0?s:{},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 ge(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:(o=c==null?void 0:c.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(i=c==null?void 0:c.channel)!==null&&i!==void 0?i:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:d==null?void 0:d.message_id},error:u})}throw new qf("You must provide either an email or phone number.")}catch(l){if(await os(this.storage,`${this.storageKey}-code-verifier`),ce(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async verifyOtp(t){var s,r;try{let a,o;"options"in t&&(a=(s=t.options)===null||s===void 0?void 0:s.redirectTo,o=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:i,error:l}=await ge(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:o}}),redirectTo:a,xform:pn});if(l)throw l;if(!i)throw new Error("An error occurred on token verification.");const c=i.session,d=i.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})}catch(a){if(ce(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithSSO(t){var s,r,a,o,i;try{let l=null,c=null;this.flowType==="pkce"&&([l,c]=await Vi(this.storage,this.storageKey));const d=await ge(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=(s=t.options)===null||s===void 0?void 0:s.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:AW});return!((o=d.data)===null||o===void 0)&&o.url&&is()&&!(!((i=t.options)===null||i===void 0)&&i.skipBrowserRedirect)&&window.location.assign(d.data.url),this._returnResult(d)}catch(l){if(await os(this.storage,`${this.storageKey}-code-verifier`),ce(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:s},error:r}=t;if(r)throw r;if(!s)throw new es;const{error:a}=await ge(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:s.access_token});return this._returnResult({data:{user:null,session:null},error:a})})}catch(t){if(ce(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const s=`${this.url}/resend`;if("email"in t){const{email:r,type:a,options:o}=t,{error:i}=await ge(this.fetch,"POST",s,{headers:this.headers,body:{email:r,type:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},redirectTo:o==null?void 0:o.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:i})}else if("phone"in t){const{phone:r,type:a,options:o}=t,{data:i,error:l}=await ge(this.fetch,"POST",s,{headers:this.headers,body:{phone:r,type:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:i==null?void 0:i.message_id},error:l})}throw new qf("You must provide either an email or phone number and a type")}catch(s){if(ce(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async s=>s))}async _acquireLock(t,s){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 s()))();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=s();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 s=await this.__loadSession();return await t(s)}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 s=await Ao(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",s),s!==null&&(this._isValidSession(s)?t=s:(this._debug("#getSession()","session from storage is not val
490id"),await this._removeSession())),!t)return{data:{session:null},error:null};const r=t.expires_at?t.expires_at*1e3-Date.now()<Yx:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r){if(this.userStorage){const i=await Ao(this.userStorage,this.storageKey+"-user");i!=null&&i.user?t.user=i.user:t.user=Jx()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const i={value:this.suppressGetSessionWarning};t.user=_W(t.user,i),i.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:a,error:o}=await this._callRefreshToken(t.refresh_token);return o?this._returnResult({data:{session:null},error:o}):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 s=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return s.data.user&&(this.suppressGetSessionWarning=!0),s}async _getUser(t){try{return t?await ge(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:Na}):await this._useSession(async s=>{var r,a,o;const{data:i,error:l}=s;if(l)throw l;return!(!((r=i.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new es}:await ge(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(o=(a=i.session)===null||a===void 0?void 0:a.access_token)!==null&&o!==void 0?o:void 0,xform:Na})})}catch(s){if(ce(s))return Kf(s)&&(await this._removeSession(),await os(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:s});throw s}}async updateUser(t,s={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,s))}async _updateUser(t,s={}){try{return await this._useSession(async r=>{const{data:a,error:o}=r;if(o)throw o;if(!a.session)throw new es;const i=a.session;let l=null,c=null;this.flowType==="pkce"&&t.email!=null&&([l,c]=await Vi(this.storage,this.storageKey));const{data:d,error:u}=await ge(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:s==null?void 0:s.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:l,code_challenge_method:c}),jwt:i.access_token,xform:Na});if(u)throw u;return i.user=d.user,await this._saveSession(i),await this._notifyAllSubscribers("USER_UPDATED",i),this._returnResult({data:{user:i.user},error:null})})}catch(r){if(await os(this.storage,`${this.storageKey}-code-verifier`),ce(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 es;const s=Date.now()/1e3;let r=s,a=!0,o=null;const{payload:i}=Yf(t.access_token);if(i.exp&&(r=i.exp,a=r<=s),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};o=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});o={access_token:t.access_token,refresh_token:t.refresh_token,user:l.user,token_type:"bearer",expires_in:r-s,expires_at:r},await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)}return this._returnResult({data:{user:o.user,session:o},error:null})}catch(s){if(ce(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}}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 s=>{var r;if(!t){const{data:i,error:l}=s;if(l)throw l;t=(r=i.session)!==null&&r!==void 0?r:void 0}if(!(t!=null&&t.refresh_token))throw new es;const{data:a,error:o}=await this._callRefreshToken(t.refresh_token);return o?this._returnResult({data:{user:null,session:null},error:o}):a?this._returnResult({data:{user:a.user,session:a},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(s){if(ce(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async _getSessionFromURL(t,s){var r;try{if(!is())throw new Zf("No browser detected.");
490if(t.error||t.error_description||t.error_code)throw new Zf(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(s){case"implicit":if(this.flowType==="pkce")throw new qj("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Zf("Not a valid implicit grant flow url.");break;default:}if(s==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new qj("No code detected.");const{data:v,error:k}=await this._exchangeCodeForSession(t.code);if(k)throw k;const S=new URL(window.location.href);return S.searchParams.delete("code"),window.history.replaceState(window.history.state,"",S.toString()),{data:{session:v.session,redirectType:(r=v.redirectType)!==null&&r!==void 0?r:null},error:null}}const{provider_token:a,provider_refresh_token:o,access_token:i,refresh_token:l,expires_in:c,expires_at:d,token_type:u}=t;if(!i||!c||!l||!u)throw new Zf("No session defined in URL");const f=Math.round(Date.now()/1e3),h=parseInt(c);let m=f+h;d&&(m=parseInt(d));const y=m-f;y*1e3<=Xi&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${y}s, should have been closer to ${h}s`);const b=m-h;f-b>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",b,m,f):f-b<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",b,m,f);const{data:w,error:x}=await this._getUser(i);if(x)throw x;const g={provider_token:a,provider_refresh_token:o,access_token:i,expires_in:h,expires_at:m,refresh_token:l,token_type:u,user:w.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:g,redirectType:t.type},error:null})}catch(a){if(ce(a))return this._returnResult({data:{session:null,redirectType:null},error:a});throw a}}_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 s=await Ao(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&s)}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 s=>{var r;const{data:a,error:o}=s;if(o&&!Kf(o))return this._returnResult({error:o});const i=(r=a.session)===null||r===void 0?void 0:r.access_token;if(i){const{error:l}=await this.admin.signOut(i,t);if(l&&!(rW(l)&&(l.status===404||l.status===401||l.status===403)||Kf(l)))return this._returnResult({error:l})}return t!=="others"&&(await this._removeSession(),await os(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const s=hW(),r={id:s,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",s),this.stateChangeEmitters.delete(s)}};return this._debug("#onAuthStateChange()","registered callback with id",s),this.stateChangeEmitters.set(s,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(s)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async s=>{var r,a;try{const{data:{session:o},error:i}=s;if(i)throw i;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",o)),this._debug("INITIAL_SESSION","callback id",t,"session",o)}catch(o){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",o),Kf(o)?console.warn(o):console.error(o)}})}async resetPasswordForEmail(t,s={}){let r=null,a=null;this.flowType==="pkce"&&([r,a]=await Vi(this.storage,this.storageKey,!0));try{return await ge(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:r,code_challenge_method:a,gotrue_meta_security:{captcha_token:s.captchaToken}},headers:this.headers,redirectTo:s.redirectTo})}catch(o){if(await os(this.storage,`${this.storageKey}-code-verifier`),ce(o))return this._returnResult({data:null,error:o});throw o}}async getUserIdentities(){var t;try{const{data:s,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(t=s.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(s){if(ce(s))return this._returnResult({data:null,error:s});throw s}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var s;try{const{data:r,error:a}=await this._useSession(async o=>{var i,l,c,d,u;const{data:f,error:h}=o;if(h)throw h;const m=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(i=t.options)===null||i===void 0?void 0:i.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 ge(this.fetch,"GET",m,{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;
490return is()&&!(!((s=t.options)===null||s===void 0)&&s.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(ce(r))return this._returnResult({data:{provider:t.provider,url:null},error:r});throw r}}async linkIdentityIdToken(t){return await this._useSession(async s=>{var r;try{const{error:a,data:{session:o}}=s;if(a)throw a;const{options:i,provider:l,token:c,access_token:d,nonce:u}=t,f=await ge(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=o==null?void 0:o.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:i==null?void 0:i.captchaToken}},xform:pn}),{data:h,error:m}=f;return m?this._returnResult({data:{user:null,session:null},error:m}):!h||!h.session||!h.user?this._returnResult({data:{user:null,session:null},error:new Gi}):(h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("USER_UPDATED",h.session)),this._returnResult({data:h,error:m}))}catch(a){if(await os(this.storage,`${this.storageKey}-code-verifier`),ce(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}})}async unlinkIdentity(t){try{return await this._useSession(async s=>{var r,a;const{data:o,error:i}=s;if(i)throw i;return await ge(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(a=(r=o.session)===null||r===void 0?void 0:r.access_token)!==null&&a!==void 0?a:void 0})})}catch(s){if(ce(s))return this._returnResult({data:null,error:s});throw s}}async _refreshAccessToken(t){const s=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{const r=Date.now();return await gW(async a=>(a>0&&await xW(200*Math.pow(2,a-1)),this._debug(s,"refreshing attempt",a),await ge(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:pn})),(a,o)=>{const i=200*Math.pow(2,a);return o&&Qx(o)&&Date.now()+i-r<Xi})}catch(r){if(this._debug(s,"error",r),ce(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(s,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,s){const r=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:s.redirectTo,scopes:s.scopes,queryParams:s.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",s,"url",r),is()&&!s.skipBrowserRedirect&&window.location.assign(r),{data:{provider:t,url:r},error:null}}async _recoverAndRefresh(){var t,s;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const a=await Ao(this.storage,this.storageKey);if(a&&this.userStorage){let i=await Ao(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!i&&(i={user:a.user},await el(this.userStorage,this.storageKey+"-user",i)),a.user=(t=i==null?void 0:i.user)!==null&&t!==void 0?t:Jx()}else if(a&&!a.user&&!a.user){const i=await Ao(this.storage,this.storageKey+"-user");i&&(i!=null&&i.user)?(a.user=i.user,await os(this.storage,this.storageKey+"-user"),await el(this.storage,this.storageKey,a)):a.user=Jx()}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 o=((s=a.expires_at)!==null&&s!==void 0?s:1/0)*1e3-Date.now()<Yx;if(this._debug(r,`session has${o?"":" not"} expired with margin of ${Yx}s`),o){if(this.autoRefreshToken&&a.refresh_token){const{error:i}=await this._callRefreshToken(a.refresh_token);i&&(console.error(i),Qx(i)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",i),await this._removeSession()))}}else if(a.user&&a.user.__isUserNotAvailableProxy===!0)try{const{data:i,error:l}=await this._getUser(a.access_token);!l&&(i!=null&&i.user)?(a.user=i.user,await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(i){console.error("Error getting user data:",i),this._debug(r,"error getting user data, skipping SIGNED_IN notification",i)}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 s,r;if(!t)throw new es;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const a=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(a,"begin");try{this.refreshingDeferred=new Dm;const{data:o,error:i}=await this._refreshAccessToken(t);if(i)throw i;if(!o.session)throw new es;await this._saveSession(o.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",o.session);const l={data:o.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(o){if(this._debug(a,"error",o),ce(o)){const i={data:null,error:o};return Qx(o)||await this._removeSession(),(s=this.refreshingDeferred)===null||s===void 0||s.resolve(i),i}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(o),o}finally{this.refreshingDeferred=null,this._debug(a,"end")}}async _notifyAllSubscribers(t,s,r=!0){const a=`#_notifyAllSubscribers(${t})`;this._debug(a,"begin",s,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:t,session:s});const o=[],i=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(t,s)}catch(c){o.push(c)}});if(await Promise.all(i),o.length>0){for(let l=0;l<o.length;l+=1)console.error(o[l]);throw o[0]}}finally{this._debug(a,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await os(this.storage,`${this.storageKey}-code-verifier`);const s=Object.assign({},t),r=s.user&&s.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&s.user&&await el(this.userStorage,this.storageKey+"-user",{user:s.user});const a=Object.assign({},s);delete a.user;const o=Xj(a);await el(this.storage,this.storageKey,o)}else{const a=Xj(s);await el(this.storage,this.storageKey,a)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await os(this.storage,this.storageKey),await os(this.storage,this.storageKey+"-code-verifier"),await os(this.storage,this.storageKey+"-user"),this.userStorage&&await os(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&is()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}
490catch(s){console.error("removing visibilitychange callback failed",s)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Xi);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const s=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=s,s&&typeof s=="object"&&typeof s.unref=="function"?s.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(s)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const s=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,s&&clearTimeout(s)}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 s=>{const{data:{session:r}}=s;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const a=Math.floor((r.expires_at*1e3-t)/Xi);this._debug("#_autoRefreshTokenTick()",`access token expires in ${a} ticks, a tick lasts ${Xi}ms, refresh threshold is ${_1} ticks`),a<=_1&&await this._callRefreshToken(r.refresh_token)})}catch(s){console.error("Auto refresh tick failed with error. This is likely a transient error.",s)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t instanceof pE)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!is()||!(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 s=`#_onVisibilityChanged(${t})`;this._debug(s,"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(s,"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,s,r){const a=[`provider=${encodeURIComponent(s)}`];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[o,i]=await Vi(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(i)}`});a.push(l.toString())}if(r!=null&&r.queryParams){const o=new URLSearchParams(r.queryParams);a.push(o.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 s=>{var r;const{data:a,error:o}=s;return o?this._returnResult({data:null,error:o}):await ge(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(s){if(ce(s))return this._returnResult({data:null,error:s});throw s}}async _enroll(t){try{return await this._useSession(async s=>{var r,a;const{data:o,error:i}=s;if(i)return this._returnResult({data:null,error:i});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 ge(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(r=o==null?void 0:o.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(s){if(ce(s))return this._returnResult({data:null,error:s});throw s}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var r;const{data:a,error:o}=s;
490if(o)return this._returnResult({data:null,error:o});const i=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?ik(t.webauthn.credential_response):lk(t.webauthn.credential_response)})}:{code:t.code}),{data:l,error:c}=await ge(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:i,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(s){if(ce(s))return this._returnResult({data:null,error:s});throw s}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var r;const{data:a,error:o}=s;if(o)return this._returnResult({data:null,error:o});const i=await ge(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(i.error)return i;const{data:l}=i;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:ak(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:ok(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(s){if(ce(s))return this._returnResult({data:null,error:s});throw s}})}async _challengeAndVerify(t){const{data:s,error:r}=await this._challenge({factorId:t.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:t.factorId,challengeId:s.id,code:t.code})}async _listFactors(){var t;const{data:{user:s},error:r}=await this.getUser();if(r)return{data:null,error:r};const a={all:[],phone:[],totp:[],webauthn:[]};for(const o of(t=s==null?void 0:s.factors)!==null&&t!==void 0?t:[])a.all.push(o),o.status==="verified"&&a[o.factor_type].push(o);return{data:a,error:null}}async _getAuthenticatorAssuranceLevel(t){var s,r,a,o;if(t)try{const{payload:m}=Yf(t);let y=null;m.aal&&(y=m.aal);let b=y;const{data:{user:w},error:x}=await this.getUser(t);if(x)return this._returnResult({data:null,error:x});((r=(s=w==null?void 0:w.factors)===null||s===void 0?void 0:s.filter(k=>k.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(b="aal2");const v=m.amr||[];return{data:{currentLevel:y,nextLevel:b,currentAuthenticationMethods:v},error:null}}catch(m){if(ce(m))return this._returnResult({data:null,error:m});throw m}const{data:{session:i},error:l}
490=await this.getSession();if(l)return this._returnResult({data:null,error:l});if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:c}=Yf(i.access_token);let d=null;c.aal&&(d=c.aal);let u=d;((o=(a=i.user.factors)===null||a===void 0?void 0:a.filter(m=>m.status==="verified"))!==null&&o!==void 0?o:[]).length>0&&(u="aal2");const h=c.amr||[];return{data:{currentLevel:d,nextLevel:u,currentAuthenticationMethods:h},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async s=>{const{data:{session:r},error:a}=s;return a?this._returnResult({data:null,error:a}):r?await ge(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:r.access_token,xform:o=>({data:o,error:null})}):this._returnResult({data:null,error:new es})})}catch(s){if(ce(s))return this._returnResult({data:null,error:s});throw s}}async _approveAuthorization(t,s){try{return await this._useSession(async r=>{const{data:{session:a},error:o}=r;if(o)return this._returnResult({data:null,error:o});if(!a)return this._returnResult({data:null,error:new es});const i=await ge(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 i.data&&i.data.redirect_url&&is()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(i.data.redirect_url),i})}catch(r){if(ce(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(t,s){try{return await this._useSession(async r=>{const{data:{session:a},error:o}=r;if(o)return this._returnResult({data:null,error:o});if(!a)return this._returnResult({data:null,error:new es});const i=await ge(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 i.data&&i.data.redirect_url&&is()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(i.data.redirect_url),i})}catch(r){if(ce(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?await ge(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,xform:a=>({data:a,error:null})}):this._returnResult({data:null,error:new es})})}catch(t){if(ce(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async s=>{const{data:{session:r},error:a}=s;return a?this._returnResult({data:null,error:a}):r?(await ge(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 es})})}catch(s){if(ce(s))return this._returnResult({data:null,error:s});throw s}}async fetchJwk(t,s={keys:[]}){let r=s.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+sW>a)return r;const{data:o,error:i}=await ge(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(i)throw i;return!o.keys||o.keys.length===0||(this.jwks=o,this.jwks_cached_at=a,r=o.keys.find(l=>l.kid===t),!r)?null:r}async getClaims(t,s={}){try{let r=t;if(!r){const{data:m,error:y}
490=await this.getSession();if(y||!m.session)return this._returnResult({data:null,error:y});r=m.session.access_token}const{header:a,payload:o,signature:i,raw:{header:l,payload:c}}=Yf(r);s!=null&&s.allowExpired||SW(o.exp);const d=!a.alg||a.alg.startsWith("HS")||!a.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(a.kid,s!=null&&s.keys?{keys:s.keys}:s==null?void 0:s.jwks);if(!d){const{error:m}=await this.getUser(r);if(m)throw m;return{data:{claims:o,header:a,signature:i},error:null}}const u=NW(a.alg),f=await crypto.subtle.importKey("jwk",d,u,!0,["verify"]);if(!await crypto.subtle.verify(u,f,i,uW(`${l}.${c}`)))throw new R1("Invalid JWT signature");return{data:{claims:o,header:a,signature:i},error:null}}catch(r){if(ce(r))return this._returnResult({data:null,error:r});throw r}}async signInWithPasskey(t){var s,r,a;Dn(this.experimental);try{if(!Ap())return this._returnResult({data:null,error:new Fn("Browser does not support WebAuthn",null)});const{data:o,error:i}=await this._startPasskeyAuthentication({options:{captchaToken:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}});if(i||!o)return this._returnResult({data:null,error:i});const l=ok(o.options),c=(a=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.signal)!==null&&a!==void 0?a:A1.createNewAbortSignal(),{data:d,error:u}=await bE({publicKey:l,signal:c});if(u||!d)return this._returnResult({data:null,error:u??new Fn("WebAuthn ceremony failed",null)});const f=lk(d);return this._verifyPasskeyAuthentication({challengeId:o.challenge_id,credential:f})}catch(o){if(ce(o))return this._returnResult({data:null,error:o});throw o}}async registerPasskey(t){var s,r;Dn(this.experimental);try{if(!Ap())return this._returnResult({data:null,error:new Fn("Browser does not support WebAuthn",null)});const{data:a,error:o}=await this._startPasskeyRegistration();if(o||!a)return this._returnResult({data:null,error:o});const i=ak(a.options),l=(r=(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.signal)!==null&&r!==void 0?r:A1.createNewAbortSignal(),{data:c,error:d}=await gE({publicKey:i,signal:l});if(d||!c)return this._returnResult({data:null,error:d??new Fn("WebAuthn ceremony failed",null)});const u=ik(c);return this._verifyPasskeyRegistration({challengeId:a.challenge_id,credential:u})}catch(a){if(ce(a))return this._returnResult({data:null,error:a});throw a}}async _startPasskeyRegistration(){Dn(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new es});const{data:a,error:o}=await ge(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:s.access_token,body:{}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:a,error:null})})}catch(t){if(ce(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){Dn(this.experimental);try{return await this._useSession(async s=>{const{data:{session:r},error:a}=s;
490if(a)return this._returnResult({data:null,error:a});if(!r)return this._returnResult({data:null,error:new es});const{data:o,error:i}=await ge(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:r.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:o,error:null})})}catch(s){if(ce(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyAuthentication(t){var s;Dn(this.experimental);try{const{data:r,error:a}=await ge(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:r,error:null})}catch(r){if(ce(r))return this._returnResult({data:null,error:r});throw r}}async _verifyPasskeyAuthentication(t){Dn(this.experimental);try{const{data:s,error:r}=await ge(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:pn});return r?this._returnResult({data:null,error:r}):(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:s,error:null}))}catch(s){if(ce(s))return this._returnResult({data:null,error:s});throw s}}async _listPasskeys(){Dn(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new es});const{data:a,error:o}=await ge(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:s.access_token,xform:i=>({data:i,error:null})});return o?this._returnResult({data:null,error:o}):this._returnResult({data:a,error:null})})}catch(t){if(ce(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){Dn(this.experimental);try{return await this._useSession(async s=>{const{data:{session:r},error:a}=s;
490if(a)return this._returnResult({data:null,error:a});if(!r)return this._returnResult({data:null,error:new es});const{data:o,error:i}=await ge(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:r.access_token,body:{friendly_name:t.friendlyName}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:o,error:null})})}catch(s){if(ce(s))return this._returnResult({data:null,error:s});throw s}}async _deletePasskey(t){Dn(this.experimental);try{return await this._useSession(async s=>{const{data:{session:r},error:a}=s;if(a)return this._returnResult({data:null,error:a});if(!r)return this._returnResult({data:null,error:new es});const{error:o}=await ge(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:r.access_token,noResolveJson:!0});return o?this._returnResult({data:null,error:o}):this._returnResult({data:null,error:null})})}catch(s){if(ce(s))return this._returnResult({data:null,error:s});throw s}}}vu.nextInstanceID={};const ZW=vu,YW="2.105.4";let yd="";typeof Deno<"u"?yd="deno":typeof document<"u"?yd="web":typeof navigator<"u"&&navigator.product==="ReactNative"?yd="react-native":yd="node";const QW={"X-Client-Info":`supabase-js-${yd}/${YW}`},JW={headers:QW},XW={schema:"public"},eH={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},tH={};function wu(e){"@babel/helpers - typeof";return wu=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},wu(e)}function sH(e,t){if(wu(e)!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var r=s.call(e,t);if(wu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function nH(e){var t=sH(e,"string");return wu(t)=="symbol"?t:t+""}function rH(e,t,s){return(t=nH(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function dk(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),s.push.apply(s,r)}return s}function Ot(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?dk(Object(s),!0).forEach(function(r){rH(e,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):dk(Object(s)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(s,r))})}return e}const aH=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),oH=()=>Headers,iH=(e,t,s)=>{const r=aH(s),a=oH();return async(o,i)=>{var l;const c=(l=await t())!==null&&l!==void 0?l:e;let d=new a(i==null?void 0:i.headers);return d.has("apikey")||d.set("apikey",e),d.has("Authorization")||d.set("Authorization",`Bearer ${c}`),r(o,Ot(Ot({},i),{},{headers:d}))}};function lH(e){return e.endsWith("/")?e:e+"/"}function cH(e,t){var s,r;const{db:a,auth:o,realtime:i,global:l}=e,{db:c,auth:d,realtime:u,global:f}=t,h={db:Ot(Ot({},c),a),auth:Ot(Ot({},d),o),realtime:Ot(Ot({},u),i),storage:{},global:Ot(Ot(Ot({},f),l),{},{headers:Ot(Ot({},(s=f==null?void 0:f.headers)!==null&&s!==void 0?s:{}),(r=l==null?void 0:l.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return e.accessToken?h.accessToken=e.accessToken:delete h.accessToken,h}function dH(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(lH(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var uH=class extends ZW{constructor(e){super(e)}},fH=class{constructor(e,t,s){var r,a;this.supabaseUrl=e,this.supabaseKey=t;const o=dH(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",o),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",o),this.storageUrl=new URL("storage/v1",o),this.functionsUrl=new URL("functions/v1",o);const i=`sb-${o.hostname.split(".")[0]}-auth-token`,l={db:XW,realtime:tH,auth:Ot(Ot({},eH),{},{storageKey:i}),global:JW},c=cH(s??{},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=iH(t,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(Ot({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},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 $B(new URL("rest/v1",o).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch,timeout:c.db.timeout,urlLengthLimit:c.db.urlLengthLimit}
490),this.storage=new QF(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),c.accessToken||this._listenForAuthEvents()}get functions(){return new TB(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={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,s)}channel(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,s;if(e.accessToken)return await e.accessToken();const{data:r}=await e.auth.getSession();return(t=(s=r.session)===null||s===void 0?void 0:s.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:r,userStorage:a,storageKey:o,flowType:i,lock:l,debug:c,throwOnError:d,experimental:u,lockAcquireTimeout:f,skipAutoInitialize:h},m,y){const b={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new uH({url:this.authUrl.href,headers:Ot(Ot({},b),m),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:r,userStorage:a,flowType:i,lock:l,debug:c,throwOnError:d,experimental:u,fetch:y,lockAcquireTimeout:f,skipAutoInitialize:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(w=>w.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new vF(this.realtimeUrl.href,Ot(Ot({},e),{},{params:Ot(Ot({},{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,s){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const hH=(e,t,s)=>new fH(e,t,s);function pH(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const s=t.match(/^v(\d+)\./);return s?parseInt(s[1],10)<=18:!1}pH()&&console.warn("⚠️  Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const _l={},yE="https://yrecdosksgigpceholjl.supabase.co",mH="sb_publishable_x-W4800MtS_hbFAnLmAk6Q_68P4Nxsf",xH=typeof window<"u"?window.location.hostname:"localhost",nv=(_l==null?void 0:_l.VITE_LOCAL_SUPABASE_URL)??`http://${xH}:3001`,gH="dev-anon-key",vE=(_l==null?void 0:_l.VITE_BOT_API_URL)??"https://dischordleaderboard-production.up.railway.app",uk="prod".toLowerCase();function bH(){return uk==="mock"?null:uk==="local"?{url:nv,key:gH}:{url:yE,key:mH}}const Tl=bH(),$t=Tl?hH(Tl.url,Tl.key,{auth:{persistSession:!0,flowType:"pkce"}}):null,yH=$t!==null,rv=(Tl==null?void 0:Tl.url)===yE,vH="modulepreload",wH=function(e){return"/"+e},fk={}
490,Ja=function(t,s,r){let a=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));a=Promise.allSettled(s.map(c=>{if(c=wH(c),c in fk)return;fk[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":vH,d||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),d)return new Promise((h,m)=>{f.addEventListener("load",h),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function o(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return a.then(i=>{for(const l of i||[])l.status==="rejected"&&o(l.reason);return t().catch(o)})},At="3d101b25-090e-4668-ba0e-c0e7614ba4df",wE="SOS Pod Draft #3",jE="2026-05-14",Ge={noya:{id:"p-noya"},wave:{id:"p-wave"},elfandor:{id:"p-elfandor"},flutterdev:{id:"p-flutterdev"},oophies:{id:"p-oophies"},adoodwithgood:{id:"p-adoodwithgood"},lark:{id:"p-lark"},samp:{id:"p-samp"}},Nt={id:At,name:wE,slug:"sos-pod-draft-3",setCode:"SOS",date:jE,formatLabel:"Pod Draft · Swiss · 3 Rounds",totalRounds:3,participants:[{eventId:At,playerId:Ge.noya.id,slug:"noya",displayName:"Noya",deckColors:"WU",deckScreenshotUrl:qi("NOYA","WU"),deckScreenshotCaption:"Pure WU tempo, splash for nothing — went 5 picks deep on counterspells.",placement:2,record:"2-1",seatIndex:0},{eventId:At,playerId:Ge.wave.id,slug:"waveofshadow",displayName:"WaveofShadow",deckColors:"UBg",deckScreenshotUrl:qi("WAVEOFSHADOW","UBg"),deckScreenshotCaption:"UB tempo, late green splash for removal.",placement:1,record:"3-0",seatIndex:1},{eventId:At,playerId:Ge.elfandor.id,slug:"elfandor",displayName:"Elfandor",deckColors:"WR",deckScreenshotUrl:qi("ELFANDOR","WR"),deckScreenshotCaption:"Classic Boros aggro.",placement:3,record:"2-1",seatIndex:2},{eventId:At,playerId:Ge.flutterdev.id,slug:"flutterdev",displayName:"flutterdev",deckColors:"BG",deckScreenshotUrl:null,deckScreenshotCaption:null,placement:4,record:"1-2",seatIndex:3},{eventId:At,playerId:Ge.oophies.id,slug:"oophies",displayName:"Oophies",deckColors:"RG",deckScreenshotUrl:qi("OOPHIES","RG"),deckScreenshotCaption:"Gruul stompy, big creatures.",placement:5,record:"1-2",seatIndex:4},{eventId:At,playerId:Ge.adoodwithgood.id,slug:"adoodwithgood",displayName:"adoodwithgood",deckColors:"UR",deckScreenshotUrl:null,deckScreenshotCaption:null,placement:6,record:"1-2",seatIndex:5},{eventId:At,playerId:Ge.lark.id,slug:"lark",displayName:"Lark",deckColors:"WB",deckScreenshotUrl:qi("LARK","WB"),deckScreenshotCaption:"Orzhov sacrifice, never found the engine.",placement:7,record:"0-3",seatIndex:6},{eventId:At,playerId:Ge.samp.id,slug:"samp",displayName:"samp",deckColors:"WG",deckScreenshotUrl:qi("SAMP","WG"),deckScreenshotCaption:"Selesnya tokens. Anthem effects everywhere.",placement:8,record:"2-1",seatIndex:7}],matches:[{eventId:At,round:1,playerA:"Noya",playerB:"Elfandor",winner:"Noya",score:"2-1",reportedAt:hn(28)},{eventId:At,round:1,playerA:"WaveofShadow",playerB:"flutterdev",winner:"WaveofShadow",score:"2-0",reportedAt:hn(15)},{eventId:At,round:1,playerA:"Oophies",playerB:"adoodwithgood",winner:"Oophies",score:"2-1",reportedAt:hn(27)},{eventId:At,round:1,playerA:"samp",playerB:"Lark",winner:"samp",score:"2-0",reportedAt:hn(22)},{eventId:At,round:2,playerA:"WaveofShadow",playerB:"Noya",winner:"WaveofShadow",score:"2-1",reportedAt:hn(69)},{eventId:At,round:2,playerA:"samp",playerB:"Oophies",winner:"samp",score:"2-1",reportedAt:hn(72)},{eventId:At,round:2,playerA:"Elfandor",playerB:"flutterdev",winner:"Elfandor",score:"2-0",reportedAt:hn(62)},{eventId:At,round:2,playerA:"adoodwithgood",playerB:"Lark",winner:"adoodwithgood",score:"2-0",reportedAt:hn(65)},{eventId:At,round:3,playerA:"WaveofShadow",playerB:"samp",winner:"WaveofShadow",score:"2-1",reportedAt:hn(112)},{eventId:At,round:3,playerA:"Noya",playerB:"Oophies",winner:"Noya",score:"2-0",reportedAt:hn(104)},{eventId:At,round:3,playerA:"Elfandor",playerB:"adoodwithgood",
490winner:"Elfandor",score:"2-1",reportedAt:hn(111)},{eventId:At,round:3,playerA:"flutterdev",playerB:"Lark",winner:"flutterdev",score:"2-1",reportedAt:hn(108)}],replays:kH()};function jH(e){return`0000000000000000000000000000${e.toString(16).padStart(4,"0")}`.slice(-32)}function rt(e,t,s,r,a,o,i,l,c){const d=jH(r);return{eventId:At,eventName:wE,eventDate:jE,setCode:"SOS",playerId:e,playerSlug:t,playerDisplayName:s,gameId:d,link:`https://www.17lands.com/user/game_replay/20260514/${d}/0`,gameTime:kE(a),won:o,turns:i,onPlay:l,inferredRound:c}}function kE(e){const t=new Date("2026-05-14T20:00:00Z").getTime();return new Date(t+e*6e4).toISOString()}function hn(e){return kE(e)}function qi(e,t){const s=`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 900 600' preserveAspectRatio='xMidYMid slice'>
491<rect width='900' height='600' fill='#14181f'/>
492<rect x='12' y='12' width='876' height='576' fill='none' stroke='#2a3142' stroke-width='2'/>
493<text x='450' y='270' fill='#e6ecf5' font-family='Bebas Neue, sans-serif' font-size='80' text-anchor='middle' letter-spacing='6'>${e}</text>
494<text x='450' y='340' fill='#7a8395' font-family='Bebas Neue, sans-serif' font-size='32' text-anchor='middle' letter-spacing='8'>${t} · SOS POD #3</text>
495<text x='450' y='420' fill='#4a5163' font-family='Space Grotesk, sans-serif' font-size='16' text-anchor='middle'>fixture deck screenshot — discord image url in production</text>
496</svg>`;return"data:image/svg+xml;utf8,"+encodeURIComponent(s)}function kH(){const e=[];let t=1;return e.push(rt(Ge.noya.id,"noya","Noya",t++,5,!0,9,!1,1)),e.push(rt(Ge.noya.id,"noya","Noya",t++,14,!1,10,!0,1)),e.push(rt(Ge.noya.id,"noya","Noya",t++,23,!0,12,!1,1)),e.push(rt(Ge.noya.id,"noya","Noya",t++,47,!0,11,!0,2)),e.push(rt(Ge.noya.id,"noya","Noya",t++,56,!1,14,!1,2)),e.push(rt(Ge.noya.id,"noya","Noya",t++,66,!1,8,!1,2)),e.push(rt(Ge.noya.id,"noya","Noya",t++,92,!0,7,!0,3)),e.push(rt(Ge.noya.id,"noya","Noya",t++,100,!0,13,!0,3)),e.push(rt(Ge.noya.id,"noya","Noya",t++,115,!0,9,!1,null)),e.push(rt(Ge.wave.id,"waveofshadow","WaveofShadow",t++,4,!0,6,!0,1)),e.push(rt(Ge.wave.id,"waveofshadow","WaveofShadow",t++,11,!0,8,!1,1)),e.push(rt(Ge.wave.id,"waveofshadow","WaveofShadow",t++,45,!1,11,!1,2)),e.push(rt(Ge.wave.id,"waveofshadow","WaveofShadow",t++,56,!0,14,!0,2)),e.push(rt(Ge.wave.id,"waveofshadow","WaveofShadow",t++,65,!0,8,!0,2)),e.push(rt(Ge.wave.id,"waveofshadow","WaveofShadow",t++,90,!0,13,!1,3)),e.push(rt(Ge.wave.id,"waveofshadow","WaveofShadow",t++,108,!0,7,!0,3)),e.push(rt(Ge.elfandor.id,"elfandor","Elfandor",t++,5,!1,9,!0,1)),e.push(rt(Ge.elfandor.id,"elfandor","Elfandor",t++,14,!0,10,!1,1)),e.push(rt(Ge.elfandor.id,"elfandor","Elfandor",t++,23,!1,12,!0,1)),e.push(rt(Ge.elfandor.id,"elfandor","Elfandor",t++,49,!0,6,!0,2)),e.push(rt(Ge.elfandor.id,"elfandor","Elfandor",t++,58,!0,11,!1,2)),e.push(rt(Ge.elfandor.id,"elfandor","Elfandor",t++,95,!0,9,!1,null)),e.push(rt(Ge.elfandor.id,"elfandor","Elfandor",t++,107,!1,10,!0,null)),e.push(rt(Ge.oophies.id,"oophies","Oophies",t++,6,!0,8,!0,1)),e.push(rt(Ge.oophies.id,"oophies","Oophies",t++,15,!1,13,!1,1)),e.push(rt(Ge.oophies.id,"oophies","Oophies",t++,24,!0,7,!0,1)),e.push(rt(Ge.oophies.id,"oophies","Oophies",t++,50,!0,9,!1,2)),e.push(rt(Ge.oophies.id,"oophies","Oophies",t++,59,!1,11,!0,2)),e.push(rt(Ge.oophies.id,"oophies","Oophies",t++,68,!1,14,!1,2)),e.push(rt(Ge.oophies.id,"oophies","Oophies",t++,92,!1,7,!1,3)),e.push(rt(Ge.oophies.id,"oophies","Oophies",t++,101,!1,13,!1,3)),e.push(rt(Ge.oophies.id,"oophies","Oophies",t++,118,!0,8,!0,null)),e}function Im(e){return{eventId:e.eventId,displayName:e.displayName,draftmancerName:e.displayName,seatIndex:e.seatIndex,placement:e.placement??null,record:e.record,deckColors:e.deckColors,deckScreenshotUrl:e.deckScreenshotUrl,deckScreenshotCaption:e.deckScreenshotCaption,playerSlug:e.slug,playerDisplayName:e.displayName,avatarUrl:null}}function av(){const e=Nt.participants.find(t=>t.placement===1);return{eventId:Nt.id,slug:Nt.slug,name:Nt.name,setCode:Nt.setCode,kind:"tournament",eventDate:Nt.date,eventTime:`${Nt.date}T20:00:00Z`,formatLabel:Nt.formatLabel,totalRounds:Nt.totalRounds,championPlayerSlug:(e==null?void 0:e.slug)??null,championDisplayName:(e==null?void 0:e.displayName)??null,championAvatarUrl:null,championDeckColors:(e==null?void 0:e.deckColors)??null,championRecord:(e==null?void 0:e.record)??null,participantCount:Nt.participants.length,isFinalized:Nt.participants.every(t=>t.placement!=null)}}const SH=[{eventId:"mock-sos-mock-1",slug:"sos-mock-draft-1",name:"SOS Mock Draft 1",setCode:"SOS",kind:"mock",eventDate:"2026-05-21",eventTime:"2026-05-21T20:00:00Z",formatLabel:null,totalRounds:0,championPlayerSlug:null,championDisplayName:null,championAvatarUrl:null,championDeckColors:null,championRecord:null,participantCount:8,isFinalized:!0},{eventId:"mock-sos-4",slug:"sos-pod-draft-4",name:"SOS Pod Draft #4",setCode:"SOS",kind:"tournament",eventDate:"2026-05-20",eventTime:"2026-05-20T20:00:00Z",formatLabel:"Pod Draft · Swiss · 3 Rounds",totalRounds:3,championPlayerSlug:null,championDisplayName:null,championAvatarUrl:null,championDeckColors:null,championRecord:null,participantCount:0,isFinalized:!1},{eventId:"mock-sos-2",slug:"sos-pod-draft-2",name:"SOS Pod Draft #2",setCode:"SOS",kind:"tournament",eventDate:"2026-05-07",eventTime:"2026-05-07T20:00:00Z",formatLabel:"Pod Draft · Swiss · 3 Rounds",totalRounds:3,championPlayerSlug:"elfandor",championDisplayName:"Elfandor",championAvatarUrl:null,championDeckColors:"WR",championRecord:"3-0",participantCount:8,isFinalized:!0},{eventId:"mock-sos-1",slug:"sos-pod-draft-1",name:"SOS Pod Draft #1",setCode:"SOS",kind:"tournament",eventDate:"2026-04-30",eventTime:"2026-04-30T20:00:00Z",formatLabel:"Pod Draft · Swiss · 3 Rounds",totalRounds:3,championPlayerSlug:"noya",championDisplayName:"Noya",championAvatarUrl:null,championDeckColors:"WU",championRecord:"3-0",participantCount:8,isFinalized:!0}],ov="mock-peasant-1",SE="Peasant Cube Pod Draft #1",NH=[{...av(),eventId:ov,slug:"peasant-cube-pod-draft-1",name:SE,setCode:"PEASANT",eventDate:"2026-05-22",eventTime:"2026-05-22T20:00:00Z",formatLabel:"Peasant Cube"},{eventId:"mock-peasant-2",slug:"peasant-cube-pod-draft-2",name:"Peasant Cube Pod Draft #2",setCode:"PEASANT",kind:"tournament",eventDate:"2026-05-29",eventTime:"2026-05-29T20:00:00Z",formatLabel:"Peasant Cube",totalRounds:3,championPlayerSlug:null,championDisplayName:null,championAvatarUrl:null,championDeckColors:null,championRecord:null,participantCount:0,isFinalized:!1}],CH=Nt.participants.map(e=>({...Im(e),eventId:ov})),_H=Nt.matches.map(e=>({eventId:ov,eventName:SE,round:e.round,playerAName:e.playerA,playerBName:e.playerB,winnerName:e.winner,score:e.score,reportedAt:e.reportedAt})),iv="mock-mema-1",NE="Middle-Earth Masters Pod Draft #1",TH=[{...av(),eventId:iv,slug:"middle-earth-masters-pod-draft-1",name:NE,setCode:"MEMA",eventDate:"2026-09-04",eventTime:"2026-09-04T20:00:00Z",formatLabel:"Middle-Earth Masters"}],EH=Nt.participants.map(e=>({...Im(e),eventId:iv})),RH=Nt.matches.map(e=>({eventId:iv,eventName:NE,round:e.round,playerAName:e.playerA,playerBName:e.playerB,winnerName:e.winner,score:e.score,reportedAt:e.reportedAt}
496)),Mm=[av(),...SH,...NH,...TH],P1=Nt.participants.map((e,t)=>({...Im(e),eventId:"mock-sos-mock-1",seatIndex:t,placement:null,record:null})),CE=[...Nt.participants.map(Im),...CH,...EH,...P1],AH=[{n:"Galvanic Discharge",cn:"131",s:"sos",r:"common",c:["R"],cmc:1,type:"Instant"},{n:"Iridescent Vinelasher",cn:"98",s:"sos",r:"uncommon",c:["G"],cmc:2,type:"Creature"},{n:"Sentinel of the Nameless City",cn:"201",s:"sos",r:"rare",c:["G"],cmc:3,type:"Creature"},{n:"Heated Argument",cn:"118",s:"sos",r:"common",c:["R"],cmc:3,type:"Instant"},{n:"Wystan, Trinket Trapper",cn:"224",s:"sos",r:"rare",c:["R","G"],cmc:4,type:"Creature"},{n:"Drakeskin Construct",cn:"247",s:"sos",r:"common",c:[],cmc:5,type:"Artifact Creature"},{n:"Mountain",cn:"279",s:"sos",r:"common",c:[],cmc:0,type:"Basic Land"},{n:"Forest",cn:"281",s:"sos",r:"common",c:[],cmc:0,type:"Basic Land"}],PH={"mock-sos-mock-1":{v:2,set:"sos",seats:P1.map(e=>e.draftmancerName??e.displayName),cards:AH,packs:[],picks:[],decks:P1.map((e,t)=>t===0?{main:[0,1,1,2,3,4,5,6,7],side:[2,3,5]}:{main:[],side:[]})}},OH=[{round:1,playerAName:"Noya",playerBName:"Elfandor",winnerName:"Noya",score:"2-1"},{round:1,playerAName:"WaveofShadow",playerBName:"flutterdev",winnerName:"WaveofShadow",score:"2-0"},{round:1,playerAName:"Oophies",playerBName:"adoodwithgood",winnerName:"Oophies",score:"2-1"},{round:1,playerAName:"samp",playerBName:"Lark",winnerName:"samp",score:"2-0"},{round:2,playerAName:"WaveofShadow",playerBName:"Noya",winnerName:"WaveofShadow",score:"2-1"},{round:2,playerAName:"samp",playerBName:"Oophies",winnerName:null,score:null},{round:2,playerAName:"Elfandor",playerBName:"flutterdev",winnerName:null,score:null},{round:2,playerAName:"adoodwithgood",playerBName:"Lark",winnerName:null,score:null}].map(e=>({...e,eventId:"mock-sos-4",eventName:"SOS Pod Draft #4",reportedAt:null})),LH=[...Nt.matches.map(e=>({eventId:e.eventId,eventName:Nt.name,round:e.round,playerAName:e.playerA,playerBName:e.playerB,winnerName:e.winner,score:e.score,reportedAt:e.reportedAt})),..._H,...RH,...OH],DH=Nt.replays.map(e=>({eventId:e.eventId,eventName:e.eventName,eventDate:e.eventDate,setCode:e.setCode,playerId:e.playerId,playerSlug:e.playerSlug,playerDisplayName:e.playerDisplayName,gameId:e.gameId,link:e.link,gameTime:e.gameTime,won:e.won,turns:e.turns,onPlay:e.onPlay,inferredRound:e.inferredRound}));function eg(e){return Nt.participants.map(t=>{const s=Number(t.record.split("-")[0]||0),r=Number(t.record.split("-")[1]||0);return{setCode:e,slug:t.slug,displayName:t.displayName,avatarUrl:null,events:1,wins:s,losses:r,trophies:s>=Sc?1:0,lastFinishedAt:`${Nt.date}T22:00:00Z`}})}[...eg(Nt.setCode),...eg("PEASANT"),...eg("MEMA")];const IH=[{code:"SOS",label:null,events:3,mocks:1},{code:"MSH",label:null,events:3,mocks:0},{code:"PEASANT",label:"Peasant Cube",events:2,mocks:0},{code:"MEMA",label:"Middle-Earth Masters",events:2,mocks:0}],MH=[{code:"SOS",name:"Secrets of Strixhaven",startDate:"2026-04-21",endDate:"2026-06-22",isActive:!0,lastRefreshedAt:"2026-05-08T01:43:21Z"},{code:"ECL",name:"Lorwyn Eclipsed",startDate:"2026-01-20",endDate:"2026-04-20",isActive:!1,lastRefreshedAt:"2026-04-20T18:00:00Z"},{code:"TLA",name:"Avatar: The Last Airbender",startDate:"2025-11-18",endDate:"2026-01-19",isActive:!1,lastRefreshedAt:"2026-01-19T18:00:00Z"},{code:"FIN",name:"Final Fantasy",startDate:"2025-06-10",endDate:"2025-11-17",isActive:!1,lastRefreshedAt:"2025-11-17T18:00:00Z"}],tr=(e,t,s,r,a,o,i,l,c,d,u,f,h,m)=>({set_code:"PEASANT",season:e,card_name:t,card_set:s,colors:r,rarity:a,cmc:o,type_line:i,seen_count:l,last_seen_sum:Math.round(c*d),saw_count:d,pick_count:d,pick_sum:Math.round(u*d),maindeck_count:f,drafts:d,game_count:h,game_wins:m}),$H=[tr("SOS","Lightning Bolt","2xm","R","common",1,"Instant",142,2.1,41,1.6,40,118,72),tr("SOS","Counterspell","mh2","U","common",2,"Instant",130,3.4,38,2.7,35,101,56),tr("SOS","Llanowar Elves","dom","G","common",1,"Creature — Elf Druid",118,4.8,33,3.9,30,88,46),tr("SOS","Man-o'-War","tpr","U","common",3,"Creature — Jellyfish",109,3.1,36,2.4,34,95,54),tr("MSH","Fire // Ice","apc","UR","uncommon",2,"Instant // Instant",96,3.8,29,3,26,74,40),tr("MSH","Kor Skyfisher","znr","W","common",2,"Creature — Kor Soldier",88,5.5,24,4.6,21,60,29),tr("MSH","Gray Merchant of Asphodel","ths","B","common",5,"Creature — Zombie",77,4.2,22,3.3,20,55,35),tr("HOB","Prophetic Prism","c16","","common",2,"Artifact",71,7.9,15,7.1,11,30,14),tr("HOB","Evolving Wilds","m21","","common",0,"Land",64,8.4,12,7.8,12,33,17),tr("HOB","Mulldrifter","mm2","U","common",5,"Creature — Elemental",58,2.9,20,2.2,19,52,31)],Gs=(e,t,s,r,a)=>({set_code:"PEASANT",season:e,deck_colors:t,decks:s,game_wins:r,games:a}),UH=[Gs("SOS","WU",34,118,210),Gs("MSH","WUb",6,22,40),Gs("SOS","UB",41,150,262),Gs("SOS","BR",38,132,240),Gs("MSH","RG",29,96,188),Gs("MSH","GW",27,84,176),Gs("HOB","WB",22,71,140),Gs("HOB","UR",25,79,158),Gs("HOB","BG",19,58,120),Gs("SOS","WR",16,44,100),Gs("MSH","UG",14,40,92),Gs("HOB","WUB",7,20,48),Gs("SOS","R",4,9,22)],Li=[{setCode:"SOS",slug:"nlaframboise",displayName:"nlaframboise",avatarUrl:"https://cdn.discordapp.com/avatars/800913004828426240/e5878db7301dd69453814ed435506615.png?size=128",rank:1,score:111.66,trophies:34,events:88,wins:184,losses:73,last
496CalculatedAt:"2026-05-08T01:41:42Z"},{setCode:"SOS",slug:"elfandor",displayName:"Elfandor",avatarUrl:"https://cdn.discordapp.com/avatars/174254906566246401/75cdf8e13d21480dcde2230f4b9cc017.png?size=128",rank:2,score:69.25,trophies:30,events:108,wins:431,losses:222,lastCalculatedAt:"2026-05-08T01:41:22Z"},{setCode:"SOS",slug:"flutterdev",displayName:"flutterdev",avatarUrl:"https://cdn.discordapp.com/avatars/1085562885763244083/3c03e7bd8ab3bd7063d1a36ef84e074a.png?size=128",rank:3,score:68.61,trophies:19,events:47,wins:221,losses:92,lastCalculatedAt:"2026-05-08T01:42:29Z"},{setCode:"SOS",slug:"oophies",displayName:"Oophies",avatarUrl:"https://cdn.discordapp.com/avatars/617025164432900096/b3cc5ac42ea4af870ba523aef5efe501.png?size=128",rank:4,score:66.37,trophies:23,events:66,wins:140,losses:55,lastCalculatedAt:"2026-05-08T01:42:20Z"},{setCode:"SOS",slug:"adoodwithgood",displayName:"adoodwithgood",avatarUrl:"https://cdn.discordapp.com/avatars/647458921115549706/aea394781449f1bd5ca5655a225a34ba.png?size=128",rank:5,score:52.77,trophies:17,events:49,wins:228,losses:124,lastCalculatedAt:"2026-05-08T01:42:13Z"},{setCode:"SOS",slug:"lark",displayName:"Lark",avatarUrl:"https://cdn.discordapp.com/avatars/155421761012367360/66e757b392c51bdd69f51596a1015d19.png?size=128",rank:6,score:48.82,trophies:13,events:30,wins:142,losses:68,lastCalculatedAt:"2026-05-08T01:41:54Z"},{setCode:"SOS",slug:"neo-marc",displayName:"Neo (Marc)",avatarUrl:"https://cdn.discordapp.com/avatars/683425746290475027/30857c473838ba4b97064d042167f6af.png?size=128",rank:7,score:44.08,trophies:12,events:28,wins:138,losses:64,lastCalculatedAt:"2026-05-08T01:41:51Z"},{setCode:"SOS",slug:"samp",displayName:"samp",avatarUrl:"https://cdn.discordapp.com/avatars/207746375725613056/5d0c151e63008cc91d4ea6c8be54fab0.png?size=128",rank:8,score:32.05,trophies:10,events:26,wins:118,losses:66,lastCalculatedAt:"2026-05-08T01:41:14Z"},{setCode:"SOS",slug:"has510",displayName:"HAS510",avatarUrl:"https://cdn.discordapp.com/avatars/755548393295708250/f71f874aedc29fdc9d4480cfa95f1833.png?size=128",rank:9,score:31.83,trophies:20,events:86,wins:312,losses:189,lastCalculatedAt:"2026-05-08T01:43:12Z"},{setCode:"SOS",slug:"chonce",displayName:"Chonce",avatarUrl:"https://cdn.discordapp.com/avatars/149006398460526592/01d9a0659bc54c88e39483a019055dfb.png?size=128",rank:10,score:28.39,trophies:12,events:49,wins:139,losses:91,lastCalculatedAt:"2026-05-08T01:41:31Z"},{setCode:"SOS",slug:"dotnoppler",displayName:"dotnoppler",avatarUrl:"https://cdn.discordapp.com/avatars/251008420453416970/bc76d00201925b023f550655bea29adc.png?size=128",rank:11,score:27.22,trophies:7,events:27,wins:100,losses:54,lastCalculatedAt:"2026-05-08T01:43:18Z"},{setCode:"SOS",slug:"arcyl",displayName:"Arcyl",avatarUrl:"https://cdn.discordapp.com/avatars/803309103983362069/047b875ef0b7bb2c95d10cbb957ca86f.png?size=128",rank:12,score:26.1,trophies:14,events:38,wins:128,losses:60,lastCalculatedAt:"2026-05-08T01:41:46Z"},{setCode:"SOS",slug:"jimbo",displayName:"jimbo",avatarUrl:null,rank:13,score:24.85,trophies:15,events:70,wins:269,losses:177,lastCalculatedAt:"2026-05-08T01:42:04Z"},{setCode:"SOS",slug:"turbotuli",displayName:"turbotuli",avatarUrl:null,rank:14,score:23.67,trophies:9,events:29,wins:134,losses:67,lastCalculatedAt:"2026-05-08T01:43:21Z"},{setCode:"SOS",slug:"narwhalrus",displayName:"Narwhalrus",avatarUrl:"https://cdn.discordapp.com/avatars/282730033783635968/b86877b0f8b7ba2a52249119a32b710c.png?size=128",rank:15,score:20.88,trophies:8,events:20,wins:86,losses:45,lastCalculatedAt:"2026-05-08T01:43:14Z"},{setCode:"SOS",slug:"jonnydeewsc",displayName:"JonnyDeeWSC",avatarUrl:"https://cdn.discordapp.com/avatars/386597445708021770/6d63067b6ebc445aec4b97b274b72106.png?size=128",rank:16,score:19.69,trophies:14,events:69,wins:204,losses:125,lastCalculatedAt:"2026-05-08T01:43:03Z"},{setCode:"SOS",slug:"linda",displayName:"Linda",avatarUrl:"https://cdn.discordapp.com/avatars/1107741208807215124/927406a3c8ad434db0653d062983b163.png?size=128",rank:17,score:16,trophies:6,events:13,wins:52,losses:15,lastCalculatedAt:"2026-05-08T01:42:53Z"},{setCode:"SOS",slug:"doublexposure",displayName:"Doublexposure",avatarUrl:"https://cdn.discordapp.com/avatars/173532575053250560/9766a6ba8598600f888a026b87579cd6.png?size=128",rank:18,score:15.54,trophies:7,events:21,wins:81,losses:46,lastCalculatedAt:"2026-05-08T01:42:36Z"},{setCode:"SOS",slug:"whalematron",displayName:"whalematron",avatarUrl:"https://cdn.discordapp.com/avatars/212396489740124162/c4a7a3108736356063cca7dc0a8769fb.png?size=128",rank:19,score:14.78,trophies:13,events:76,wins:247,losses:174,lastCalculatedAt:"2026-05-08T01:41:07Z"},{setCode:"SOS",slug:"springbok7",displayName:"springbok7",avatarUrl:"https://cdn.discordapp.com/avatars/299587692683984910/1c6bfdd8393b9a3e3b1848f7e7778a0f.png?size=128",rank:20,score:13.84,trophies:8,events:37,wins:153,losses:95,lastCalculatedAt:"2026-05-08T01:42:47Z"},{setCode:"SOS",slug:"davidc",displayName:"davidc",avatarUrl:"https://cdn.discordapp.com/avatars/1462881327635370243/f98f808d890e70fbef0562ab52b7cf0f.png?size=128",rank:21,score:13.61,trophies:7,events:29,wins:120,losses:75,lastCalculatedAt:"2026-05-08T01:42:56Z"},{setCode:"SOS",slug:"klarmdurnduul",displayName:"klarmdurnduul",avatarUrl:"https://cdn.discordapp.com/avatars/696135865545523302/81d3196b527c211c4267fdffe8d3693e.png?size=128",rank:22,score:13.58,trophies:6,events:19,wins:61,losses:36,lastCalculatedAt:"2026-05-08T01:42:58Z"},{setCode:"SOS",slug:"bigmits",displayName:"Bigmits",avatarUrl:"https://cdn.discordapp.com/avatars/117444521926721536/318b4c0d50da9d2a05c768b822b51cb2.png?size=128",rank:23,score:13.5,trophies:6,events:24,wins:91,losses:52,lastCalculatedAt:"2026-05-08T01:42:44Z"},{setCode:"SOS",slug:"giya",displayName:"giya",avatarUrl:"https://cdn.discordapp.com/avatars/412719562165977098/76357658a93d111af3f790c22291256a.png?size=128",rank:24,score:12.27,trophies:6,events:22,wins:93,losses:56,lastCalculatedAt:"2026-05-08T01:42:42Z"},{setCode:"SOS",slug:"lemontea",displayName:"LemonTea",avatarUrl:"https://cdn.discordapp.com/avatars/156573929455091723/61d8671cc566fa02ae6813f8f8356654.png?size=128",rank:25,score:11.74,trophies:6,events:23,wins:82,losses:55,lastCalculatedAt:"2026-05-08T01:41:26Z"},{setCode:"SOS",slug:"lorddawan",displayName:"LordDawan",avatarUrl:null,rank:26,score:11.17,trophies:4,events:7,wins:27,losses:9,lastCalculatedAt:"2026-05-08T01:42:34Z"},{setCode:"SOS",slug:"ranazura",displayName:"raNazUra",avatarUrl:null,rank:27,score:9.19,trophies:5,events:19,wins:76,losses:39,lastCalculatedAt:"2026-05-08T01:43:06Z"},{setCode:"SOS",slug:"waveofshadow",displayName:"WaveofShadow",avatarUrl:"https://cdn.discordapp.com/avatars/136027541545680896/1cb6d09b305023bcde216a1e1d2b1a8b.png?size=128",rank:28,score:9,trophies:5,events:17,wins:67,losses:35,lastCalculatedAt:"2026-05-08T01:41:36Z"},{setCode:"SOS",slug:"jdnewland",displayName:"jdnewland",avatarUrl:"https://cdn.discordapp.com/avatars/472403862733455361/c440b9e8e1e786950af1594ad1e8074d.png?size=128",rank:29,score:8.93,trophies:8,events:41,wins:149,losses:104,lastCalculatedAt:"2026-05-08T01:41:57Z"},{setCode:"SOS",slug:"dado",displayName:"dado",avatarUrl:"https://cdn.discordapp.com/avatars/102005190256787456/8475494a0e2af28108150b592561e40a.png?size=128",rank:30,score:7.44,trophies:5,events:24,wins:99,losses:62,lastCalculatedAt:"2026-05-08T09:26:31Z"},{setCode:"SOS",slug:"luke-lukkentopia",displayName:"Luke (lukkentopia)",avatarUrl:"https://cdn.discordapp.com/avatars/447084840253128715/3a2058270e6673d1f5fba987ea8fc274.png?size=128",rank:31,score:6,trophies:5,events:19,wins:36,losses:29,lastCalculatedAt:"2026-05-08T01:42:52Z"},{setCode:"SOS",slug:"niamhistired",displayName:"NiamhIsTired",avatarUrl:"https://cdn.discordapp.com/avatars/279816635924086794/4578296
496a85ae9331e2a8c0bcdfcd8e01.png?size=128",rank:32,score:5.39,trophies:5,events:34,wins:65,losses:66,lastCalculatedAt:"2026-05-08T01:42:39Z"},{setCode:"SOS",slug:"anonymosity",displayName:"Anonymosity",avatarUrl:"https://cdn.discordapp.com/avatars/831197697469579315/de12dc172c473e9e3b2e95d61fc7fd2b.png?size=128",rank:33,score:5.17,trophies:5,events:27,wins:82,losses:51,lastCalculatedAt:"2026-05-08T01:42:09Z"},{setCode:"SOS",slug:"hagoromochalk",displayName:"HagoromoChalk",avatarUrl:"https://cdn.discordapp.com/avatars/251539925546041347/c40277be88ebd4f27ea89c7b313b4184.png?size=128",rank:34,score:4.85,trophies:4,events:22,wins:92,losses:60,lastCalculatedAt:"2026-05-08T01:41:59Z"},{setCode:"SOS",slug:"gatodelfuego",displayName:"GatoDelFuego",avatarUrl:"https://cdn.discordapp.com/avatars/178987550780817408/097e20f729e2eda59a12b7e9e975cba8.png?size=128",rank:35,score:4.85,trophies:4,events:22,wins:82,losses:58,lastCalculatedAt:"2026-05-08T01:42:31Z"},{setCode:"SOS",slug:"lame4fame",displayName:"Lame4Fame",avatarUrl:"https://cdn.discordapp.com/avatars/660983107242950715/7c060cd35cc01591638fe600aae7e65b.png?size=128",rank:36,score:4.1,trophies:4,events:26,wins:114,losses:71,lastCalculatedAt:"2026-05-08T01:41:24Z"},{setCode:"SOS",slug:"rocketman",displayName:"rocketman",avatarUrl:"https://cdn.discordapp.com/avatars/241654147257073674/0e9d6296d61ab9e2db2e9b18a1503446.png?size=128",rank:37,score:4.03,trophies:5,events:32,wins:124,losses:67,lastCalculatedAt:"2026-05-08T01:41:48Z"},{setCode:"SOS",slug:"bacchus",displayName:"Bacchus",avatarUrl:"https://cdn.discordapp.com/avatars/1157297640569065525/461a433557ca4ef99819a6107328e2d6.png?size=128",rank:38,score:3.9,trophies:4,events:24,wins:64,losses:56,lastCalculatedAt:"2026-05-08T01:42:25Z"},{setCode:"SOS",slug:"goat",displayName:"Goat",avatarUrl:"https://cdn.discordapp.com/avatars/271132049971085314/08b4bf65374217c07237d9a21c3e6aa6.png?size=128",rank:39,score:2.62,trophies:5,events:38,wins:89,losses:55,lastCalculatedAt:"2026-05-08T01:41:34Z"},{setCode:"SOS",slug:"tang",displayName:"tang",avatarUrl:"https://cdn.discordapp.com/avatars/307495881068773376/f0d6f8dd201a3a8a78f3e310064d71dd.png?size=128",rank:40,score:2.22,trophies:2,events:11,wins:40,losses:28,lastCalculatedAt:"2026-05-08T01:42:49Z"},{setCode:"SOS",slug:"mike-provencher",displayName:"Mike Provencher",avatarUrl:"https://cdn.discordapp.com/avatars/409228035678535693/27dd1afec73729e68efe868617d351f3.png?size=128",rank:41,score:1.94,trophies:2,events:21,wins:51,losses:52,lastCalculatedAt:"2026-05-08T01:41:12Z"},{setCode:"SOS",slug:"noya",displayName:"Noya",avatarUrl:"https://cdn.discordapp.com/avatars/237762740532412416/b7732081ac2dbcd2f81fec09c4548cf2.png?size=128",rank:42,score:1.88,trophies:3,events:21,wins:52,losses:39,lastCalculatedAt:"2026-05-08T01:41:09Z"},{setCode:"SOS",slug:"bogdanbravad",displayName:"BogdanBravad",avatarUrl:"https://cdn.discordapp.com/avatars/196690060635144192/9a14ecc85f5a12b066c4a71254fe17d9.png?size=128",rank:43,score:1.41,trophies:2,events:12,wins:32,losses:17,lastCalculatedAt:"2026-05-08T01:43:16Z"},{setCode:"SOS",slug:"consolas",displayName:"Consolas",avatarUrl:"https://cdn.discordapp.com/avatars/696414603764301985/632cd06bbc84d34c14341913f4f940c3.png?size=128",rank:44,score:.89,trophies:1,events:14,wins:44,losses:39,lastCalculatedAt:"2026-05-08T01:42:22Z"},{setCode:"SOS",slug:"terasu",displayName:"Terasu",avatarUrl:"https://cdn.discordapp.com/avatars/231572738756575243/2078da32f2715738be920bcd419a5f63.png?size=128",rank:45,score:.67,trophies:1,events:5,wins:24,losses:12,lastCalculatedAt:"2026-05-08T15:10:57Z"},{setCode:"SOS",slug:"stacy",displayName:"stacy",avatarUrl:"https://cdn.discordapp.com/avatars/473339104919289857/23d31de235f29f07533732ac15299253.png?size=128",rank:46,score:.56,trophies:1,events:6,wins:27,losses:17,lastCalculatedAt:"2026-05-08T01:42:15Z"},{setCode:"SOS",slug:"tim17",displayName:"Tim17",avatarUrl:"https://cdn.discordapp.com/avatars/191610979308666882/b91a271d62fcb2fe6f9fbb1cf33deae0.png?size=128",rank:47,score:.3,trophies:1,events:18,wins:51,losses:39,lastCalculatedAt:"2026-05-08T01:42:06Z"}
496,{setCode:"SOS",slug:"yerawizardeffie",displayName:"yerawizardeffie",avatarUrl:"https://cdn.discordapp.com/avatars/1495218264295346257/2d7da151f21c95ad95dd253af6d6c177.png?size=128",rank:48,score:0,trophies:0,events:15,wins:43,losses:43,lastCalculatedAt:"2026-05-08T01:42:33Z"}],zH=[{slug:"mull2five",displayName:"mull2five",avatarUrl:null,trophies:41},{slug:"paperjack",displayName:"paperjack",avatarUrl:null,trophies:7},{slug:"lark",displayName:"Lark",avatarUrl:null,trophies:4},{slug:"dado",displayName:"dado",avatarUrl:null,trophies:3}],_E=(e,t,s)=>{const r=new Map(e.map(o=>[o.slug,{...o}]));for(const o of t){if(o.trophies===0)continue;const i=r.get(o.slug);i?i.trophies+=o.trophies:r.set(o.slug,{setCode:s,slug:o.slug,displayName:o.displayName,avatarUrl:o.avatarUrl,rank:0,score:0,trophies:o.trophies,events:0,wins:0,losses:0,lastCalculatedAt:new Date(0).toISOString()})}let a=0;return[...r.values()].sort((o,i)=>i.score!==o.score?i.score-o.score:o.displayName.localeCompare(i.displayName)).map(o=>o.score===0?{...o,rank:0}:(a+=1,{...o,rank:a}))};let BH=0;const FH=e=>{const[t,s]=e.split("-").map(r=>Number(r)||0);return t>=7||t>0&&s===0},ws=(e,t,s,r)=>({setCode:e,record:s,isTrophy:FH(s),colors:t,platform:"MTGO",format:null,caption:null,screenshotUrl:null,sourceChannelId:"0",sourceMessageId:String(++BH),sourceUrl:"#",reportedAt:r}),Qf=e=>[...e].sort((t,s)=>s.trophies-t.trophies||s.deckCount-t.deckCount||s.decks[0].reportedAt.localeCompare(t.decks[0].reportedAt)).map((t,s)=>({...t,rank:s+1})),sr=(e,t,s,r)=>({setCode:e,slug:t,displayName:s,avatarUrl:null,trophies:r.filter(a=>a.isTrophy).length,deckCount:r.length,decks:r}),WH={MH1:Qf([sr("MH1","sythe","Sythe",[ws("MH1","UR","3-0","2026-06-20T14:00:00Z"),ws("MH1","WUb","3-1","2026-06-14T14:00:00Z"),ws("MH1","BG","3-0","2026-06-02T14:00:00Z")]),sr("MH1","orlok","Orlok",[ws("MH1","BR","3-0","2026-06-18T14:00:00Z"),ws("MH1","WU","3-2","2026-06-09T14:00:00Z")]),sr("MH1","vessa","Vessa",[ws("MH1","WUBRG","3-1","2026-06-11T14:00:00Z")])]),MH2:Qf([sr("MH2","orlok","Orlok",[ws("MH2","UG","3-0","2026-06-22T14:00:00Z"),ws("MH2","Rw","3-0","2026-06-15T14:00:00Z")]),sr("MH2","kaldo","Kaldo",[ws("MH2","WB","3-1","2026-06-19T14:00:00Z")]),sr("MH2","sythe","Sythe",[ws("MH2","BR","3-0","2026-06-08T14:00:00Z")])]),USG:Qf([sr("USG","brenn","Brenn",[ws("USG","UB","3-0","2026-06-21T14:00:00Z"),ws("USG","WG","3-1","2026-06-10T14:00:00Z")]),sr("USG","vessa","Vessa",[ws("USG","UR","3-0","2026-06-17T14:00:00Z")])]),IPA:Qf([sr("IPA","kaldo","Kaldo",[ws("IPA","WUBRG","3-1","2026-06-16T14:00:00Z")]),sr("IPA","brenn","Brenn",[ws("IPA","BR","3-0","2026-06-05T14:00:00Z")])])},O1=[{setCode:"SOS",colors:"WR",slug:"nlaframboise",displayName:"nlaframboise",avatarUrl:null,rank:1,score:26.55,trophies:12,events:28,wins:67,losses:16,lastCalculatedAt:"2026-05-08T01:41:42Z"},{setCode:"SOS",colors:"WR",slug:"elfandor",displayName:"Elfandor",avatarUrl:null,rank:2,score:26.25,trophies:11,events:33,wins:156,losses:71,lastCalculatedAt:"2026-05-08T01:41:22Z"},{setCode:"SOS",colors:"WR",slug:"adoodwithgood",displayName:"adoodwithgood",avatarUrl:null,rank:3,score:22.9,trophies:10,events:20,wins:103,losses:45,lastCalculatedAt:"2026-05-08T01:42:13Z"},{setCode:"SOS",colors:"WR",slug:"flutterdev",displayName:"flutterdev",avatarUrl:null,rank:4,score:21,trophies:9,events:21,wins:107,losses:47,lastCalculatedAt:"2026-05-08T01:42:29Z"},{setCode:"SOS",colors:"WR",slug:"oophies",displayName:"Oophies",avatarUrl:null,rank:5,score:17.35,trophies:8,events:11,wins:30,losses:3,lastCalculatedAt:"2026-05-08T01:42:20Z"},{setCode:"SOS",colors:"WR",slug:"jonnydeewsc",displayName:"JonnyDeeWSC",avatarUrl:null,rank:6,score:16.2,trophies:7,events:22,wins:83,losses:39,lastCalculatedAt:"2026-05-08T01:43:03Z"},{setCode:"SOS",colors:"WR",slug:"arcyl",displayName:"Arcyl",avatarUrl:null,rank:7,score:15.45,trophies:7,events:12,wins:46,losses:17,lastCalculatedAt:"2026-05-08T01:41:46Z"},{setCode:"SOS",colors:"WR",slug:"whalematron",displayName:"whalematron",avatarUrl:null,rank:8,score:11.8,trophies:5,events:27,wins:95,losses:59,lastCalculatedAt:"2026-05-08T01:41:07Z"},{setCode:"SOS",colors:"WR",slug:"samp",displayName:"samp",avatarUrl:null,rank:9,score:11.4,trophies:5,events:7,wins:43,losses:15,lastCalculatedAt:"2026-05-08T01:41:14Z"},{setCode:"SOS",colors:"WR",slug:"lark",displayName:"Lark",avatarUrl:null,rank:10,score:9.55,trophies:4,events:8,wins:44,losses:13,lastCalculatedAt:"2026-05-08T01:41:54Z"},{setCode:"SOS",colors:"WR",slug:"neo-marc",displayName:"Neo (Marc)",avatarUrl:null,rank:11,score:9.4,trophies:4,events:7,wins:41,losses:13,lastCalculatedAt:"2026-05-08T01:41:51Z"},{setCode:"SOS",colors:"WR",slug:"davidc",displayName:"davidc",avatarUrl:null,rank:12,score:9.2,trophies:4,events:9,wins:46,losses:22,last
496CalculatedAt:"2026-05-08T01:42:56Z"},{setCode:"SOS",colors:"WR",slug:"narwhalrus",displayName:"Narwhalrus",avatarUrl:null,rank:13,score:8.9,trophies:4,events:5,wins:26,losses:8,lastCalculatedAt:"2026-05-08T01:43:14Z"},{setCode:"SOS",colors:"WR",slug:"jimbo",displayName:"jimbo",avatarUrl:null,rank:14,score:8.85,trophies:4,events:14,wins:52,losses:35,lastCalculatedAt:"2026-05-08T01:42:04Z"},{setCode:"SOS",colors:"WR",slug:"chonce",displayName:"Chonce",avatarUrl:null,rank:15,score:8.65,trophies:4,events:15,wins:42,losses:29,lastCalculatedAt:"2026-05-08T01:41:31Z"},{setCode:"SOS",colors:"WR",slug:"turbotuli",displayName:"turbotuli",avatarUrl:null,rank:16,score:7,trophies:3,events:7,wins:35,losses:15,lastCalculatedAt:"2026-05-08T01:43:21Z"},{setCode:"SOS",colors:"WR",slug:"gatodelfuego",displayName:"GatoDelFuego",avatarUrl:null,rank:17,score:6.75,trophies:3,events:10,wins:39,losses:24,lastCalculatedAt:"2026-05-08T01:42:31Z"},{setCode:"SOS",colors:"WR",slug:"lorddawan",displayName:"LordDawan",avatarUrl:null,rank:18,score:6.6,trophies:3,events:4,wins:18,losses:6,lastCalculatedAt:"2026-05-08T01:42:34Z"},{setCode:"SOS",colors:"WR",slug:"bigmits",displayName:"Bigmits",avatarUrl:null,rank:19,score:4.9,trophies:2,events:10,wins:42,losses:24,lastCalculatedAt:"2026-05-08T01:42:44Z"},{setCode:"SOS",colors:"WR",slug:"has510",displayName:"HAS510",avatarUrl:null,rank:20,score:4.85,trophies:2,events:16,wins:57,losses:40,lastCalculatedAt:"2026-05-08T01:43:12Z"},{setCode:"SOS",colors:"WR",slug:"dotnoppler",displayName:"dotnoppler",avatarUrl:null,rank:21,score:4.8,trophies:2,events:5,wins:27,losses:11,lastCalculatedAt:"2026-05-08T01:43:18Z"},{setCode:"SOS",colors:"WR",slug:"giya",displayName:"giya",avatarUrl:null,rank:22,score:4.8,trophies:2,events:5,wins:28,losses:12,lastCalculatedAt:"2026-05-08T01:42:42Z"},{setCode:"SOS",colors:"WR",slug:"linda",displayName:"Linda",avatarUrl:null,rank:23,score:4.75,trophies:2,events:4,wins:22,losses:7,lastCalculatedAt:"2026-05-08T01:42:53Z"},{setCode:"SOS",colors:"WR",slug:"goat",displayName:"Goat",avatarUrl:null,rank:24,score:4.3,trophies:2,events:6,wins:13,losses:7,lastCalculatedAt:"2026-05-08T01:41:34Z"},{setCode:"SOS",colors:"WR",slug:"lame4fame",displayName:"Lame4Fame",avatarUrl:null,rank:25,score:2.65,trophies:1,events:4,wins:24,losses:11,lastCalculatedAt:"2026-05-08T01:41:24Z"},{setCode:"SOS",colors:"WR",slug:"hagoromochalk",displayName:"HagoromoChalk",avatarUrl:null,rank:26,score:2.5,trophies:1,events:7,wins:30,losses:20,lastCalculatedAt:"2026-05-08T01:41:59Z"},{setCode:"SOS",colors:"WR",slug:"jdnewland",displayName:"jdnewland",avatarUrl:null,rank:27,score:2.5,trophies:1,events:9,wins:36,losses:26,lastCalculatedAt:"2026-05-08T01:41:57Z"},{setCode:"SOS",colors:"WR",slug:"bogdanbravad",displayName:"BogdanBravad",avatarUrl:null,rank:28,score:2.4,trophies:1,events:3,wins:12,losses:4,lastCalculatedAt:"2026-05-08T01:43:16Z"},{setCode:"SOS",colors:"WR",slug:"waveofshadow",displayName:"WaveofShadow",avatarUrl:null,rank:29,score:2.35,trophies:1,events:4,wins:18,losses:11,lastCalculatedAt:"2026-05-08T01:41:36Z"},{setCode:"SOS",colors:"WR",slug:"rocketman",displayName:"rocketman",avatarUrl:null,rank:30,score:2.35,trophies:1,events:8,wins:24,losses:17,lastCalculatedAt:"2026-05-08T01:41:48Z"},{setCode:"SOS",colors:"WR",slug:"ranazura",displayName:"raNazUra",avatarUrl:null,rank:31,score:2.3,trophies:1,events:3,wins:13,losses:7,lastCalculatedAt:"2026-05-08T01:43:06Z"},{setCode:"SOS",colors:"WR",slug:"bacchus",displayName:"Bacchus",avatarUrl:null,rank:32,score:2.3,trophies:1,events:8,wins:24,losses:18,lastCalculatedAt:"2026-05-08T01:42:25Z"},{setCode:"SOS",colors:"WR",slug:"dado",displayName:"dado",avatarUrl:null,rank:33,score:2.3,trophies:1,events:8,wins:29,losses:23,lastCalculatedAt:"2026-05-08T09:26:31Z"},{setCode:"SOS",colors:"WR",slug:"klarmdurnduul",displayName:"klarmdurnduul",avatarUrl:null,rank:34,score:2.2,trophies:1,events:4,wins:15,losses:11,lastCalculatedAt:"2026-05-08T01:42:58Z"},{setCode:"SOS",colors:"WR",slug:"anonymosity",displayName:"Anonymosity",avatarUrl:null,rank:35,score:2.2,trophies:1,events:6,wins:17,losses:13,lastCalculatedAt:"2026-05-08T01:42:09Z"},{setCode:"SOS",colors:"WR",slug:"mike-provencher",displayName:"Mike Provencher",avatarUrl:null,rank:36,score:2.2,trophies:1,events:6,wins:19,losses:15,lastCalculatedAt:"2026-05-08T01:41:12Z"},{setCode:"SOS",colors:"WR",slug:"luke-lukkentopia",displayName:"Luke (lukkentopia)",avatarUrl:null,rank:37,score:2.1,trophies:1,events:4,wins:8,losses:6,lastCalculatedAt:"2026-05-08T01:42:52Z"},{setCode:"SOS",colors:"WR",slug:"doublexposure",displayName:"Doublexposure",avatarUrl:null,rank:38,score:2.1,trophies:1,events:7,wins:20,losses:18,lastCalculatedAt:"2026-05-08T01:42:36Z"},{setCode:"SOS",colors:"WR",slug:"lemontea",displayName:"LemonTea",avatarUrl:null,rank:39,score:1.9,trophies:1,events:7,wins:18,losses:20,lastCalculatedAt:"2026-05-08T01:41:26Z"}
496,{setCode:"SOS",colors:"WR",slug:"yerawizardeffie",displayName:"yerawizardeffie",avatarUrl:null,rank:40,score:0,trophies:0,events:2,wins:7,losses:6,lastCalculatedAt:"2026-05-08T01:42:33Z"},{setCode:"SOS",colors:"WR",slug:"tang",displayName:"tang",avatarUrl:null,rank:41,score:0,trophies:0,events:3,wins:7,losses:7,lastCalculatedAt:"2026-05-08T01:42:49Z"},{setCode:"SOS",colors:"WR",slug:"noya",displayName:"Noya",avatarUrl:null,rank:42,score:0,trophies:0,events:7,wins:16,losses:17,lastCalculatedAt:"2026-05-08T01:41:09Z"},{setCode:"SOS",colors:"WR",slug:"consolas",displayName:"Consolas",avatarUrl:null,rank:43,score:0,trophies:0,events:2,wins:4,losses:6,lastCalculatedAt:"2026-05-08T01:42:22Z"},{setCode:"SOS",colors:"WR",slug:"tim17",displayName:"Tim17",avatarUrl:null,rank:44,score:0,trophies:0,events:4,wins:6,losses:9,lastCalculatedAt:"2026-05-08T01:42:06Z"},{setCode:"SOS",colors:"WR",slug:"springbok7",displayName:"springbok7",avatarUrl:null,rank:45,score:0,trophies:0,events:8,wins:21,losses:24,lastCalculatedAt:"2026-05-08T01:42:47Z"},{setCode:"SOS",colors:"WR",slug:"niamhistired",displayName:"NiamhIsTired",avatarUrl:null,rank:46,score:0,trophies:0,events:9,wins:15,losses:22,lastCalculatedAt:"2026-05-08T01:42:39Z"}],HH=[{setCode:"SOS",slug:"chonce",formatLabel:"Trad",events:23,wins:50,losses:18,trophies:9,scoreContribution:21.29},{setCode:"SOS",slug:"chonce",formatLabel:"Premier",events:22,wins:73,losses:62,trophies:3,scoreContribution:7.1},{setCode:"SOS",slug:"chonce",formatLabel:"Quick",events:2,wins:9,losses:6,trophies:0,scoreContribution:0},{setCode:"SOS",slug:"chonce",formatLabel:"Sealed",events:1,wins:4,losses:3,trophies:0,scoreContribution:0},{setCode:"SOS",slug:"chonce",formatLabel:"Trad Sealed",events:1,wins:3,losses:2,trophies:0,scoreContribution:0}],GH=[{slug:"chonce",setCode:"SOS",eventId:"2c95a0e8-f3b4-43f4-a3d8-fd5c65d236c5",format:"TradDraft",expansion:"SOS",wins:1,losses:1,isTrophy:!1,colors:"BG",startedAt:"2026-05-08T00:59:18Z",finishedAt:"2026-05-08T01:38:47Z",endRank:"Mythic-1"},{slug:"chonce",setCode:"SOS",eventId:"375a394d-4cd1-4093-b32b-6af18075c488",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WR",startedAt:"2026-05-07T23:17:09Z",finishedAt:"2026-05-08T00:54:49Z",endRank:"Mythic-1"},{slug:"chonce",setCode:"SOS",eventId:"936aa101-f296-4f9c-a477-1173939222f9",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"URg",startedAt:"2026-05-07T22:19:13Z",finishedAt:"2026-05-07T23:14:41Z",endRank:"Diamond-1"},{slug:"chonce",setCode:"SOS",eventId:"1f030288-b732-4b42-a40f-3420c0c5d7a5",format:"PremierDraft",expansion:"SOS",wins:4,losses:3,isTrophy:!1,colors:"URwg",startedAt:"2026-05-05T23:20:42Z",finishedAt:"2026-05-07T21:59:13Z",endRank:"Diamond-1"},{slug:"chonce",setCode:"SOS",eventId:"77c2435c-40ac-46e1-8656-12b466182ca2",format:"PremierDraft",expansion:"SOS",wins:4,losses:3,isTrophy:!1,colors:"UR",startedAt:"2026-05-04T01:37:25Z",finishedAt:"2026-05-05T23:19:23Z",endRank:"Diamond-1"},{slug:"chonce",setCode:"SOS",eventId:"5ce1765d-e9ee-41a2-a7ba-fec01210c5e1",format:"PremierDraft",expansion:"SOS",wins:7,losses:1,isTrophy:!0,colors:"WR",startedAt:"2026-05-03T15:38:32Z",finishedAt:"2026-05-04T01:36:13Z",endRank:"Diamond-1"},{slug:"chonce",setCode:"SOS",eventId:"658d3e99-b5f9-4f5d-ba14-9ff4839b8e9e",format:"PremierDraft",expansion:"SOS",wins:3,losses:3,isTrophy:!1,colors:"BG",startedAt:"2026-05-03T02:22:44Z",finishedAt:"2026-05-03T15:38:09Z",endRank:"Diamond-2"},{slug:"chonce",setCode:"SOS",eventId:"107f14fb-b839-4c3f-9972-1263cbb8041a",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"UGb",startedAt:"2026-05-03T01:16:57Z",finishedAt:"2026-05-03T02:20:41Z",endRank:"Diamond-2"},{slug:"chonce",setCode:"SOS",eventId:"ecb20b32-b7d5-41dd-b112-b46a895c4640",format:"PremierDraft",expansion:"SOS",wins:7,losses:2,isTrophy:!0,colors:"BG",startedAt:"2026-05-01T23:36:35Z",finishedAt:"2026-05-02T15:29:03Z",endRank:"Diamond-2"},{slug:"chonce",setCode:"SOS",eventId:"e0b4e2c2-ef8c-43a9-8a09-e5a5bbcd99b7",format:"PremierDraft",expansion:"SOS",wins:0,losses:3,isTrophy:!1,colors:"UGb",startedAt:"2026-05-01T23:17:09Z",finishedAt:"2026-05-01T23:36:16Z",endRank:"Diamond-2"},{slug:"chonce",setCode:"SOS",eventId:"bbd94128-0e01-4771-b56f-4ff0f8429e36",format:"PremierDraft",expansion:"SOS",wins:3,losses:3,isTrophy:!1,colors:"BGu",startedAt:"2026-05-01T01:47:42Z",finishedAt:"2026-05-01T22:51:20Z",endRank:"Diamond-3"},{slug:"chonce",setCode:"SOS",eventId:"3d9cf5f1-2b92-4565-b2c7-a786148db228",format:"QuickDraft",expansion:"SOS",wins:4,losses:3,isTrophy:!1,colors:"WB",startedAt:"2026-05-01T22:06:11Z",finishedAt:"2026-05-01T22:46:28Z",endRank:"Diamond-3"},{slug:"chonce",setCode:"SOS",eventId:"96c6940e-3879-42a0-af34-fa901a4ad83f",format:"PremierDraft",expansion:"SOS",wins:1,losses:3,isTrophy:!1,colors:"WR",startedAt:"2026-04-30T00:26:52Z",finishedAt:"2026-05-01T01:47:16Z",endRank:"Diamond-3"},{slug:"chonce",setCode:"SOS",eventId:"b591635a-f399-4dab-9b8a-aa96d4e58ca3",format:"QuickDraft",expansion:"SOS",wins:5,losses:3,isTrophy:!1,colors:"WB",startedAt:"2026-05-01T00:40:12Z",finishedAt:"2026-05-01T01:20:10Z",endRank:"Diamond-3"},{slug:"chonce",setCode:"SOS",eventId:"9a1f7c3a-9f69-4804-a8db-3f4d700ffaf8",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"UR",startedAt:"2026-04-29T21:43:35Z",finishedAt:"2026-04-30T00:25:22Z",endRank:"Diamond-4"},{slug:"chonce",setCode:"SOS",eventId:"a2673d81-5e50-4faa-bf61-0b6a78ca7b96",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WB",startedAt:"2026-04-29T20:52:07Z",finishedAt:"2026-04-29T21:41:01Z",endRank:"Diamond-4"},{slug:"chonce",setCode:"SOS",eventId:"5d76f3be-cec8-4f61-92a8-524771bfde14",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"WB",startedAt:"2026-04-29T19:46:35Z",finishedAt:"2026-04-29T20:46:11Z",endRank:"Diamond-4"},{slug:"chonce",setCode:"SOS",eventId:"22ab41db-bba8-4702-bdf5-6ff03b681a9f",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"URb",startedAt:"2026-04-29T18:14:44Z",finishedAt:"2026-04-29T19:43:28Z",endRank:"Diamond-4"},{slug:"chonce",setCode:"SOS",eventId:"e89520e7-d50b-42cc-bd2c-02d7a79c14dc",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"URg",startedAt:"2026-04-28T22:02:57Z",finishedAt:"2026-04-29T18:11:45Z",endRank:"Platinum-1"},{slug:"chonce",setCode:"SOS",eventId:"28ad7b21-8b1c-4616-976a-7f064607c1ff",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"UR",startedAt:"2026-04-28T02:00:27Z",finishedAt:"2026-04-28T22:01:57Z",endRank:"Platinum-1"},{slug:"chonce",setCode:"SOS",eventId:"9e706ddc-8cd9-4b01-8c62-32ed902a5297",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WR",startedAt:"2026-04-28T00:02:03Z",finishedAt:"2026-04-28T01:07:22Z",endRank:"Platinum-1"},{slug:"chonce",setCode:"SOS",eventId:"9407fe4c-109e-420f-8d6e-78625092cbb2",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"WB",startedAt:"2026-04-27T22:49:54Z",finishedAt:"2026-04-27T23:55:09Z",endRank:"Platinum-1"},{slug:"chonce",setCode:"SOS",eventId:"2bbbd553-a04b-4049-bb25-fcf93bf11263",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"UBRG",startedAt:"2026-04-27T21:46:36Z",finishedAt:"2026-04-27T22:47:58Z",endRank:"Platinum-2"},{slug:"chonce",setCode:"SOS",eventId:"f32b4b78-49c5-4a30-be84-323790c957c3",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"WBr",startedAt:"2026-04-26T23:56:34Z",finishedAt:"2026-04-27T01:30:06Z",endRank:"Platinum-2"},{slug:"chonce",setCode:"SOS",eventId:"4e31d44e-e9ff-4355-a5dc-1d7c4247f477",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"WB",startedAt:"2026-04-26T20:12:12Z",finishedAt:"2026-04-26T23:37:19Z",endRank:"Platinum-2"},{slug:"chonce",setCode:"SOS",eventId:"b0b13562-75e4-4971-86c3-613dee7cb458",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"WR",startedAt:"2026-04-26T16:52:37Z",finishedAt:"2026-04-26T20:04:15Z",endRank:"Platinum-2"},{slug:"chonce",setCode:"SOS",eventId:"afe57606-1f06-45b6-83ec-3371938e6ae5",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"UR",startedAt:"2026-04-26T14:32:39Z",finishedAt:"2026-04-26T16:50:43Z",endRank:"Platinum-3"},{slug:"chonce",setCode:"SOS",eventId:"8ba554ac-d025-4ce0-ac8c-ca30f74884b0",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"BG",startedAt:"2026-04-26T13:30:26Z",finishedAt:"2026-04-26T14:29:55Z",endRank:"Platinum-3"},{slug:"chonce",setCode:"SOS",eventId:"bdba096a-8a33-4724-83db-3ba11d867980",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"UR",startedAt:"2026-04-26T03:01:30Z",finishedAt:"2026-04-26T13:27:01Z",endRank:"Platinum-3"},{slug:"chonce",setCode:"SOS",eventId:"d15969c4-bc52-4926-b4db-1e57d8fe60b5",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"WB",startedAt:"2026-04-26T02:02:12Z",finishedAt:"2026-04-26T02:58:42Z",endRank:"Platinum-3"},{slug:"chonce",setCode:"SOS",eventId:"9b26cf8e-2417-4d09-946b-cd7a1b6b8193",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WR",startedAt:"2026-04-26T00:27:38Z",finishedAt:"2026-04-26T02:00:20Z",endRank:"Platinum-4"},{slug:"chonce",setCode:"SOS",eventId:"4deebe7f-a0e6-42e8-8fd1-876bcd2676dc",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"WR",startedAt:"2026-04-25T22:42:1
4967Z",finishedAt:"2026-04-26T00:24:13Z",endRank:"Platinum-4"}],VH=[{setCode:"SOS",slug:"nlaframboise",formatLabel:"Trad",events:94,wins:199,losses:77,trophies:37,scoreContribution:121.51}],KH=[{slug:"nlaframboise",setCode:"SOS",eventId:"800205e6-980e-46ea-9b69-8b9a8278763f",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"BG",startedAt:"2026-05-08T20:41:30Z",finishedAt:"2026-05-08T22:26:08Z",endRank:"Diamond-2"},{slug:"nlaframboise",setCode:"SOS",eventId:"939a9cf2-e2af-4942-afcb-5f2be819c50a",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"UR",startedAt:"2026-05-08T19:32:29Z",finishedAt:"2026-05-08T20:34:53Z",endRank:"Diamond-2"},{slug:"nlaframboise",setCode:"SOS",eventId:"d2db4e50-81b7-464f-9150-ab8ff49ebff5",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WB",startedAt:"2026-05-08T17:59:42Z",finishedAt:"2026-05-08T18:56:21Z",endRank:"Diamond-3"},{slug:"nlaframboise",setCode:"SOS",eventId:"c1a42eba-7ed2-4263-84d2-d44cb58e6127",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WB",startedAt:"2026-05-08T16:18:11Z",finishedAt:"2026-05-08T17:27:36Z",endRank:"Diamond-3"},{slug:"nlaframboise",setCode:"SOS",eventId:"8ca6324d-3a44-4e7d-a36c-c1f48ecca998",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WR",startedAt:"2026-05-08T15:18:06Z",finishedAt:"2026-05-08T16:17:29Z",endRank:"Diamond-3"},{slug:"nlaframboise",setCode:"SOS",eventId:"9f7ef957-e6fd-4f76-b136-ee1af4350408",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WB",startedAt:"2026-05-08T14:11:34Z",finishedAt:"2026-05-08T15:03:39Z",endRank:"Diamond-4"},{slug:"nlaframboise",setCode:"SOS",eventId:"b69511a3-4b10-489a-8250-10785f995f10",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"WR",startedAt:"2026-05-07T19:38:04Z",finishedAt:"2026-05-08T14:08:21Z",endRank:"Diamond-4"},{slug:"nlaframboise",setCode:"SOS",eventId:"cc33e982-3566-411e-bbad-13637a929517",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"WR",startedAt:"2026-05-07T18:24:49Z",finishedAt:"2026-05-07T19:30:12Z",endRank:"Diamond-4"},{slug:"nlaframboise",setCode:"SOS",eventId:"e9e5a530-7a5d-413c-8592-45eed05c26af",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"WB",startedAt:"2026-05-07T16:05:44Z",finishedAt:"2026-05-07T18:22:41Z",endRank:"Platinum-1"},{slug:"nlaframboise",setCode:"SOS",eventId:"a0165ba9-d908-4599-ab36-e700b2712786",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"WRu",startedAt:"2026-05-07T15:06:19Z",finishedAt:"2026-05-07T16:04:32Z",endRank:"Platinum-1"},{slug:"nlaframboise",setCode:"SOS",eventId:"4f01b965-0d61-4167-8078-80f96fa1fe84",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"URw",startedAt:"2026-05-06T20:49:49Z",finishedAt:"2026-05-07T15:04:33Z",endRank:"Platinum-1"},{slug:"nlaframboise",setCode:"SOS",eventId:"8d8c589c-80ab-455f-96cb-b263a252edb3",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"BG",startedAt:"2026-05-06T20:13:01Z",finishedAt:"2026-05-06T20:48:02Z",endRank:"Platinum-2"},{slug:"nlaframboise",setCode:"SOS",eventId:"4e52de45-a242-4c2d-a0aa-8658440ed20d",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WR",startedAt:"2026-05-06T18:27:50Z",finishedAt:"2026-05-06T20:07:54Z",endRank:"Platinum-2"},{slug:"nlaframboise",setCode:"SOS",eventId:"c790e6d9-f653-4758-9bb1-d37873779266",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"UGbr",startedAt:"2026-05-06T16:48:19Z",finishedAt:"2026-05-06T18:24:18Z",endRank:"Platinum-2"},{slug:"nlaframboise",setCode:"SOS",eventId:"b21e1f38-906a-4c19-b2f0-8938fdc53398",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WRu",startedAt:"2026-05-06T15:25:13Z",finishedAt:"2026-05-06T16:31:29Z",endRank:"Platinum-3"},{slug:"nlaframboise",setCode:"SOS",eventId:"58a410bd-8571-4c9c-8d77-d5d7bcb9301c",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"URwb",startedAt:"2026-05-06T14:12:47Z",finishedAt:"2026-05-06T15:21:01Z",endRank:"Platinum-3"},{slug:"nlaframboise",setCode:"SOS",eventId:"39fa69b3-804a-4f9e-800d-942a11737a58",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"WB",startedAt:"2026-05-05T21:00:15Z",finishedAt:"2026-05-06T14:06:32Z",endRank:"Platinum-4"},{slug:"nlaframboise",setCode:"SOS",eventId:"94adc5cf-e5c7-4d83-a030-86fc92a53030",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"WR",startedAt:"2026-05-05T19:44:43Z",finishedAt:"2026-05-05T20:55:07Z",endRank:"Platinum-4"},{slug:"nlaframboise",setCode:"SOS",eventId:"100b56f8-9fd4-4e05-a1b1-f4982903d33f",format:"TradDraft",expansion:"SOS",wins:0,losses:2,isTrophy:!1,colors:"BGw",startedAt:"2026-05-05T18:51:50Z",finishedAt:"2026-05-05T19:41:05Z",endRank:"Platinum-4"},{slug:"nlaframboise",setCode:"SOS",eventId:"fcdf9233-4ef7-443b-b1c9-0a97898cb2d8",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"URw",
496startedAt:"2026-05-05T17:25:25Z",finishedAt:"2026-05-05T18:49:21Z",endRank:"Gold-1"},{slug:"nlaframboise",setCode:"SOS",eventId:"dcfc236d-30e8-46bb-b6b9-b26d9b0d3fa5",format:"TradDraft",expansion:"SOS",wins:0,losses:2,isTrophy:!1,colors:"URGwb",startedAt:"2026-05-05T16:03:46Z",finishedAt:"2026-05-05T17:22:14Z",endRank:"Gold-1"},{slug:"nlaframboise",setCode:"SOS",eventId:"0e4b0249-eed7-47ff-94f2-be465053692f",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"WRu",startedAt:"2026-05-05T14:34:47Z",finishedAt:"2026-05-05T15:57:59Z",endRank:"Gold-1"},{slug:"nlaframboise",setCode:"SOS",eventId:"3176f482-60d8-4dfc-a892-fc7237813a3b",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WRb",startedAt:"2026-05-04T23:43:49Z",finishedAt:"2026-05-05T14:31:41Z",endRank:"Gold-2"},{slug:"nlaframboise",setCode:"SOS",eventId:"6acaac29-e798-4f72-9182-7259ac8543a1",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"UGb",startedAt:"2026-05-04T21:48:28Z",finishedAt:"2026-05-04T22:51:56Z",endRank:"Gold-2"},{slug:"nlaframboise",setCode:"SOS",eventId:"bd2a0fd5-8362-45ac-bc18-9395c7bdb63d",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"UR",startedAt:"2026-05-03T19:27:43Z",finishedAt:"2026-05-04T21:47:24Z",endRank:"Gold-2"},{slug:"nlaframboise",setCode:"SOS",eventId:"bfbd77ee-1221-456f-abfd-e6837b041a8e",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"WB",startedAt:"2026-05-03T18:38:53Z",finishedAt:"2026-05-03T19:26:09Z",endRank:"Gold-3"},{slug:"nlaframboise",setCode:"SOS",eventId:"ccfe0bf6-b266-496e-97c4-669fdea03f6e",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WB",startedAt:"2026-05-03T15:13:21Z",finishedAt:"2026-05-03T16:42:10Z",endRank:"Gold-3"},{slug:"nlaframboise",setCode:"SOS",eventId:"ac69914c-57dd-423d-9021-3192bc7985f9",format:"TradDraft",expansion:"SOS",wins:0,losses:2,isTrophy:!1,colors:"UR",startedAt:"2026-05-03T14:12:16Z",finishedAt:"2026-05-03T14:57:16Z",endRank:"Gold-3"},{slug:"nlaframboise",setCode:"SOS",eventId:"4f3fc687-247b-4ca8-987e-4733778ba384",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"URGb",startedAt:"2026-05-03T00:36:38Z",finishedAt:"2026-05-03T01:29:53Z",endRank:"Gold-4"},{slug:"nlaframboise",setCode:"SOS",eventId:"d3991f90-fdcb-4a95-821a-4de2c1a6e977",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WRb",startedAt:"2026-05-02T23:28:45Z",finishedAt:"2026-05-03T00:35:52Z",endRank:"Gold-4"}],qH=[{setCode:"SOS",slug:"elfandor",formatLabel:"Premier",events:57,wins:258,losses:138,trophies:18,scoreContribution:41.55},{setCode:"SOS",slug:"elfandor",formatLabel:"Arena Direct",events:46,wins:162,losses:80,trophies:10,scoreContribution:23.08},{setCode:"SOS",slug:"elfandor",formatLabel:"Trad",events:8,wins:18,losses:6,trophies:3,scoreContribution:6.93}],ZH=[{slug:"elfandor",setCode:"SOS",eventId:"205559bd-32d2-4697-8ca1-d23a8984d38c",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WRu",startedAt:"2026-05-08T22:42:51Z",finishedAt:"2026-05-09T00:08:12Z",endRank:"Platinum-1"},{slug:"elfandor",setCode:"SOS",eventId:"a5d72ee2-e199-4f66-bd94-42a5f4ac1973",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"WR",startedAt:"2026-05-08T17:59:42Z",finishedAt:"2026-05-08T19:18:58Z",endRank:"Platinum-1"},{slug:"elfandor",setCode:"SOS",eventId:"1d55b19a-975d-45b9-864f-334757fd4254",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WB",startedAt:"2026-05-08T14:45:04Z",finishedAt:"2026-05-08T15:41:35Z",endRank:"Platinum-2"},{slug:"elfandor",setCode:"SOS",eventId:"bbfd255c-d4ec-4cec-9e05-2fed92aa78b6",format:"PremierDraft",expansion:"SOS",wins:7,losses:2,isTrophy:!0,colors:"UR",startedAt:"2026-05-07T10:07:45Z",finishedAt:"2026-05-07T11:40:20Z",endRank:"Platinum-2"},{slug:"elfandor",setCode:"SOS",eventId:"8847104a-c117-41d5-9e65-fccfa94669f1",format:"PremierDraft",expansion:"SOS",wins:7,losses:0,isTrophy:!0,colors:"URGwb",startedAt:"2026-05-07T08:40:46Z",finishedAt:"2026-05-07T09:54:56Z",endRank:"Platinum-2"},{slug:"elfandor",setCode:"SOS",eventId:"c697310e-836c-4235-b6cd-b6c38bb969c9",format:"PremierDraft",expansion:"SOS",wins:7,losses:2,isTrophy:!0,colors:"WB",startedAt:"2026-05-06T21:08:18Z",finishedAt:"2026-05-06T23:36:40Z",endRank:"Platinum-3"},{slug:"elfandor",setCode:"SOS",eventId:"837ac413-0f69-496e-a5c1-7af08bb2f8c3",format:"PremierDraft",expansion:"SOS",wins:7,losses:1,isTrophy:!0,colors:"WRu",startedAt:"2026-05-06T12:49:20Z",finishedAt:"2026-05-06T14:11:47Z",endRank:"Platinum-3"},{slug:"elfandor",setCode:"SOS",eventId:"210fa8a7-d9a2-419d-bc34-d668e199de9e",format:"PremierDraft",expansion:"SOS",wins:4,losses:3,isTrophy:!1,colors:"URGb",startedAt:"2026-05-06T11:14:05Z",finishedAt:"2026-05-06T12:48:08Z",endRank:"Platinum-3"},{slug:"elfandor",setCode:"SOS",eventId:"43529773-3b3c-43dd-a4a5-23bf778c994a",format:"PremierDraft",expansion:"SOS",wins:7,losses:1,isTrophy:!0,colors:"UR",startedAt:"2026-05-06T08:51:37Z",finishedAt:"2026-05-06T10:22:16Z",endRank:"Platinum-4"},{slug:"elfandor",setCode:"SOS",eventId:"8a88dcc3-7f21-4b2c-9b55-79bea21b3977",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"BG",startedAt:"2026-05-05T20:01:51Z",finishedAt:"2026-05-05T21:03:07Z",endRank:"Platinum-4"},{slug:"elfandor",setCode:"SOS",eventId:"1ab929f6-c6f5-44bb-9564-b56c2bf896b1",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"BGu",startedAt:"2026-05-05T17:42:26Z",finishedAt:"2026-05-05T18:37:37Z",endRank:"Platinum-4"},{slug:"elfandor",setCode:"SOS",eventId:"86c143fb-4e7d-488e-bd5c-e6338d9d8f3a",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"WB",startedAt:"2026-05-05T16:31:21Z",finishedAt:"2026-05-05T17:40:07Z",endRank:"Gold-1"},{slug:"elfandor",setCode:"SOS",eventId:"3797690c-1d3a-406a-9145-3c9280370fff",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"BG",startedAt:"2026-05-05T12:24:52Z",finishedAt:"2026-05-05T13:42:46Z",endRank:"Gold-1"},{slug:"elfandor",setCode:"SOS",eventId:"a28c2e4f-a241-4232-b46d-ed38e7cc7529",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WB",startedAt:"2026-05-05T10:41:36Z",finishedAt:"2026-05-05T12:23:56Z",endRank:"Gold-1"},{slug:"elfandor",setCode:"SOS",eventId:"0ed5e64d-ce25-4c2b-a5ec-93706065ee0c",format:"PremierDraft",expansion:"SOS",wins:7,losses:1,isTrophy:!0,colors:"WB",startedAt:"2026-05-04T21:00:03Z",finishedAt:"2026-05-05T10:35:27Z",endRank:"Gold-2"},{slug:"elfandor",setCode:"SOS",eventId:"d35c92ad-2a31-4951-9959-32305e55dcf9",format:"ArenaDirect_Sealed",expansion:"SOS",wins:7,losses:1,isTrophy:!0,colors:"UR",startedAt:"2026-05-03T21:37:31Z",finishedAt:"2026-05-03T23:00:34Z",endRank:"Gold-2"},{slug:"elfandor",setCode:"SOS",eventId:"d016087f-3cc8-43ee-8bd0-290a604ab46d",format:"ArenaDirect_Sealed",expansion:"SOS",wins:5,losses:2,isTrophy:!1,colors:"WURbg",startedAt:"2026-05-03T20:39:06Z",finishedAt:"2026-05-03T21:31:39Z",endRank:"Gold-3"},{slug:"elfandor",setCode:"SOS",eventId:"3ff5d572-7300-4925-b7b9-db77ce95669d",format:"ArenaDirect_Sealed",expansion:"SOS",wins:0,losses:2,isTrophy:!1,colors:"WUR",startedAt:"2026-05-03T16:51:02Z",finishedAt:"2026-05-03T20:26:04Z",endRank:"Gold-3"},{slug:"elfandor",setCode:"SOS",eventId:"5cb3b077-9081-4ffe-a6ad-f72647107cd6",format:"ArenaDirect_Sealed",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"WBr",startedAt:"2026-05-03T16:05:22Z",finishedAt:"2026-05-03T16:44:31Z",endRank:"Gold-3"},{slug:"elfandor",setCode:"SOS",eventId:"2ab4a1ec-3a93-4b15-9c79-192d05d582b9",format:"ArenaDirect_Sealed",expansion:"SOS",wins:0,losses:2,isTrophy:!1,colors:"WUR",startedAt:"2026-05-03T14:27:02Z",finishedAt:"2026-05-03T16:02:17Z",endRank:"Gold-4"},{slug:"elfandor",setCode:"SOS",eventId:"a7ac4ecd-43e6-4062-8d03-2002249ade90",format:"ArenaDirect_Sealed",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"UG",startedAt:"2026-05-03T13:48:45Z",finishedAt:"2026-05-03T14:20:09Z",endRank:"Gold-4"},{slug:"elfandor",setCode:"SOS",eventId:"27bc5ba0-b5dc-48d4-b2d9-b93b8c373204",format:"ArenaDirect_Sealed",expansion:"SOS",wins:2,losses:2,isTrophy:!1,colors:"WR",startedAt:"2026-05-03T13:16:18Z",finishedAt:"2026-05-03T13:42:42Z",endRank:"Gold-4"},{slug:"elfandor",setCode:"SOS",eventId:"59f4f60b-68dc-4601-8ce2-e98c2d45d927",format:"ArenaDirect_Sealed",expansion:"SOS",wins:7,losses:1,isTrophy:!0,colors:"URwg",startedAt:"2026-05-03T10:45:10Z",finishedAt:"2026-05-03T11:52:02Z",endRank:"Silver-1"},{slug:"elfandor",setCode:"SOS",eventId:"f2141ec4-6476-4ca2-bf5d-0512e74fe2cc",format:"ArenaDirect_Sealed",expansion:"SOS",wins:0,losses:2,isTrophy:!1,colors:"URg",startedAt:"2026-05-03T10:22:43Z",finishedAt:"2026-05-03T10:39:25Z",endRank:"Silver-1"},{slug:"elfandor",setCode:"SOS",eventId:"4926f7af-a6af-4d50-9a76-efac9b8faf7b",format:"ArenaDirect_Sealed",expansion:"SOS",wins:4,losses:2,isTrophy:!1,colors:"WB",startedAt:"2026-05-03T09:06:18Z",finishedAt:"2026-05-03T09:53:28Z",endRank:"Silver-1"},{slug:"elfandor",setCode:"SOS",eventId:"cf2b4be5-afed-4a46-b9f5-0f48ba039031",format:"ArenaDirect_Sealed",expansion:"SOS",wins:4,losses:2,isTrophy:!1,colors:"UGbr",startedAt:"2026-05-03T08:06:11Z",finishedAt:"2026-05-03T09:02:38Z",endRank:"Silver-2"},{slug:"elfandor",setCode:"SOS",eventId:"eccb8544-78ed-4d30-8052-a51fe97c529d",format:"ArenaDirect_Sealed",expansion:"SOS",wins:7,losses:1,isTrophy:!0,colors:"WRu",startedAt:"2026-05-02T19:26:16Z",finishedAt:"2026-05-02T22:07:09Z",endRank:"Silver-2"},{slug:"elfandor",setCode:"SOS",eventId:"b159d6d4-b0fc-4c9a-ba7d-f109d901b3d8",format:"ArenaDirect_Sealed",expansion:"SOS",wins:0,losses:2,isTrophy:!1,colors:"URw",
496startedAt:"2026-05-02T19:03:57Z",finishedAt:"2026-05-02T19:19:33Z",endRank:"Silver-2"},{slug:"elfandor",setCode:"SOS",eventId:"d71be82b-f8fa-48e8-8034-87777e8a29ba",format:"ArenaDirect_Sealed",expansion:"SOS",wins:6,losses:2,isTrophy:!1,colors:"UR",startedAt:"2026-05-02T17:35:44Z",finishedAt:"2026-05-02T18:53:41Z",endRank:"Silver-3"},{slug:"elfandor",setCode:"SOS",eventId:"3e6ef6f3-05b6-4868-80c7-48ca07b1eda4",format:"ArenaDirect_Sealed",expansion:"SOS",wins:7,losses:0,isTrophy:!0,colors:"WRb",startedAt:"2026-05-02T16:14:18Z",finishedAt:"2026-05-02T17:32:07Z",endRank:"Silver-3"}],YH=[{setCode:"SOS",slug:"flutterdev",formatLabel:"Premier",events:41,wins:206,losses:92,trophies:14,scoreContribution:50.55},{setCode:"SOS",slug:"flutterdev",formatLabel:"Trad",events:7,wins:18,losses:0,trophies:6,scoreContribution:21.67}],QH=[{slug:"flutterdev",setCode:"SOS",eventId:"c450201c-ac9b-4af5-8fbc-20d67949aa29",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"WR",startedAt:"2026-05-08T16:09:20Z",finishedAt:"2026-05-08T16:09:36Z",endRank:"Gold-2"},{slug:"flutterdev",setCode:"SOS",eventId:"6252745c-6e7c-4976-9384-99b17b0cf98a",format:"PremierDraft",expansion:"SOS",wins:1,losses:3,isTrophy:!1,colors:"WBr",startedAt:"2026-05-07T23:02:38Z",finishedAt:"2026-05-07T23:45:25Z",endRank:"Gold-2"},{slug:"flutterdev",setCode:"SOS",eventId:"28a8ea40-b57e-4d7e-aa72-ce99618af968",format:"PremierDraft",expansion:"SOS",wins:6,losses:3,isTrophy:!1,colors:"UGr",startedAt:"2026-05-07T20:42:53Z",finishedAt:"2026-05-07T20:43:50Z",endRank:"Gold-3"},{slug:"flutterdev",setCode:"SOS",eventId:"0ddfbc06-609c-47b5-8bdd-9c2195aff351",format:"PremierDraft",expansion:"SOS",wins:2,losses:3,isTrophy:!1,colors:"WB",startedAt:"2026-05-07T20:42:19Z",finishedAt:"2026-05-07T20:42:52Z",endRank:"Gold-3"},{slug:"flutterdev",setCode:"SOS",eventId:"c551c26b-c413-4f7b-bdf5-3e7532fc2bc0",format:"PremierDraft",expansion:"SOS",wins:7,losses:0,isTrophy:!0,colors:"WB",startedAt:"2026-05-07T09:14:50Z",finishedAt:"2026-05-07T09:15:24Z",endRank:"Gold-3"},{slug:"flutterdev",setCode:"SOS",eventId:"5fee4d2e-481b-4191-a51c-228ae179f106",format:"PremierDraft",expansion:"SOS",wins:6,losses:3,isTrophy:!1,colors:"UR",startedAt:"2026-05-07T06:51:35Z",finishedAt:"2026-05-07T06:52:38Z",endRank:"Gold-4"},{slug:"flutterdev",setCode:"SOS",eventId:"a368daf8-d139-43c0-9af2-eb40c431860e",format:"PremierDraft",expansion:"SOS",wins:5,losses:3,isTrophy:!1,colors:"URg",startedAt:"2026-05-07T06:50:54Z",finishedAt:"2026-05-07T06:51:35Z",endRank:"Gold-4"},{slug:"flutterdev",setCode:"SOS",eventId:"3fef9248-7346-4c95-aac4-6fd5f835129a",format:"PremierDraft",expansion:"SOS",wins:4,losses:3,isTrophy:!1,colors:"WRu",startedAt:"2026-05-06T19:34:12Z",finishedAt:"2026-05-06T20:36:25Z",endRank:"Gold-4"},{slug:"flutterdev",setCode:"SOS",eventId:"e51bc8e5-b725-4cb6-bd92-85d0ba9c0a45",format:"PremierDraft",expansion:"SOS",wins:3,losses:3,isTrophy:!1,colors:"WRu",startedAt:"2026-05-06T18:16:27Z",finishedAt:"2026-05-06T19:33:43Z",endRank:"Silver-1"},{slug:"flutterdev",setCode:"SOS",eventId:"276a1508-29d3-4a46-b8c5-62c42d3dcca0",format:"PremierDraft",expansion:"SOS",wins:6,losses:3,isTrophy:!1,colors:"WR",startedAt:"2026-05-06T16:45:00Z",finishedAt:"2026-05-06T18:13:16Z",endRank:"Silver-1"},{slug:"flutterdev",setCode:"SOS",eventId:"e3c7eb55-8c0e-46f7-b29e-044764182d3d",format:"PremierDraft",expansion:"SOS",wins:7,losses:1,isTrophy:!0,colors:"WR",startedAt:"2026-05-06T16:22:08Z",finishedAt:"2026-05-06T16:22:42Z",endRank:"Silver-1"},{slug:"flutterdev",setCode:"SOS",eventId:"79eac96f-7650-405a-b73f-d7fee2c27819",format:"PremierDraft",expansion:"SOS",wins:7,losses:2,isTrophy:!0,colors:"WRu",startedAt:"2026-05-06T00:42:20Z",finishedAt:"2026-05-06T00:43:19Z",endRank:"Silver-2"},{slug:"flutterdev",setCode:"SOS",eventId:"5ae7b218-56d6-4e35-8442-9d42ecd3d775",format:"PremierDraft",expansion:"SOS",wins:7,losses:0,isTrophy:!0,colors:"WB",startedAt:"2026-05-05T16:29:41Z",finishedAt:"2026-05-05T16:30:16Z",endRank:"Silver-2"},{slug:"flutterdev",setCode:"SOS",eventId:"5dea6a20-22cc-4b1a-bb3e-d8d20387d5ce",format:"PremierDraft",expansion:"SOS",wins:7,losses:1,isTrophy:!0,colors:"WR",startedAt:"2026-05-05T05:30:59Z",finishedAt:"2026-05-05T05:33:31Z",endRank:"Silver-2"},{slug:"flutterdev",setCode:"SOS",eventId:"07527be2-c8c5-4ba7-a333-c03bbd7777ce",format:"PremierDraft",expansion:"SOS",wins:5,losses:3,isTrophy:!1,colors:"WR",startedAt:"2026-05-04T04:40:12Z",finishedAt:"2026-05-04T05:41:31Z",endRank:"Silver-3"}
496,{slug:"flutterdev",setCode:"SOS",eventId:"af4cad9a-057d-43a8-89e2-7c7e906167f0",format:"PremierDraft",expansion:"SOS",wins:6,losses:3,isTrophy:!1,colors:"WR",startedAt:"2026-05-04T02:17:07Z",finishedAt:"2026-05-04T03:46:18Z",endRank:"Silver-3"},{slug:"flutterdev",setCode:"SOS",eventId:"36334687-9e02-4681-ac03-4551aef5aaa2",format:"PremierDraft",expansion:"SOS",wins:7,losses:0,isTrophy:!0,colors:"WB",startedAt:"2026-05-04T02:15:50Z",finishedAt:"2026-05-04T02:16:29Z",endRank:"Silver-4"},{slug:"flutterdev",setCode:"SOS",eventId:"efb44156-b50d-4e92-ab4e-8e762b25f99e",format:"PremierDraft",expansion:"SOS",wins:4,losses:3,isTrophy:!1,colors:"URw",startedAt:"2026-05-04T02:15:06Z",finishedAt:"2026-05-04T02:15:49Z",endRank:"Silver-4"},{slug:"flutterdev",setCode:"SOS",eventId:"18114815-0a2b-4849-8172-667069e0517c",format:"PremierDraft",expansion:"SOS",wins:7,losses:2,isTrophy:!0,colors:"WR",startedAt:"2026-05-03T19:13:16Z",finishedAt:"2026-05-03T20:33:47Z",endRank:"Silver-4"},{slug:"flutterdev",setCode:"SOS",eventId:"3f07dd40-e3a3-456b-bf66-e9128193ef77",format:"PremierDraft",expansion:"SOS",wins:7,losses:2,isTrophy:!0,colors:"WR",startedAt:"2026-05-03T19:08:31Z",finishedAt:"2026-05-03T19:09:14Z",endRank:"Bronze-1"},{slug:"flutterdev",setCode:"SOS",eventId:"93a02d3f-9214-40fe-bc1b-684ce49e729b",format:"PremierDraft",expansion:"SOS",wins:1,losses:3,isTrophy:!1,colors:"UBg",startedAt:"2026-05-03T19:07:56Z",finishedAt:"2026-05-03T19:08:30Z",endRank:"Bronze-1"},{slug:"flutterdev",setCode:"SOS",eventId:"8c0ecf1f-a83f-481d-b160-fb8b39d9eaee",format:"PremierDraft",expansion:"SOS",wins:2,losses:3,isTrophy:!1,colors:"WR",startedAt:"2026-05-03T19:07:18Z",finishedAt:"2026-05-03T19:07:55Z",endRank:"Bronze-1"},{slug:"flutterdev",setCode:"SOS",eventId:"7d428cb1-7584-4ac3-9897-af47a1eab3da",format:"PremierDraft",expansion:"SOS",wins:5,losses:3,isTrophy:!1,colors:"WR",startedAt:"2026-05-03T04:19:28Z",finishedAt:"2026-05-03T04:20:18Z",endRank:"Bronze-2"},{slug:"flutterdev",setCode:"SOS",eventId:"e1d6983f-548f-4309-a794-b6337722be98",format:"PremierDraft",expansion:"SOS",wins:5,losses:3,isTrophy:!1,colors:"URwbg",startedAt:"2026-05-03T04:18:37Z",finishedAt:"2026-05-03T04:19:27Z",endRank:"Bronze-2"},{slug:"flutterdev",setCode:"SOS",eventId:"77c497ec-fec8-406a-bf5e-1bb599548594",format:"PremierDraft",expansion:"SOS",wins:5,losses:3,isTrophy:!1,colors:"WR",startedAt:"2026-05-03T04:17:56Z",finishedAt:"2026-05-03T04:18:36Z",endRank:"Bronze-2"},{slug:"flutterdev",setCode:"SOS",eventId:"841a2f6a-e595-487a-8ce0-dba3d397cda2",format:"PremierDraft",expansion:"SOS",wins:7,losses:0,isTrophy:!0,colors:"WB",startedAt:"2026-05-01T17:26:17Z",finishedAt:"2026-05-01T18:11:45Z",endRank:"Bronze-3"},{slug:"flutterdev",setCode:"SOS",eventId:"86493cb5-9cb2-40f8-b31c-083be31c1dde",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"URw",startedAt:"2026-04-30T20:04:20Z",finishedAt:"2026-04-30T20:04:57Z",endRank:"Bronze-3"},{slug:"flutterdev",setCode:"SOS",eventId:"15fac11c-0a2d-4762-a257-94d058e8271a",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"WR",startedAt:"2026-04-30T02:31:57Z",finishedAt:"2026-04-30T02:33:37Z",endRank:"Bronze-3"},{slug:"flutterdev",setCode:"SOS",eventId:"6d82ac0c-db11-4fff-8c8c-7a2376fcbbf6",format:"PremierDraft",expansion:"SOS",wins:7,losses:0,isTrophy:!0,colors:"URwbg",startedAt:"2026-04-29T03:19:21Z",finishedAt:"2026-04-29T03:20:13Z",endRank:"Bronze-4"},{slug:"flutterdev",setCode:"SOS",eventId:"d166703a-4db0-4a26-80b7-75f2992dcd03",format:"PremierDraft",expansion:"SOS",wins:7,losses:0,isTrophy:!0,colors:"WR",startedAt:"2026-04-29T00:20:13Z",finishedAt:"2026-04-29T00:20:51Z",endRank:"Bronze-4"}],JH=[{setCode:"SOS",slug:"oophies",formatLabel:"Trad",events:67,wins:144,losses:57,trophies:24,scoreContribution:69.26},{setCode:"SOS",slug:"oophies",formatLabel:"Premier",events:3,wins:13,losses:6,trophies:1,scoreContribution:2.89}],XH=[{slug:"oophies",setCode:"SOS",eventId:"ce67c626-7594-4935-b6af-9d1d411c2376",format:"PremierDraft",expansion:"SOS",wins:0,losses:2,isTrophy:!1,colors:"WB",startedAt:"2026-05-09T01:47:47Z",finishedAt:"2026-05-09T03:22:22Z",endRank:"Mythic-1"},{slug:"oophies",setCode:"SOS",eventId:"83d46444-ceb1-472c-8e11-1f38a9b47ae5",format:"PremierDraft",expansion:"SOS",wins:7,losses:1,isTrophy:!0,colors:"UR",startedAt:"2026-05-08T23:10:58Z",finishedAt:"2026-05-09T01:45:31Z",endRank:"Mythic-1"},{slug:"oophies",setCode:"SOS",eventId:"a139c569-b8b1-4043-a908-e6e4139f7f18",format:"PremierDraft",expansion:"SOS",wins:6,losses:3,isTrophy:!1,colors:"WBr",startedAt:"2026-05-08T22:05:09Z",finishedAt:"2026-05-08T23:07:27Z",endRank:"Mythic-1"},{slug:"oophies",setCode:"SOS",eventId:"673575c6-66f5-4080-bb20-9dab64e8e002",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"UGbr",startedAt:"2026-05-08T02:36:20Z",finishedAt:"2026-05-08T16:44:54Z",endRank:"Mythic-1"},{slug:"oophies",setCode:"SOS",eventId:"f6cc125a-4c56-4af3-be97-4a62cc504cfb",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"WB",startedAt:"2026-05-08T00:40:47Z",finishedAt:"2026-05-08T02:30:49Z",endRank:"Diamond-1"},{slug:"oophies",setCode:"SOS",eventId:"ceb89ec6-84b0-499b-bda7-ac7d69c2da92",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"BG",startedAt:"2026-05-07T17:08:01Z",finishedAt:"2026-05-08T00:30:08Z",endRank:"Diamond-1"},{slug:"oophies",setCode:"SOS",eventId:"9df2d1f4-3f71-4fa5-9d46-9f1a03b106d1",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WB",startedAt:"2026-05-07T15:45:47Z",finishedAt:"2026-05-07T16:34:51Z",endRank:"Diamond-1"},{slug:"oophies",setCode:"SOS",eventId:"e0944036-7e22-4d93-afd6-bae7e2c2365e",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"WB",startedAt:"2026-05-07T14:52:17Z",finishedAt:"2026-05-07T15:40:52Z",endRank:"Diamond-1"},{slug:"oophies",setCode:"SOS",eventId:"86f307c4-534a-46ae-89dd-9a131167d2e2",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"WR",startedAt:"2026-05-06T02:14:56Z",finishedAt:"2026-05-07T14:48:35Z",endRank:"Diamond-1"},{slug:"oophies",setCode:"SOS",eventId:"6ddce646-d9dd-4ad0-ab77-61e3818b1f09",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"UG",startedAt:"2026-05-05T18:19:45Z",finishedAt:"2026-05-06T01:03:21Z",endRank:"Diamond-1"},{slug:"oophies",setCode:"SOS",eventId:"517c8365-4ae6-4673-a3a2-19b52266aafc",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WB",startedAt:"2026-05-05T00:14:52Z",finishedAt:"2026-05-05T17:07:54Z",endRank:"Diamond-1"},{slug:"oophies",setCode:"SOS",eventId:"03baf21e-b5a9-4e63-93bf-3d4fdc22a196",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WB",startedAt:"2026-05-04T02:44:17Z",finishedAt:"2026-05-04T21:46:57Z",endRank:"Diamond-2"},{slug:"oophies",setCode:"SOS",eventId:"c68579c2-94a6-44ec-b9f6-dfda544de0e1",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"URGb",startedAt:"2026-05-03T18:23:24Z",finishedAt:"2026-05-03T19:43:31Z",endRank:"Diamond-2"},{slug:"oophies",setCode:"SOS",eventId:"3dad185e-a1a9-42c1-8b62-8056168c807b",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"WB",startedAt:"2026-05-02T19:00:45Z",finishedAt:"2026-05-02T23:04:28Z",endRank:"Diamond-2"},{slug:"oophies",setCode:"SOS",eventId:"c9071f5b-3908-470b-9ef4-9e6d0227288a",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"UGbr",startedAt:"2026-05-02T02:50:32Z",finishedAt:"2026-05-02T15:12:44Z",endRank:"Diamond-2"},{slug:"oophies",setCode:"SOS",eventId:"c3984a09-7cdf-4293-b2fc-7da480324a07",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"UR",startedAt:"2026-05-02T01:41:12Z",finishedAt:"2026-05-02T02:44:29Z",endRank:"Diamond-2"},{slug:"oophies",setCode:"SOS",eventId:"3cf027d5-6a59-43b4-942b-07e802c93a05",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"BG",startedAt:"2026-05-01T21:39:35Z",finishedAt:"2026-05-01T22:40:51Z",endRank:"Diamond-2"},{slug:"oophies",setCode:"SOS",eventId:"72bc2268-4537-43b6-b23f-1678a6eb2d9b",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"BG",startedAt:"2026-05-01T17:14:31Z",finishedAt:"2026-05-01T18:03:30Z",endRank:"Diamond-2"},{slug:"oophies",setCode:"SOS",eventId:"920dca41-5c8b-4eb1-9504-73ccbc5018c6",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"UG",startedAt:"2026-05-01T15:28:20Z",finishedAt:"2026-05-01T17:13:39Z",endRank:"Diamond-2"},{slug:"oophies",setCode:"SOS",eventId:"4ab0467f-f8d7-4dbd-9cf9-3bc1eff64939",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"BG",startedAt:"2026-04-30T16:15:20Z",finishedAt:"2026-04-30T17:11:56Z",endRank:"Diamond-3"}
496,{slug:"oophies",setCode:"SOS",eventId:"a0bf7261-18f1-4cd5-b02a-03e0512e7adb",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"WB",startedAt:"2026-04-30T14:43:32Z",finishedAt:"2026-04-30T16:05:35Z",endRank:"Diamond-3"},{slug:"oophies",setCode:"SOS",eventId:"10e847c9-4d39-435a-aaa8-092ab7193991",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"UG",startedAt:"2026-04-29T22:54:40Z",finishedAt:"2026-04-30T03:16:40Z",endRank:"Diamond-3"},{slug:"oophies",setCode:"SOS",eventId:"7e682a77-8224-419e-8cb7-b307324d1383",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"UR",startedAt:"2026-04-29T21:08:13Z",finishedAt:"2026-04-29T22:41:38Z",endRank:"Diamond-3"},{slug:"oophies",setCode:"SOS",eventId:"23ae1263-616b-48f9-850a-d0e9e3743aae",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"BG",startedAt:"2026-04-29T16:00:25Z",finishedAt:"2026-04-29T17:18:36Z",endRank:"Diamond-3"},{slug:"oophies",setCode:"SOS",eventId:"177eb2d6-4927-461a-afc8-55fff9fa28c6",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"UGbr",startedAt:"2026-04-29T14:16:31Z",finishedAt:"2026-04-29T15:12:30Z",endRank:"Diamond-3"},{slug:"oophies",setCode:"SOS",eventId:"2e8f00a9-0235-4afd-9084-7edd695260fb",format:"TradDraft",expansion:"SOS",wins:2,losses:1,isTrophy:!1,colors:"URwbg",startedAt:"2026-04-29T02:07:26Z",finishedAt:"2026-04-29T14:02:48Z",endRank:"Diamond-3"},{slug:"oophies",setCode:"SOS",eventId:"716a7ef0-4d78-4ab1-9ac6-c33c6f8a8355",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"WB",startedAt:"2026-04-29T00:37:57Z",finishedAt:"2026-04-29T01:24:54Z",endRank:"Diamond-4"},{slug:"oophies",setCode:"SOS",eventId:"51f9e541-f2f6-4488-8246-00ba5fe7f587",format:"TradDraft",expansion:"SOS",wins:1,losses:2,isTrophy:!1,colors:"UR",startedAt:"2026-04-28T21:13:09Z",finishedAt:"2026-04-28T22:38:48Z",endRank:"Diamond-4"},{slug:"oophies",setCode:"SOS",eventId:"ea9c29c6-e6d5-4b7a-bad1-d8ab36ceea10",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"URwbg",startedAt:"2026-04-28T17:39:22Z",finishedAt:"2026-04-28T19:08:26Z",endRank:"Diamond-4"},{slug:"oophies",setCode:"SOS",eventId:"f4ce596b-b8b0-4fab-8f41-e7a65587dfb9",format:"TradDraft",expansion:"SOS",wins:3,losses:0,isTrophy:!0,colors:"BG",startedAt:"2026-04-28T16:48:34Z",finishedAt:"2026-04-28T17:22:41Z",endRank:"Diamond-4"}],Tn=[{value:"ALL",label:"ALL FORMATS"},{value:"Premier",label:"PREMIER DRAFT"},{value:"Trad",label:"TRADITIONAL DRAFT"},{value:"Quick",label:"QUICK DRAFT"},{value:"Sealed",label:"SEALED"},{value:"Direct",label:"SEALED - DIRECT"},{value:"LCQ",label:"CHAMPIONSHIP QUALIFIER"},{value:"Pod",label:"POD DRAFT"}],bi={LCQ:["LCQ Draft 1","LCQ Draft 2"]},Oc={Premier:Lr("Premier"),Trad:Lr("Trad"),Sealed:[...Lr("Sealed"),"MidWeekSealed"],Quick:[...Lr("Quick"),"MidWeekQuickDraft"],LCQ:[...Lr("LCQ Draft 1"),...Lr("LCQ Draft 2")],Pod:["PodDraft"],Direct:["ArenaDirect_Sealed"]};function Xa(e,t){if(t==="ALL"||t==="Sealed"&&e.startsWith("OpenSealed")||t==="Trad"&&e.startsWith("OpenDraft")&&!e.endsWith("_Bo1"))return!0;const s=Oc[t];return s?s.includes(e):e.toLowerCase().includes(t.toLowerCase())}const it="MULTI",kt="OTHER",lv=["WU","WB","WR","WG","UB","UR","UG","BR","BG","RG"],hk={W:"MONO WHITE",U:"MONO BLUE",B:"MONO BLACK",R:"MONO RED",G:"MONO GREEN"},pk={WU:"AZORIUS",WB:"ORZHOV",WR:"BOROS",WG:"SELESNYA",UB:"DIMIR",UR:"IZZET",UG:"SIMIC",BR:"RAKDOS",BG:"GOLGARI",RG:"GRUUL"},mk={WUB:"ESPER",WUR:"JESKAI",WUG:"BANT",WBR:"MARDU",WBG:"ABZAN",WRG:"NAYA",UBR:"GRIXIS",UBG:"SULTAI",URG:"TEMUR",BRG:"JUND"};function eG(e){if(e.length!==4)return null;for(const t of"WUBRG")if(!e.includes(t))return t;return null}function ys(e){if(e===it)return"SOUP";if(e===kt)return"OTHER";if(hk[e])return hk[e];if(pk[e])return pk[e];if(mk[e])return mk[e];if(e==="WUBRG")return"5-COLOR";const t=eG(e);return t?`4C NO ${t}`:e}const xk=e=>[...e].sort((t,s)=>"WUBRG".indexOf(t)-"WUBRG".indexOf(s)).join("");function tG(e){const{name:t,splash:s}=TE(e);return s?`${t} ${s}`:t}function TE(e){if(!e)return{name:"",splash:""};const t=xk(e.replace(/[a-z]/g,"")),s=xk(e.replace(/[A-Z]/g,"").toUpperCase()),r=s?`SPLASH ${s}`:"";return t.length===4&&s?{name:"4 COLOR",splash:r}:{name:t?ys(t):"COLORLESS",splash:r}}const EE=e=>`${e} · ${ys(e)}`;[...lv.map(e=>({value:e,label:EE(e)}))];const sG=[{value:"ALL",label:"ALL COLORS"},...lv.map(e=>({value:e,label:EE(e)}))],An=500;function nG(e,t){let s=1/0,r=-1/0;for(const a of e){const o=t.get(ko(a.cardName));!o||o.gih<An||o.gihwr===null||(o.gihwr<s&&(s=o.gihwr),o.gihwr>r&&(r=o.gihwr))}return{min:s===1/0?0:s,max:r===-1/0?0:r}}function ko(e){return e.split(" // ")[0].trim()}function $m(e){return new Map(e.cards.map(t=>[ko(t.card_name),t]))}function cv(e,t){let s=0;for(const r of e.values()){const a=t.get(ko(r));!a||a.gih<An||a.gihwr===null||(s+=a.gihwr*100)}return s}function dv(e,t,s){const r=new Set,a=t.map(d=>e.filter(u=>d.filter(u,r)).flatMap(u=>{const f=s.get(ko(u.name));return!f||f.gih<An||f.gihwr===null?[]:[{name:u.name,gihwr:f.gihwr}]}).sort((u,f)=>f.gihwr-u.gihwr)),o=t.map((d,u)=>u).sort((d,u)=>a[d].length-a[u].length),i=new Map,l=new Set;for(const d of o)for(const u of a[d])if(!l.has(u.name)){i.set(d,u),l.add(u.name);break}const c=t.map((d,u)=>{const f=i.get(u);return{slot:d.key,cardName:(f==null?void 0:f.name)??"",gihwr:(f==null?void 0:f.gihwr)??0}});return{picks:c,score:c.reduce((d,u)=>d+u.gihwr*100,0)}}function rG(e,t,s){const r=new Set,a=new Map;for(const o of t){let i="",l=-1/0;for(const c of e){if(!o.filter(c,r))continue;const d=s.get(ko(c.name));!d||d.gih<An||d.gihwr===null||d.gihwr>l&&(l=d.gihwr,i=c.name)}i&&a.set(o.key,i)}return a}
496function uv(e,t,s){const r=new Map;for(const i of e){const l=r.get(i.slot)??[];l.push(i),r.set(i.slot,l)}const a=new Set,o=[];for(const i of t){const l=(r.get(i.key)??[]).sort((d,u)=>u.pickCount-d.pickCount);let c={slot:i.key,cardName:"",gihwr:0};for(const d of l)if(!a.has(d.cardName)){a.add(d.cardName);const u=s.get(ko(d.cardName));c={slot:i.key,cardName:d.cardName,gihwr:u&&u.gih>=An&&u.gihwr!==null?u.gihwr:0};break}o.push(c)}return{picks:o,score:o.reduce((i,l)=>i+l.gihwr*100,0)}}function tg(e,t,s){var o;const r=t.get(ko(e)),a=r&&r.gih>=An&&r.gihwr!==null?r.gihwr:null;return{name:e,imageUrl:((o=s.get(e))==null?void 0:o.imageNormal)??"",gihwr:a,gih:(r==null?void 0:r.gih)??0}}function aG(e,t,s,r,a,o,i){const l=new Map(s.picks.map(d=>[d.slot,d])),c=new Map(r.picks.map(d=>[d.slot,d]));return e.map(d=>{var m,y;const u=i?t.get(d.key):void 0,f=((m=l.get(d.key))==null?void 0:m.cardName)??"",h=((y=c.get(d.key))==null?void 0:y.cardName)??"";return{slotKey:d.key,slotLabel:d.label,yours:u?tg(u,a,o):null,crowd:tg(f,a,o),best:tg(h,a,o)}})}function RE(e){const t=new Map;for(const s of e){let r=t.get(s.ballotId);r||(r={ballotId:s.ballotId,name:s.name,avatarUrl:s.avatarUrl,picks:new Map},t.set(s.ballotId,r)),r.picks.set(s.slot,s.cardName)}return Array.from(t.values())}function AE(e,t){const s=e.map(r=>({...r,score:cv(r.picks,t),rank:0}));s.sort((r,a)=>a.score-r.score);for(let r=0;r<s.length;r++)s[r].rank=r+1;return s}function PE(e,t,s,r){return e}const oG=1e-6;function iG(e,t,s){const r=new Set(e.filter(i=>Math.abs(i.score-t.score)<oG).map(i=>i.ballotId)),a=[];let o=!1;for(const i of e)!o&&i.score<s.score&&(a.push({kind:"synthetic",standing:{kind:"crowd",team:s}}),o=!0),a.push({kind:"ballot",ballot:i});return o||a.push({kind:"synthetic",standing:{kind:"crowd",team:s}}),r.size===0&&a.unshift({kind:"synthetic",standing:{kind:"best",team:t}}),{entries:a,bestAchieverIds:r}}function OE(e,t,s){var r;if(s){const a=`/avatars/${s}/`;for(const o of e)if((r=o.avatarUrl)!=null&&r.includes(a))return o}if(t.size===0)return null;for(const a of e){if(a.picks.size!==t.size)continue;let o=!0;for(const[i,l]of t)if(a.picks.get(i)!==l){o=!1;break}if(o)return a}return null}const lG=.02,cG=.05;function dG(e,t,s,r,a,o=5){var k;const i=S=>{const N=a.get(ko(S));return N&&N.gih>=An&&N.gihwr!==null?N.gihwr:null},c=new Set(t.map(S=>S.ballotId)).size;if(c===0)return[];const d=new Map,u=new Map;for(const S of t){d.set(S.cardName,(d.get(S.cardName)??0)+1);const N=u.get(S.cardName)??[];N.push({name:S.name,avatarUrl:S.avatarUrl}),u.set(S.cardName,N)}const f=S=>(d.get(S)??0)/c,h=new Map;for(const S of e){const N=h.get(S.slot)??[];N.push(S),h.set(S.slot,N)}const m=new Set,y=[],b=[];for(const S of r){const N=s.filter(P=>S.filter(P,m)).flatMap(P=>{const M=i(P.name);return M===null?[]:[{name:P.name,gihwr:M}]});if(N.length===0)continue;const C=N.reduce((P,M)=>M.gihwr>P.gihwr?M:P),_=h.get(S.key)??[],T=_.reduce((P,M)=>P+M.pickCount,0);for(const P of _){const M=i(P.cardName);if(M===null||T===0||C.gihwr-M<lG)continue;const U=P.pickCount/T;y.push({kind:"trap",slot:S.key,slotLabel:S.label,cardName:P.cardName,gihwr:M,drama:U*(C.gihwr-M),pickCount:P.pickCount,pickShare:U,slotBestName:C.name,slotBestGihwr:C.gihwr})}const E=_.reduce((P,M)=>M.pickCount>((P==null?void 0:P.pickCount)??0)?M:P,null),A=E?i(E.cardName):null;if(E&&A!==null)for(const P of N)f(P.name)>cG||P.gihwr<=A||b.push({kind:"sleeper",slot:S.key,slotLabel:S.label,cardName:P.name,gihwr:P.gihwr,drama:P.gihwr-A,teamCount:d.get(P.name)??0,teamShare:f(P.name),crowdFavName:E.cardName,crowdFavGihwr:A,voters:u.get(P.name)??[]})}const w=S=>{const N=new Map;for(const C of S){const _=N.get(C.cardName);(!_||C.drama>_.drama)&&N.set(C.cardName,C)}return Array.from(N.values()).sort((C,_)=>_.drama-C.drama)},x=[w(y),w(b)];for(const S of x){const N=((k=S[0])==null?void 0:k.drama)??1;for(const C of S)C.drama=C.drama/N}const g=x.flatMap(S=>S.slice(0,1)),v=x.flatMap(S=>S.slice(1)).sort((S,N)=>N.drama-S.drama);for(const S of v){if(g.length>=o)break;g.push(S)}return g.sort((S,N)=>N.drama-S.drama).slice(0,o)}const uG={name:"The Hobbit",release:"2026-08-11T16:00:00Z",previewsOpen:"2026-07-31T16:00:00Z",votingDeadline:"2026-08-05T16:00:00Z",scoringDate:"2026-09-02T16:00:00Z",layout:1}
496,fG={name:"Marvel Super Heroes",release:"2026-06-23T16:00:00Z",previewsOpen:"2026-06-09T00:00:00Z",votingDeadline:"2026-06-23T15:00:00Z",scoringDate:"2026-07-21T16:00:00Z",layout:1},hG={name:"Reality Fracture",release:"2026-09-29T16:00:00Z",previewsOpen:"2026-09-18T16:00:00Z",votingDeadline:"2026-09-23T16:00:00Z",scoringDate:"2026-10-21T16:00:00Z",layout:2},pG={HOB:uG,MSH:fG,FRA:hG},Lc=pG,mG=864e5,xG=28*mG;function fv(){return Object.entries(Lc).map(([e,t])=>{const s=new Date(t.release).getTime(),r=t.scoringDate?new Date(t.scoringDate).getTime():s+xG;return{code:e,name:t.name,release:s,previewsOpen:new Date(t.previewsOpen).getTime(),votingDeadline:t.votingDeadline?new Date(t.votingDeadline).getTime():s,scoringDate:r,comingSoon:t.comingSoon??!1}}).sort((e,t)=>t.release-e.release)}function LE(e){const t=fv();if(t.length===0)return null;let s=t.find(r=>e>=r.previewsOpen&&e<r.votingDeadline);return s||(s=t.find(r=>e>=r.votingDeadline&&e<r.scoringDate)),s||(s=t.find(r=>e>=r.scoringDate)),s||(s=t[t.length-1]),DE(s,t,e)}function gG(e,t){const r=fv().find(a=>a.code===e.toUpperCase());return r?DE(r,[],t):null}function DE(e,t,s){let r="frozen";s<e.previewsOpen?r="pre":s<e.votingDeadline?r="voting":s<e.scoringDate&&(r="reveal");const o=t.filter(i=>i.release>e.release).sort((i,l)=>i.release-l.release)[0];return{code:e.code,name:e.name,release:new Date(e.release),previewsOpen:new Date(e.previewsOpen),votingDeadline:new Date(e.votingDeadline),scoringDate:new Date(e.scoringDate),status:r,comingSoon:e.comingSoon,next:o?{code:o.code,name:o.name,previewsOpen:new Date(o.previewsOpen)}:void 0}}function bG(e){const t=fv(),s=t.find(r=>e>=r.previewsOpen);return t.map(r=>{let a="frozen";return r.comingSoon?a="soon":e<r.previewsOpen?a="pre":r===s&&e<r.scoringDate?a="live":r===s&&(a="results"),{code:r.code,name:r.name,release:r.release,status:a}})}function yG(e){return e.typeLine.startsWith("Basic Land")}function vG(e,t){return(s,r)=>s.rarity===t&&s.colors.length===1&&s.colors[0]===e&&!r.has(s.name)}function wG(e,t){const s=/\{([WUBRG])\/([WUBRG])\}/g;let r;for(;(r=s.exec(e))!==null;)if(r[1]===t||r[2]===t)return!0;return!1}function gk(e,t){return(s,r)=>s.rarity===t&&!r.has(s.name)&&(s.colors.length===1&&s.colors[0]===e||wG(s.manaCost,e))}const IE=["W","U","B","R","G"],ml={W:"White",U:"Blue",B:"Black",R:"Red",G:"Green"};function ME(e="Multicolor Uncommon"){return{key:"multicolor_uncommon",label:e,filter:(t,s)=>t.rarity==="uncommon"&&t.colors.length>=2&&!s.has(t.name)}}function jG(){return[...IE.map(e=>({key:`${ml[e].toLowerCase()}_common`,label:`${ml[e]} Common`,filter:vG(e,"common")})),ME(),{key:"wildcard_common",label:"Wildcard Common",filter:(e,t)=>e.rarity==="common"&&!yG(e)&&!t.has(e.name)},{key:"wildcard_uncommon",label:"Wildcard Uncommon",filter:(e,t)=>e.rarity==="uncommon"&&!t.has(e.name)}]}function kG(){return[...IE.flatMap(t=>[{key:`${ml[t].toLowerCase()}_common`,label:`${ml[t]} Common`,filter:gk(t,"common")},{key:`${ml[t].toLowerCase()}_uncommon`,label:`${ml[t]} Uncommon`,filter:gk(t,"uncommon")}]),ME("Gold Uncommon"),{key:"best_card",label:"Best Card",filter:(t,s)=>(t.rarity==="rare"||t.rarity==="mythic")&&!s.has(t.name)}]}function Um(e){return((e==null?void 0:e.layout)??1)>=2?kG():jG()}function Dc(e){return e>8}function Ft(e){return Um(Lc[e.toUpperCase()])}function SG(e,t){let s=777;const r=()=>(s=s*1103515245+12345&2147483647,s/2147483647),a=100,o=a-10,i=new Map;for(const d of e){const u=i.get(d.slot)??[];u.push(d),i.set(d.slot,u)}const l=[],c=Ft(t);for(let d=1;d<=a;d++){const u=d>o,f=new Set;for(const{key:h}of c){if(u&&r()<.4)continue;const m=i.get(h)??[];if(m.length===0)continue;const y=m.reduce((x,g)=>x+g.pickCount,0);let b=r()*y,w=null;for(const x of m)if(b-=x.pickCount,b<=0&&!f.has(x.cardName)){w=x.cardName;break}if(!w){for(const x of m)if(!f.has(x.cardName)){w=x.cardName;break}}w&&(f.add(w),l.push({setCode:t,ballotId:d,name:`Player ${d}`,avatarUrl:null,slot:h,cardName:w}))}}return l}const $E={chonce:HH,nlaframboise:VH,elfandor:qH,flutterdev:YH,oophies:JH},ef={chonce:GH,nlaframboise:KH,elfandor:ZH,flutterdev:QH,oophies:XH},NG=80,Oe=e=>new Promise(t=>setTimeout(()=>t(e),NG)),CG=()=>Oe(MH),_G=()=>Oe([]),TG=e=>Oe($H),EG=e=>Oe(UH),RG=(e,t)=>
496Oe([]),AG=e=>Oe([]),PG=()=>Oe([]),OG=(e=8)=>Oe([]),LG=e=>Oe(null),DG=()=>Oe(new Map),IG=e=>Oe(new Map),MG=e=>Oe(["Premier","Trad","Sealed","Quick","LCQ Draft 1","LCQ Draft 2"]),$G=(e,t,s)=>Oe([]),UG=e=>Oe(e==="SOS"?_E(Li,zH,"SOS"):[]),zG=e=>Oe(WH[e.toUpperCase()]??[]),BG=e=>{if(e!=="SOS")return Oe([]);const t=new Map;for(const s of Object.values(ef))for(const r of s){const a=Bt(r.colors);if(!a)continue;const o=t.get(a)??{trophies:0,events:0,players:new Set};o.events+=1,r.isTrophy&&(o.trophies+=1),o.players.add(r.slug),t.set(a,o)}return Oe(Array.from(t.entries()).map(([s,r])=>({setCode:e,colors:s,trophies:r.trophies,events:r.events,players:r.players.size})).sort((s,r)=>r.trophies-s.trophies))},FG=(e,t)=>{if(e!=="SOS")return Oe([]);const s=Li.map(r=>{const o=($E[r.slug]??zE(r)).find(i=>i.formatLabel===t);return!o||o.events===0?null:{setCode:e,slug:r.slug,displayName:r.displayName,avatarUrl:r.avatarUrl,rank:0,score:o.scoreContribution,trophies:o.trophies,events:o.events,wins:o.wins,losses:o.losses,lastCalculatedAt:r.lastCalculatedAt}}).filter(r=>r!==null).sort((r,a)=>a.score-r.score).map((r,a)=>({...r,rank:a+1}));return Oe(s)},WG=(e,t)=>{if(e==="SOS"&&t==="WR")return Oe(O1);const s=O1.slice(0,14).map((r,a)=>({...r,colors:t,rank:a+1,score:Math.max(0,r.score*(.4+Math.random()*.4)),trophies:Math.max(0,Math.round(r.trophies*.6))}));return Oe(s)},HG=(e,t,s)=>{if(e!=="SOS")return Oe([]);const r=O1.slice(10,18).map((a,o)=>({...a,colors:"OTHER",rank:o+1,score:Math.max(0,a.score*.5),trophies:Math.max(0,Math.round(a.trophies*.4))}));return Oe(r)},GG=(e,t)=>{const s=Li.find(a=>a.slug===e);if(!s)return Oe(null);const r=$E[e]??zE(s);return Oe({slug:s.slug,displayName:s.displayName,avatarUrl:s.avatarUrl,setCode:t,rank:s.rank,score:s.score,trophies:s.trophies,events:s.events,wins:s.wins,losses:s.losses,linked17lands:!0,lastCalculatedAt:s.lastCalculatedAt,formatBreakdown:r,selfReportedEvents:[]})},VG=e=>{var t;return Oe(((t=Li[0])==null?void 0:t.slug)??null)},KG=e=>{const t=Li.find(s=>s.slug===e);return Oe(t?{slug:t.slug,displayName:t.displayName,avatarUrl:t.avatarUrl}:null)},qG=(e,t)=>{const s=ef[e];return Oe(s||pv(e))},UE=100,ZG=e=>{const t=Li.find(s=>s.slug===e);return Oe(t?{slug:t.slug,displayName:t.displayName,avatarUrl:t.avatarUrl,setCode:"",rank:0,score:0,trophies:t.trophies,events:t.events,wins:t.wins,losses:t.losses,linked17lands:!0,lastCalculatedAt:t.lastCalculatedAt,formatBreakdown:[],selfReportedEvents:[],lifetime:!0,setsPlayed:[{setCode:"SOS",events:t.events,wins:t.wins,losses:t.losses,trophies:t.trophies}]}:null)},YG=(e,t=0,s=UE,r="ALL",a="ALL",o,i)=>{let l=ef[e]??pv(e);return o&&(l=l.filter(c=>c.finishedAt!=null&&c.finishedAt>=o)),i&&(l=l.filter(c=>c.finishedAt!=null&&c.finishedAt<i)),Oe(l.slice(t,t+s))},QG=(e,t="ALL",s="ALL",r,a)=>{let o=ef[e]??pv(e);r&&(o=o.filter(d=>d.finishedAt!=null&&d.finishedAt>=r)),a&&(o=o.filter(d=>d.finishedAt!=null&&d.finishedAt<a));let i=0,l=0,c=0;for(const d of o)i+=d.wins,l+=d.losses,d.isTrophy&&(c+=1);return Oe({events:o.length,wins:i,losses:l,trophies:c})},JG=(e,t=8)=>Oe(hv(e).slice(0,t)),XG=(e,t)=>Oe(hv(e).filter(s=>Xa(s.format,t))),eV=e=>Oe(hv(e));function hv(e){if(e!=="SOS")return[];const t=[];for(const s of Object.values(ef))for(const r of s){if(!r.isTrophy||!r.finishedAt)continue;const a=Li.find(o=>o.slug===r.slug);a&&t.push({setCode:e,slug:r.slug,displayName:a.displayName,avatarUrl:a.avatarUrl,format:r.format,colors:r.colors,wins:r.wins,losses:r.losses,finishedAt:r.finishedAt,endRank:r.endRank??null})}return t.sort((s,r)=>s.finishedAt<r.finishedAt?1:-1)}function zE(e){const t=["Premier","Trad","Quick","Sealed","Trad Sealed"],s=[.45,.4,.1,.04,.01];return t.map((r,a)=>{const o=s[a];return{setCode:e.setCode,slug:e.slug,formatLabel:r,events:Math.round(e.events*o),wins:Math.round(e.wins*o),losses:Math.round(e.losses*o),trophies:Math.round(e.trophies*o),scoreContribution:Math.round(e.score*o*100)/100}})}function pv(e){const t=["WR","UR","BG","WB","UB","RG","WG","UG","BR"],s=["PremierDraft","TradDraft","QuickDraft"],r=[];let a=new Date("2026-05-08T00:00:00Z").getTime();for(let o=0;o<24;o++){const i=Math.floor(Math.random()*8),l=i>=7?Math.floor(Math.random()*3):3;r.push({slug:e,setCode:"SOS",eventId:`synth-${e}-${o}`,format:s[o%s.length],expansion:"SOS",wins:i,losses:l,isTrophy:i>=7,colors:t[o%t.length],startedAt:new Date(a-1e3*60*90).toISOString(),finishedAt:new Date(a).toISOString()}),a-=1e3*60*60*(4+Math.random()*8)}return r}const tV=/\s+(?:[-–]\s+)?Table\s+(\d+)\s*$/i,sg=e=>{const t=e.match(tV);return t?Number(t[1]):1},mv=e=>{const t=Date.now(),s=new Map,r=new Map;for(const a of e)r.set(a.setCode,[...r.get(a.setCode)??[],a]);for(const a of r.values())a.filter(o=>o.kind!=="mock"&&new Date(o.eventTime).getTime()<=t).sort((o,i)=>new Date(o.eventTime).getTime()-new Date(i.eventTime).getTime()||sg(o.name)-sg(i.name)||o.eventId.localeCompare(i.eventId)).forEac
496h((o,i)=>s.set(o.eventId,i+1));return e.map(a=>({...a,ordinal:s.get(a.eventId)??null,tableIndex:sg(a.name)}))},sV=e=>Oe(mv(Mm).filter(t=>t.setCode===e)),nV=()=>Oe(mv(Mm)),rV=(e,t,s)=>BE(r=>aV(r,e,t,s)),aV=(e,t,s,r)=>e.setCode===r||e.kind!=="mock"&&e.eventDate>=t&&e.eventDate<=s,oV=()=>BE(()=>!0),BE=e=>{const t=new Map(Mm.filter(r=>r.kind!=="mock"&&e(r)).map(r=>[r.eventId,r])),s=[];for(const r of CE){const a=t.get(r.eventId);if(!a||!r.playerSlug||r.record==null)continue;const[o,i]=r.record.split("-");s.push({eventId:r.eventId,setCode:a.setCode,eventTime:a.eventTime,slug:r.playerSlug,displayName:r.playerDisplayName??r.playerSlug,avatarUrl:r.avatarUrl,placement:r.placement,wins:parseInt(o||"0",10)||0,losses:parseInt(i||"0",10)||0})}return Oe(s)},iV=e=>Oe(CE.filter(t=>t.eventId===e)),lV=e=>Oe(PH[e]??null),cV=e=>Oe(mv(Mm).find(t=>t.slug===e)??null),dV=e=>Oe(LH.filter(t=>t.eventId===e).slice().sort((t,s)=>t.round-s.round)),uV=e=>Oe(DH.filter(t=>t.eventId===e).slice().sort((t,s)=>t.gameTime<s.gameTime?-1:t.gameTime>s.gameTime?1:0)),fV=()=>Oe(IH),hV=()=>{const e=["TLA","KHM","IKO","NEO","MOM","WOE","DFT"],r=new Date;r.setDate(r.getDate()-(r.getDay()+6)%7);const a=[];for(let o=0;o<42;o++){const i=new Date(r);i.setDate(i.getDate()+o);const l=i.toISOString().slice(0,10);o===33?a.push({day:l,entries:[{label:"CHAMPS",glyph:"HOB",role:"championship"}],band:"championship"}):o===35?a.push({day:l,entries:[{label:"FRA",glyph:"FRA",role:"arrival"}],band:"arrival"}):o>35?a.push({day:l,entries:[{label:"FRA",glyph:"FRA",role:"latest"}],band:null}):o%2===0?a.push({day:l,entries:[{label:"MEMA",glyph:"MEMA",role:"cube"},{label:e[o%e.length],glyph:e[o%e.length],role:"flashback"}],band:null}):a.push({day:l,entries:[{label:"HOB",glyph:"HOB",role:"latest"},{label:"PEASANT",glyph:"PEASANT",role:"cube"}],band:null})}return Oe(a)},FE=Object.assign({
496"./fixtures/cards-fra.ts":()=>Ja(()=>import("./cards-fra-CbdqhXwf.js"),[]).then(e=>e.default),
496"./fixtures/cards-hob.ts":()=>Ja(()=>import("./cards-hob-D-9vSkVd.js"),[]).then(e=>e.default),
496"./fixtures/cards-msh.ts":()=>Ja(()=>import("./cards-msh-DpT25Kop.js"),[]).then(e=>e.default)}),xv=new Map;async function pV(e){const t=`./fixtures/cards-${e.toLowerCase()}.ts`,s=FE[t];if(!s)throw new Error(`No card fixture for set ${e}`);return s()}const mV=e=>Oe([...xv.values()]),xV=async(e,t,s)=>{xv.set(t,{slot:t,cardName:s,lastUpdated:new Date().toISOString()})},gV=async e=>{xv.clear()},bk=new Map;function gv(e){let t=bk.get(e);if(!t){const s=`./fixtures/cards-${e.toLowerCase()}.ts`,r=FE[s];if(!r)throw new Error(`No card fixture for set ${e}`);t=r().then(a=>{const o=kV(a,e),i=SV(a,e),l=SG(o,e);return{stats:o,ratings:i,ballots:l}}),bk.set(e,t)}return t}const bV=e=>gv(e).then(t=>t.stats),yV=91;function vV(e,t){for(let s=e.length-1;s>0;s--){const r=Math.floor(t()*(s+1));[e[s],e[r]]=[e[r],e[s]]}return e}function wV(e,t){const s=e.reduce((c,d)=>c+d,0),r=e.map(c=>c/s*t),a=r.map(Math.floor),o=r.map((c,d)=>({i:d,frac:c-Math.floor(c)})).sort((c,d)=>d.frac-c.frac);let i=a.reduce((c,d)=>c+d,0),l=0;for(;i<t;)a[o[l%o.length].i]+=1,i+=1,l+=1;return a}const jV=new Set;function kV(e,t){let s=42;const r=()=>(s=s*1103515245+12345&2147483647,s/2147483647),a=yV,o=[];for(const i of Um(Lc[t])){const l=vV(e.filter(h=>i.filter(h,jV)),r);if(l.length===0)continue;const c=1.1+r()*.8,d=l.map((h,m)=>1/Math.pow(m+1,c)),u=wV(d,a),f=l.map((h,m)=>({setCode:t,slot:i.key,cardName:h.name,pickCount:u[m],pickPct:Math.round(u[m]*1e3/a)/10})).filter(h=>h.pickCount>0).sort((h,m)=>m.pickCount-h.pickCount);o.push(...f)}return o}function SV(e,t){let s=137;const r=()=>(s=s*1103515245+12345&2147483647,s/2147483647),a=e.map(o=>({card_name:o.name,gihwr:.44+r()*.21,gih:Math.floor(An+r()*8e3)}));return{setCode:t,phase:"midway",dateRange:{start:"2026-06-23",end:"2026-07-07"},cards:a}}const NV=e=>gv(e).then(t=>t.ratings),CV=e=>gv(e).then(t=>t.ballots),_V={id:"mock-user-id",discordId:"123456789",username:"MockPlayer",avatarUrl:null},TV=Object.freeze(Object.defineProperty({__proto__:null,LIFETIME_EVENTS_PAGE:UE,deleteAllP0P1Picks:gV,fetchAllPodEvents:nV,fetchAllPodResults:oV,fetchAllRecentTrophies:eV,fetchAvailableFormats:MG,fetchColorsLeaderboard:WG,fetchColorsSummary:BG,fetchCubeSeasons:_G,fetchDbEpisodes:PG,fetchEpisodeTranscript:LG,fetchFormatColorsLeaderboard:$G,fetchFormatLeaderboard:FG,fetchFormatRecentTrophies:XG,fetchLeaderboard:UG,fetchLifetimeDraftEvents:YG,fetchLifetimeProfile:ZG,fetchLifetimeStats:QG,fetchOtherColorsLeaderboard:HG,fetchP0P1Ballots:CV,fetchP0P1Cards:pV,fetchP0P1PickStats:bV,fetchP0P1Picks:mV,fetchP0P1Ratings:NV,fetchPlayerDraftEvents:qG,fetchPlayerIdentity:KG,fetchPlayerProfile:GG,fetchPlayerSlugByDiscordId:VG,fetchPodArchetypes:EG,fetchPodCalendar:hV,fetchPodCardDecks:RG,fetchPodCardStats:TG,fetchPodDeckCards:AG,fetchPodDraftArtifact:lV,fetchPodEventBySlug:cV,fetchPodEventMatches:dV,fetchPodEventParticipants:iV,fetchPodEventReplays:uV,fetchPodEvents:sV,fetchPodSeasonResults:rV,fetchPodSetCodes:fV,fetchRecentDbEpisodes:OG,fetchRecentTrophies:JG,fetchSetReviewMentions:IG,fetchSets:CG,fetchTranscriptIndex:DG,fetchTrophyLeaderboard:zG,initialAuthUser:_V,upsertP0P1Pick:xV},Symbol.toStringTag,{value:"Module"})),EV=e=>e.replace(/_([a-z0-9])/g,(t,s)=>s.toUpperCase()),tf=e=>{const t={};for(const s in e)t[EV(s)]=e[s];return t},yk=e=>tf(e),RV=e=>tf(e),AV=e=>{const t=tf(e);return t.scoreContribution=0,t},WE=e=>tf(e),bv=e=>{const t=tf(e);return t.colors=t.colors??"",t.isTrophy=t.isTrophy??!0,t.format=t.format??null,t},yi=["Set Review","Metagame","Draft","Sealed","Rankings","Coaching","Guest","Evergreen"];function En(e){return e.toLowerCase().replace(/\s+/g,"-")}const PV=new Map(yi.map(e=>[En(e),e]));function HE(e){return PV.get(e.toLowerCase())??null}const OV=90,LV=180,DV=/#\w/;function GE(e,t,s){return e!=="video"||t<=0?!1:t<=OV?!0:t<=LV&&DV.test(s)}const IV=/coach/i,MV=/\bconversation with\b|\bjoins (?:me|us)\b|\bft\.?\b|featuring|sits down with|\binterview\b/i,$V=/top \d|top ten|tier ?list|\brank(?:ing|ed)\b|best and worst|props and slops|ranked every|best of \d|worst of/i,UV=/set review|set overview|card evaluation|archetype deep dive|commons|uncommons|\brares\b|mythics|signpost|the list/i,zV=/sealed|pre-?release/i,BV=/state of the format|format (?:address|update|breakdown|send|recap)|metagame|\bmeta\b|what we got wrong|win ?rate|tournament report|pro tour/i,FV=/level-?up|gameplay mistake|deckbuilding|deck building|mulligan|manabase|mana ?base|fundamentals|\bhabits\b|intuition|mental game|\bsignals\b|card advantage|navigation/i,WV=/draft|drafting|\bdeck\b|archetype/i;function VE(e){return IV.test(e)?"Coaching":MV.test(e)?"Guest":$V.test(e)?"Rankings":UV.test(e)?"Set Review":zV.test(e)?"Sealed":BV.test(e)?"Metagame":FV.test(e)?"Evergreen":WV.test(e)?"Draft":"Evergreen"}const HV=new Set(yi);function GV(e,t){return t&&HV.has(t)?t:VE(e)}function VV(e){return ZE(e).toLowerCase().replace(/['’]/g,"").replace(/&/g," and ").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80).replace(/-+$/g,"")||"episode"}function KE(e){return VV(e.title)}function qE(e){return e.map(t=>({...t,slug:KE(t)}))}function vd(e,t){const s=t.toLowerCase();for(const r of e)if(r.slug===s)return r;return null}function KV(e){const t=e.match(/#\s*(\d+)/);return t?Number(t[1]):null}function ZE(e){return e.replace(/^(?:llu|limited level-?ups)\s*#?\s*\d+\s*[:\-–]\s*/i,"").trim()||e}function YE(e){if(!e)return"";const t=Math.floor(e/3600),s=Math.round(e%3600/60);return t?`${t}h ${s}m`:`${s}m`}function qV(e){if(!e)return"";const t=Math.round(e/60);return t<60?`${t}m`:`${Math.round(t/30)/2}h`}function QE(e){const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function JE(e){return{id:e.guid,kind:e.kind,number:e.number,title:e.title,link:e.link,audioUrl:e.audio_url??"",pubDate:e.published_at,publishedLabel:QE(e.published_at),durationLabel:YE(e.duration_seconds),durationSeconds:e.duration_seconds,image:e.image??"",category:GV(e.title,e.category),youtubeId:e.youtube_id??void 0,videoUrl:e.youtube_id?`https://www.youtube.com/watch?v=${e.youtube_id}`:void 0,setCode:e.set_code,setName:e.set_name,setReleasedAt:e.set_released_at,isShort:GE(e.kind,e.duration_seconds,e.title),hasTranscript:!!e.has_transcript}}const zm=e=>e.split(" // ")[0].toLowerCase();function ZV(e,t,s,r=14){const a=zm(s),o=[];for(let i=t;i<e.length&&o.length<r;i+=1){const l=e[i];if(i>t&&YV(l,a))break;o.push(l)}return o}function YV(e,t){if(e.heading)return!0;
496if(!e.subheading)return!1;for(const s of e.cards??[])if(zm(s.name)!==t)return!0;return!1}const QV=["FRA","HOB","MSH","SOS","TMT","ECL","TLA","EOE","FIN","TDM","DFT","FDN","DSK","BLB","MH3","WOE","MOM","VOW","STX","PIO","MKM","LCI","LTR","ONE","BRO","DMU","HBG","SNC","NEO","MID","AFR","IKO","ELD","KTK","OTJ"],JV={sets:QV},_s="FRA",XV="Reality Fracture",$d="Limited Level-Ups",eK=" | ",tK=["public_player","public_self_reported_events","public_pod_scoring"],XE={FRA:"643f4ffbcde34632adca80bce7fdcdd9",HOB:"528d1c45d1f04b59abac2a897a8928c8",MSH:"1c86af8656f7432c83d9f9bb9c92f9df",SOS:"e195401b1eaa48e3b5d6670e0ae338e9",TMT:"fd5499ae88854ca0ac1bc2ad95ade9b2",ECL:"1745e64176864bb2bec132cbd601b604",TLA:"efdfa8408fb448be846ac06f9d9192ff",SPM:"4f9e6dc9c48c4052805dcfa65568c964",EOE:"4f34ccc070464c6c90f85c78972ee6ac",FIN:"90be207ac0e34b8ea20ae396c434cbae",TDM:"dd9c5b6db6b94ce0bbf3fd285625ceb9",DFT:"b0f9dbffd24843d5b8b693f30bc8b1e9",FDN:"597d29e75d704ecf9877fc0e4b2c4116",DSK:"edec3f514f264753bf4a46a8a2fc7d82",BLB:"6057e51272c94a7cb304bd511b7c3bcf",MH3:"14b36e19f924475fb93badb9268174a4",WOE:"87b40a05e0974eafa368be44e1d3e0c4",MOM:"a7daeb6a90b246e895c8634e34734090",VOW:"ac2ca9722737412ba0c4c4c4b2e28598",STX:"a2753035da8646038f55b7321de1dfc9",PIO:"22b77386e0354d84827e732c226ebc91",MKM:"a5c17edddaea4680a28126dae2a5178f",LCI:"b8dad7059ff24da28da636a1c50da7e8",LTR:"aa685e825b12489a83f081dec8dc308d",ONE:"959517c42af04b909ddb6456904b7001",BRO:"b8d4ba9d1bad49828bfa6371f6b4f09b",DMU:"e12ee0b1fadc4ab7b8de4c3730878a90",HBG:"d24c2d28b6aa4146912b2ca92c503fe1",SNC:"8513f3fa48f140c0a4792862f530dea9",NEO:"0b2b04f23e104ddba3501cd009385d60",MID:"ef928c7c17bb4f57b09a75be5daf7df9",AFR:"1d901171375f4cff9834c751667c4254",IKO:"db593297907e41af93eedd994e26da28",ELD:"30588ade239246d0ab12393d00dc801a",KTK:"a6346d2850ef45918508db61d057388e"},eR={FRA:[{name:"Alex",uid:"24d7fb5b20194808834be19680ae0d8d"},{name:"Marc",uid:"e95fd9365a86464cae2451e34c39102a"}],MSH:[{name:"Alex",uid:"b07c077b8c8145288f75d71bf4f90d65"},{name:"Marc",uid:"e0c4c50e90914ac390a1f792e0717ed2"}],SOS:[{name:"Alex",uid:"3dda4b67b4b0403caeb0a744887b0208"},{name:"Marc",uid:"09ccc33bf4d6461f9c73de01bd8efe0c"}],TMT:[{name:"Alex",uid:"c1489602e3d544d9aa90718692f16a32"},{name:"Marc",uid:"a8a502ee50d84a31b6a501bb6b4d5920"}],ECL:[{name:"Alex",uid:"4f09f4891cc148f0bb7afe510d4605ec"},{name:"Marc",uid:"0fef073a7db5401ba7e260e8649f2bea"}],TLA:[{name:"Alex",uid:"6554520225504ef9a3d5360c062a8274"},{name:"Marc",uid:"10ab962ac03b4774b7cd2cb8bec152af"}],SPM:[{name:"Alex",uid:"78638999335b4900b961503d6f58c4a9"},{name:"Marc",uid:"796eb012eb3b4081929da9679ea577d0"}],EOE:[{name:"Alex",uid:"13384ec719b74936b0c700126469a22a"},{name:"Marc",uid:"969006b0242e4ab4bfd9b85e3fe4c73e"}],FIN:[{name:"Alex",uid:"9f907d1c51834c4696383aa30f65523a"},{name:"Marc",uid:"35157ab6c45a48a2aabc92853e389af3"}],TDM:[{name:"Alex",uid:"b13d129e71b8467dab4de66f770c6b10"},{name:"Marc",uid:"bb8970942c3d4e42bd0fe91528befada"}],OTJ:[{name:"Alex",uid:"df75c79fba154f21b4a8bf751b8aa0a4"},{name:"Marc",uid:"317fe1336cac48c8b3a2d731a844ccbe"}]},vk=e=>{var t;return!!XE[e]||(((t=eR[e])==null?void 0:t.length)??0)>0},sK=JV.sets,nK={FRA:{name:"Reality Fracture",startDate:"2026-09-29"},HOB:{name:"The Hobbit",startDate:"2026-08-11"},MSH:{name:"Marvel Super Heroes",startDate:"2026-06-23"},MH3:{name:"Modern Horizons 3",startDate:"2024-06-11"},MOM:{name:"March of the Machine",startDate:"2023-04-18"}
496,VOW:{name:"Innistrad: Crimson Vow",startDate:"2021-11-11"}},rK="/api/tier-list",aK={};function de(){if(!$t)throw new Error("Supabase client is not configured");return $t}const ng=1e3;async function ju(e){const t=[];for(let s=0;;s+=ng){const{data:r,error:a}=await e(s,s+ng-1);if(a)throw a;const o=r??[];if(t.push(...o),o.length<ng)break}return t}const yv="ArenaDirect_Sealed",vv=Lr("LCQ Draft 2"),oK=e=>_n(e)?"public_cube_season_events":"public_player_draft_events";async function iK(){const{data:e,error:t}=await de().from("public_episodes").select(tR).order("published_at",{ascending:!1});if(t)throw t;return(e??[]).map(s=>JE(s))}async function lK(e=8){const{data:t,error:s}=await de().from("public_episodes").select(tR).order("published_at",{ascending:!1}).limit(e);if(s)throw s;return(t??[]).map(r=>JE(r))}const tR="guid, kind, number, title, link, image, published_at, duration_seconds, audio_url, youtube_id, category, set_code, set_name, set_released_at, has_transcript";async function cK(e){if(rv){const[r]=await wv(`/api/transcript/${e}`);return(r==null?void 0:r.segments)??null}const{data:t,error:s}=await de().from("public_episode_transcripts").select("segments").eq("youtube_id",e).maybeSingle();if(s)throw s;return(t==null?void 0:t.segments)??null}async function dK(e){const t=rv?await wv(`/api/set-review-mentions/${e}`):await uK(e),s=new Map;for(const r of t){const a={youtubeId:r.youtube_id,title:r.title,segmentIndex:r.segment_index,t:r.t};s.set(zm(r.card_name),a)}return s}async function uK(e){const{data:t,error:s}=await de().from("public_set_review_card_mentions").select("card_name, youtube_id, title, segment_index, t").eq("set_code",e);if(s)throw s;return t??[]}async function wv(e){const t=await fetch(e);if(!t.ok)throw new Error(`${e} failed with ${t.status}`);return await t.json()}async function fK(){const{data:e,error:t}=await de().from("public_episode_transcripts").select("youtube_id, source, word_count, sections, subsections");if(t)throw t;const s=new Map,r=e??[];for(const a of r)s.set(a.youtube_id,{source:a.source,wordCount:a.word_count,sections:a.sections,subsections:a.subsections});return s}async function hK(){const{data:e,error:t}=await de().from("public_cube_seasons").select("*").order("start_date",{ascending:!1});if(t)throw t;return(e??[]).map(s=>{const r=s;return{setCode:r.set_code,kind:r.kind,label:r.label,name:r.name??null,startDate:r.start_date,firstEvent:r.first_event,lastEvent:r.last_event,events:r.events??0,players:r.players??0}})}async function pK(){const{data:e,error:t}=await de().from("public_pod_calendar").select("day, entries, band").order("day",{ascending:!0});if(t)throw t;return(e??[]).map(s=>{const r=s;return{day:r.day,entries:r.entries??[],band:r.band??null}})}async function mK(e){return ju((t,s)=>de().from("public_pod_card_stats").select("*").eq("set_code",e).range(t,s))}async function xK(e,t){const{data:s,error:r}=await de().from("public_pod_card_decks").select("*").eq("set_code",e).eq("card_name",t);if(r)throw r;return s??[]}async function gK(e){return e.length===0?[]:ju((t,s)=>de().from("public_pod_card_decks").select("event_id,seat,card_name,card_set").in("event_id",e).eq("maindecked",!0).order("event_id").range(t,s))}async function bK(e){const{data:t,error:s}=await de().from("public_pod_archetype_stats").select("*").eq("set_code",e);if(s)throw s;return(t??[]).map(r=>r)}async function yK(){if(rv)return(await wv("/api/sets")).map(yk);const{data:e,error:t}=await de().from("public_sets").select("*").order("start_date",{ascending:!1});if(t)throw t;return(e??[]).map(s=>yk(s))}async function vK(e,t,s){if(t==="Pod"){const o=Array.isArray(s)?s[0]:s;return Nv(e,o,null)}const r=Array.isArray(s)?s:[s];if(r.length===0)return[];const a=r.length===1?r[0]:r.join(",");return kv(e,a,jv(r),t)}async function wK(e){if(_n(e)){const{data:o,error:i}=await de().from("public_cube_season_breakdown").select("format_label").eq("set_code",e);if(i)throw i;return Array.from(new Set((o??[]).map(l=>l.format_label)))}const[t,s,r]=await Promise.all([de().from("public_player_format_breakdown").select("format_label").eq("set_code",e),de().from("public_player_pod_stats").select("set_code",{count:"exact",head:!0}).eq("set_code",e),de().from("public_player_draft_events").select("set_code",{count:"exact",head:!0}).eq("set_code",e).eq("format",yv)]);if(t.error)throw t.error;if(s.error)throw s.error;if(r.error)throw r.error;const a=new Set((t.data??[]).map(o=>o.format_label));return(s.count??0)>0&&a.add("Pod"),(r.count??0)>0&&a.add("Direct"),Array.from(a)}async function sR(e){if(_n(e))return kK(e);const[t,s,r,a]=await Promise.all([de().from("public_leaderboard").select("slug, display_name, avatar_url, trophies, events, wins, losses, last_calculated_at").eq("set_code",e),de().from("public_player_format_breakdown").select("slug, format_label, events, wins, losses, trophies, weighted_trophies").eq("set_code",e),de().from("public_pod_scoring").select("slug, display_name, avatar_url, trophies, two_win_finishes, one_win_finishes, leaderboard_opt_in").eq("set_code",e),de().from("public_self_reported_events").select("slug, display_name, avatar_url, is_trophy").eq("set_code",e)]);if(t.error)throw t.error;if(s.error)throw s.error;if(r.error)throw r.error;if(a.error)throw a.error;const o=new Map;for(const c of s.data??[]){const d=c,u=d.slug,f=o.get(u)??[];
496f.push({label:d.format_label,events:d.events??0,wins:d.wins??0,losses:d.losses??0,trophies:d.trophies??0,weightedTrophies:d.weighted_trophies}),o.set(u,f)}const i=new Map;for(const c of t.data??[]){const d=c,u=d.slug;i.set(u,{setCode:e,slug:u,displayName:d.display_name,avatarUrl:d.avatar_url??null,rank:0,score:Py(o.get(u)??[]),trophies:d.trophies??0,events:d.events??0,wins:d.wins??0,losses:d.losses??0,lastCalculatedAt:d.last_calculated_at??new Date(0).toISOString()})}for(const c of r.data??[]){const d=c;if(d.leaderboard_opt_in===!1)continue;const u=d.trophies??0,f=jm(u,d.two_win_finishes??0,d.one_win_finishes??0);if(f===0)continue;const h=d.slug,m=i.get(h);m?(m.score=Math.round((m.score+f)*100)/100,m.trophies+=u):i.set(h,{setCode:e,slug:h,displayName:d.display_name??h,avatarUrl:d.avatar_url??null,rank:0,score:f,trophies:u,events:0,wins:0,losses:0,lastCalculatedAt:new Date(0).toISOString()})}const l=new Map;for(const c of a.data??[]){const d=c;if(d.is_trophy!==!0)continue;const u=d.slug,f=l.get(u);f?f.trophies+=1:l.set(u,{slug:u,displayName:d.display_name??u,avatarUrl:d.avatar_url??null,trophies:1})}return _E([...i.values()],[...l.values()],e)}async function jK(e){const{data:t,error:s}=await de().from("public_self_reported_events").select("*").eq("set_code",e).order("reported_at",{ascending:!1});if(s)throw s;const r=new Map;for(const a of t??[]){const o=a,i=o.slug,l=bv(o),c=r.get(i);c?(c.trophies+=l.isTrophy?1:0,c.deckCount+=1,c.decks.push(l)):r.set(i,{setCode:e,slug:i,displayName:o.display_name??i,avatarUrl:o.avatar_url??null,rank:0,trophies:l.isTrophy?1:0,deckCount:1,decks:[l]})}return[...r.values()].sort((a,o)=>o.trophies-a.trophies||o.deckCount-a.deckCount||o.decks[0].reportedAt.localeCompare(a.decks[0].reportedAt)).map((a,o)=>({...a,rank:o+1}))}async function nR(){var s;const{data:e,error:t}=await de().from("public_leaderboard").select("last_calculated_at").eq("set_code",rs).limit(1);if(t)throw t;return((s=e==null?void 0:e[0])==null?void 0:s.last_calculated_at)??new Date(0).toISOString()}async function kK(e){const{rows:t,lastCalculatedAt:s}=await rR(e);return aR(e,t,s)}async function rR(e){const[t,s]=await Promise.all([de().from("public_cube_season_breakdown").select("*").eq("set_code",e),nR()]);if(t.error)throw t.error;return{rows:t.data??[],lastCalculatedAt:s}}function aR(e,t,s){const r=new Map;for(const a of t){const o=a,i=o.slug;let l=r.get(i);l||(l={displayName:o.display_name??i,avatarUrl:o.avatar_url??null,groups:[],trophies:0,events:0,wins:0,losses:0},r.set(i,l));const c=o.events??0,d=o.wins??0,u=o.losses??0,f=o.trophies??0;l.groups.push({label:o.format_label,events:c,wins:d,losses:u,trophies:f}),l.events+=c,l.wins+=d,l.losses+=u,l.trophies+=f}return[...r.entries()].map(([a,o])=>({setCode:e,slug:a,displayName:o.displayName,avatarUrl:o.avatarUrl,rank:0,score:Py(o.groups),trophies:o.trophies,events:o.events,wins:o.wins,losses:o.losses,lastCalculatedAt:s})).sort((a,o)=>o.score!==a.score?o.score-a.score:a.displayName.localeCompare(o.displayName)).map((a,o)=>({...a,rank:o+1}))}async function SK(e,t){if(t==="Pod"){const{data:u,error:f}=await de().from("public_pod_scoring").select("*").eq("set_code",e);if(f)throw f;return(u??[]).map(h=>{const m=h,y=m.trophies??0,b=m.two_win_finishes??0,w=m.one_win_finishes??0;return{setCode:e,slug:m.slug,displayName:m.display_name??m.slug,avatarUrl:m.avatar_url??null,rank:0,score:jm(y,b,w),trophies:y,events:m.events??0,wins:m.wins??0,losses:m.losses??0,lastCalculatedAt:new Date(0).toISOString()}}).sort((h,m)=>m.score!==h.score?m.score-h.score:h.displayName.localeCompare(m.displayName)).map((h,m)=>({...h,rank:m+1}))}if(t==="Direct")return _K(e);if(_n(e))return NK(e,t);const s=bi[t]??[t],r=new Set(s),[a,o]=await Promise.all([de().from("public_player_format_breakdown").select("*").eq("set_code",e),de().from("public_leaderboard").select("slug, display_name, avatar_url, last_calculated_at").eq("set_code",e)]);if(a.error)throw a.error;if(o.error)throw o.error;const i=new Map((o.data??[]).map(u=>[u.slug,u])),l=new Map,c=new Map;for(const u of a.data??[]){const f=u,h=f.slug,m=f.events??0;if(m<=0||!i.has(h))continue;
496const y=f.format_label,b=f.wins??0,w=f.losses??0,x=f.trophies??0,g=l.get(h)??[];if(g.push({label:y,events:m,wins:b,losses:w,trophies:x,weightedTrophies:f.weighted_trophies}),l.set(h,g),!r.has(y))continue;const v=c.get(h)??{trophies:0,events:0,wins:0,losses:0};v.trophies+=x,v.events+=m,v.wins+=b,v.losses+=w,c.set(h,v)}const d=[];for(const[u,f]of c){const h=i.get(u),m=vo(l.get(u)??[]).contributionByLabel;let y=0;for(const b of s)y+=m.get(b)??0;d.push({setCode:e,slug:u,displayName:h.display_name,avatarUrl:h.avatar_url??null,rank:0,score:Math.round(y*100)/100,trophies:f.trophies,events:f.events,wins:f.wins,losses:f.losses,lastCalculatedAt:h.last_calculated_at})}if(t==="LCQ"){const u=await CK(e);for(const f of d)f.earnings=u.get(f.slug)??0}return d.sort((u,f)=>f.score-u.score).map((u,f)=>({...u,rank:f+1}))}async function NK(e,t){const s=bi[t]??[t],[r,a]=await Promise.all([de().from("public_cube_season_breakdown").select("*").eq("set_code",e).in("format_label",s),nR()]);if(r.error)throw r.error;const o=r.data,i=new Map;for(const l of o??[]){const c=l,d=c.events??0;if(d<=0)continue;const u=c.slug;let f=i.get(u);f||(f={displayName:c.display_name??u,avatarUrl:c.avatar_url??null,groups:[],trophies:0,events:0,wins:0,losses:0},i.set(u,f));const h=c.wins??0,m=c.losses??0,y=c.trophies??0;f.groups.push({label:c.format_label,events:d,wins:h,losses:m,trophies:y}),f.events+=d,f.wins+=h,f.losses+=m,f.trophies+=y}return[...i.entries()].map(([l,c])=>({setCode:e,slug:l,displayName:c.displayName,avatarUrl:c.avatarUrl,rank:0,score:Py(c.groups),trophies:c.trophies,events:c.events,wins:c.wins,losses:c.losses,lastCalculatedAt:a})).sort((l,c)=>c.score-l.score).map((l,c)=>({...l,rank:c+1}))}async function CK(e){const{data:t,error:s}=await de().from("public_player_draft_events").select("slug, wins").eq("set_code",e).in("format",vv);if(s)throw s;const r=new Map;for(const a of t??[]){const o=Oy(a.wins??0);o>0&&r.set(a.slug,(r.get(a.slug)??0)+o)}return r}async function _K(e){const t=[];for(let l=0;;l+=1e3){const{data:c,error:d}=await de().from("public_player_draft_events").select("slug, wins, losses, is_trophy, finished_at").eq("set_code",e).eq("format",yv).range(l,l+1e3-1);if(d)throw d;const u=c??[];if(t.push(...u),u.length<1e3)break}const r=await de().from("public_leaderboard").select("slug, display_name, avatar_url, last_calculated_at").eq("set_code",e);if(r.error)throw r.error;const a=new Map;for(const l of r.data??[])a.set(l.slug,l);const o=new Map;for(const l of t){const c=l.slug;let d=o.get(c);d||(d={boxes:0,trophies:0,events:0,wins:0,losses:0,lastFinishedAt:""},o.set(c,d));const u=l.wins??0,f=l.finished_at??"";d.events+=1,d.wins+=u,d.losses+=l.losses??0,l.is_trophy&&(d.trophies+=1),d.boxes+=B3(e,u,f||null,!!l.is_trophy),f>d.lastFinishedAt&&(d.lastFinishedAt=f)}const i=[];for(const[l,c]of o){if(c.events===0)continue;const d=a.get(l);i.push({setCode:e,slug:l,displayName:(d==null?void 0:d.display_name)??l,avatarUrl:(d==null?void 0:d.avatar_url)??null,rank:0,score:0,boxes:c.boxes,trophies:c.trophies,events:c.events,wins:c.wins,losses:c.losses,lastCalculatedAt:c.lastFinishedAt||((d==null?void 0:d.last_calculated_at)??new Date(0).toISOString())})}return i.sort((l,c)=>{if(c.boxes!==l.boxes)return(c.boxes??0)-(l.boxes??0);if(c.trophies!==l.trophies)return c.trophies-l.trophies;const d=l.wins/Math.max(1,l.wins+l.losses),u=c.wins/Math.max(1,c.wins+c.losses);return u!==d?u-d:l.slug.localeCompare(c.slug)}).map((l,c)=>({...l,rank:c+1}))}async function TK(e){const{data:t,error:s}=await de().from("public_colors_summary").select("colors, trophies, events, players").eq("set_code",e);if(s)throw s;return(t??[]).map(r=>{const a=r;return{setCode:e,colors:a.colors,trophies:a.trophies??0,events:a.events??0,players:a.players??0}}).sort((r,a)=>a.trophies-r.trophies)}async function EK(e,t){return kv(e,t,jv([t]),null)}async function RK(e,t,s){return t.length===0?[]:s==="Pod"?Nv(e,kt,t):kv(e,kt,jv(t),s)}function jv(e){return{combos:e.filter(t=>t!==it),includeMulti:e.includes(it)}}function AK(e,t){return t.includeMulti&&e.is_multi===!0?!0:t.combos.includes(e.main_colors??"")}async function kv(e,t,s,r){if(r==="Pod")return Nv(e,t,null);
496const a=r?Oc[r]??[r]:null,o=a?new Set(a):null,i=_n(e),l="slug, format, wins, losses, is_trophy, finished_at, main_colors, is_multi",c=i?`${l}, display_name, avatar_url`:l;let d=de().from("public_color_events").select(c).eq("set_code",e);s.includeMulti&&s.combos.length>0?d=d.or(`is_multi.eq.true,main_colors.in.(${s.combos.join(",")})`):s.includeMulti?d=d.eq("is_multi",!0):s.combos.length>0&&(d=d.in("main_colors",s.combos));const{data:u,error:f}=await d;if(f)throw f;const h=u??[],m=new Map;if(i)for(const w of h){const x=w.slug;m.has(x)||m.set(x,{slug:x,display_name:w.display_name,avatar_url:w.avatar_url})}else{const w=await de().from("public_leaderboard").select("slug, display_name, avatar_url, last_calculated_at").eq("set_code",e);if(w.error)throw w.error;for(const x of w.data??[])m.set(x.slug,x)}const y=new Map;for(const w of h){if(!AK(w,s))continue;const x=w.slug,g=w.format??"";if(o&&!o.has(g))continue;const v=w.wins??0,k=w.losses??0,S=!!w.is_trophy,N=w.finished_at??"";let C=y.get(x);C||(C={formatRows:[],events:0,trophies:0,wins:0,losses:0,boxes:0,earnings:0,lastFinishedAt:""},y.set(x,C)),C.events+=1,C.wins+=v,C.losses+=k,S&&(C.trophies+=1),g===yv&&(C.boxes+=B3(e,v,N||null,S)),vv.includes(g)&&(C.earnings+=Oy(v)),C.formatRows.push({format:g,wins:v,losses:k,trophies:S?1:0,events:1}),N>C.lastFinishedAt&&(C.lastFinishedAt=N)}const b=[];for(const[w,x]of y){if(x.events===0)continue;const g=m.get(w);b.push({setCode:e,colors:t,slug:w,displayName:(g==null?void 0:g.display_name)??w,avatarUrl:(g==null?void 0:g.avatar_url)??null,rank:0,score:z3(x.formatRows),trophies:x.trophies,events:x.events,wins:x.wins,losses:x.losses,boxes:x.boxes,earnings:x.earnings,lastCalculatedAt:x.lastFinishedAt||((g==null?void 0:g.last_calculated_at)??new Date(0).toISOString())})}return b.sort((w,x)=>{if(r==="Direct"&&w.boxes!==x.boxes)return(x.boxes??0)-(w.boxes??0);if(x.score!==w.score)return x.score-w.score;const g=w.wins/Math.max(1,w.wins+w.losses),v=x.wins/Math.max(1,x.wins+x.losses);return v!==g?v-g:w.slug.localeCompare(x.slug)}).map((w,x)=>({...w,rank:x+1}))}async function PK(e,t){const{rows:s,lastCalculatedAt:r}=await rR(t),a=s.filter(d=>d.slug===e);if(a.length===0)return null;const o=aR(t,s,r).find(d=>d.slug===e),i=a.map(d=>({setCode:t,slug:e,formatLabel:d.format_label,events:d.events??0,wins:d.wins??0,losses:d.losses??0,trophies:d.trophies??0,scoreContribution:0})),l=vo(Ay(i));for(const d of i)d.scoreContribution=Math.round((l.contributionByLabel.get(d.formatLabel)??0)*100)/100;const c=d=>i.reduce((u,f)=>u+d(f),0);return{slug:e,displayName:(o==null?void 0:o.displayName)??a[0].display_name??e,avatarUrl:(o==null?void 0:o.avatarUrl)??a[0].avatar_url??null,setCode:t,rank:(o==null?void 0:o.rank)??0,score:(o==null?void 0:o.score)??0,trophies:c(d=>d.trophies),events:c(d=>d.events),wins:c(d=>d.wins),losses:c(d=>d.losses),linked17lands:!0,lastCalculatedAt:r,formatBreakdown:i,selfReportedEvents:[]}}async function OK(e,t){if(_n(t))return PK(e,t);t=Tc(t);const[s,r,a,o]=await Promise.all([de().from("public_player").select("*").eq("set_code",t).eq("slug",e).maybeSingle(),de().from("public_player_format_breakdown").select("*").eq("set_code",t).eq("slug",e),de().from("public_pod_scoring").select("*").eq("set_code",t).eq("slug",e).maybeSingle(),de().from("public_self_reported_events").select("*").eq("set_code",t).eq("slug",e).order("reported_at",{ascending:!1})]);if(s.error)throw s.error;if(r.error)throw r.error;if(a.error)throw a.error;if(o.error)throw o.error;const i=o.data??[];if(!s.data&&!a.data&&i.length===0)return null;let l;s.data?l=RV(s.data):a.data?l=DK(e,t,a.data):l=IK(e,t,i[0]);const c=(r.data??[]).map(x=>AV(x)),d=vo(Ay(c));
496for(const x of c)x.scoreContribution=Math.round((d.contributionByLabel.get(x.formatLabel)??0)*100)/100;let u=0,f=0,h=0,m=0;if(a.data){const x=a.data;u=x.trophies??0,f=x.events??0,h=x.wins??0,m=x.losses??0;const g=x.two_win_finishes??0,v=x.one_win_finishes??0,k=jm(u,g,v);k>0&&c.push({setCode:t,slug:e,formatLabel:"Pod",events:f,wins:h,losses:m,trophies:u,twoWins:g,oneWins:v,scoreContribution:k})}const y=!!s.data,w=(await sR(t)).find(x=>x.slug===e);return{slug:l.slug,displayName:l.displayName,avatarUrl:l.avatarUrl,setCode:l.setCode,rank:(w==null?void 0:w.rank)??0,score:(w==null?void 0:w.score)??0,trophies:l.trophies+u,events:l.events+(y?f:0),wins:l.wins+(y?h:0),losses:l.losses+(y?m:0),linked17lands:!!s.data,lastCalculatedAt:l.lastCalculatedAt||void 0,formatBreakdown:c,selfReportedEvents:i.map(x=>bv(x))}}async function LK(e){const[t,s,r]=await Promise.all([de().from("public_player").select("*").eq("slug",e),de().from("public_pod_scoring").select("*").eq("slug",e),de().from("public_self_reported_events").select("*").eq("slug",e).order("reported_at",{ascending:!1})]);if(t.error)throw t.error;if(s.error)throw s.error;if(r.error)throw r.error;const a=t.data??[],o=s.data??[],i=r.data??[];if(a.length===0&&o.length===0&&i.length===0)return null;const l=(g,v)=>g[v]??0,c=new Map,d=(g,v)=>{if(!g)return;const k=c.get(g)??{setCode:g,events:0,wins:0,losses:0,trophies:0};c.set(g,v(k))};let u=0,f=0,h=0,m=0,y="";for(const g of a){const v=l(g,"events"),k=l(g,"wins"),S=l(g,"losses"),N=l(g,"trophies");u+=v,f+=k,h+=S,m+=N;const C=g.last_calculated_at??"";C>y&&(y=C),d(g.set_code,_=>({..._,events:_.events+v,wins:_.wins+k,losses:_.losses+S,trophies:_.trophies+N}))}let b=0;for(const g of o){const v=l(g,"events"),k=l(g,"wins"),S=l(g,"losses"),N=l(g,"trophies");u+=v,f+=k,h+=S,b+=N,d(g.set_code,C=>({...C,events:C.events+v,wins:C.wins+k,losses:C.losses+S,trophies:C.trophies+N}))}for(const g of i)(g.is_trophy??!0)&&d(g.set_code||"",v=>({...v,trophies:v.trophies+1}));const w=[...c.values()].sort((g,v)=>v.trophies-g.trophies||v.events-g.events),x=a[0]??o[0]??i[0];return{slug:e,displayName:x.display_name??e,avatarUrl:x.avatar_url??null,setCode:"",rank:0,score:0,trophies:m+b,events:u,wins:f,losses:h,linked17lands:a.length>0,lastCalculatedAt:y||void 0,formatBreakdown:[],selfReportedEvents:i.map(g=>bv(g)),lifetime:!0,setsPlayed:w}}function DK(e,t,s){return{setCode:t,slug:e,displayName:s.display_name??e,avatarUrl:s.avatar_url??null,rank:0,score:0,trophies:0,events:s.events??0,wins:s.wins??0,losses:s.losses??0,lastCalculatedAt:""}}function IK(e,t,s){return{setCode:t,slug:e,displayName:s.display_name??e,avatarUrl:s.avatar_url??null,rank:0,score:0,trophies:0,events:0,wins:0,losses:0,lastCalculatedAt:""}}async function MK(e){const{data:t,error:s}=await de().from("public_player").select("slug").ilike("avatar_url",`%/avatars/${e}/%`).limit(1).maybeSingle();if(s)throw s;return(t==null?void 0:t.slug)??null}async function $K(e){for(const t of tK){const{data:s,error:r}=await de().from(t).select("slug, display_name, avatar_url").eq("slug",e).limit(1).maybeSingle();if(r)throw r;if(s){const a=s;return{slug:a.slug,displayName:a.display_name,avatarUrl:a.avatar_url??null}}}return null}const oR="slug, set_code, event_id, format, expansion, wins, losses, is_trophy, colors, started_at, finished_at, seventeenlands_event_id, external_url, event_name, pod_event_slug, end_rank";async function UK(e,t){const{data:s,error:r}=await de().from(oK(t)).select(oR).eq("slug",e).eq("set_code",t).order("finished_at",{ascending:!1,nullsFirst:!1});if(r)throw r;return(s??[]).map(a=>WE(a))}const iR=100;function lR(e){return e==="ALL"?null:e===it?"^[WUBRG]{3,}":`^${e}[a-z]*$`}async function zK(e,t=0,s=iR,r="ALL",a="ALL",o,i){let l=de().from("public_player_draft_events").select(oR).eq("slug",e);if(r!=="ALL"){const f=Oc[r];l=f&&f.length>0?l.in("format",f):l.ilike("format",`%${r}%`)}const c=lR(a);c&&(l=l.filter("colors","match",c)),o&&(l=l.gte("finished_at",o)),i&&(l=l.lt("finished_at",i));const{data:d,error:u}=await l.order("finished_at",{ascending:!1,nullsFirst:!1}).order("event_id",{ascending:!1}).range(t,t+s-1);if(u)throw u;return(d??[]).map(f=>WE(f))}async function BK(e,t="ALL",s="ALL",r,a){const o=t!=="ALL"?Oc[t]:void 0,{data:i,error:l}=await de().rpc("public_lifetime_event_stats",{p_slug:e,p_formats:o&&o.length>0?o:null,p_format_like:t!=="ALL"&&!(o&&o.length>0)?t:null,p_color_pattern:lR(s),p_start:r??null,p_end_exclusive:a??null});if(l)throw l;return(Array.isArray(i)?i[0]:i)??{events:0,wins:0,losses:0,trophies:0}}const cR="set_code, slug, display_name, avatar_url, format, colors, wins, losses, finished_at, seventeenlands_event_id, end_rank";async function FK(e,t=8){let s=de().from(_n(e)?"public_cube_season_events":"public_recent_trophies").select(cR).eq("set_code",e);_n(e)&&(s=s.eq("is_trophy",!0));const{data:r,error:a}=await s.order("finished_at",{ascending:!1,nullsFirst:!1}).limit(t);if(a)throw a;return(r??[]).map(o=>Sv(o))}async function WK(e,t){return t==="Pod"?XK(e):t==="LCQ"?GK(e):dR(e,t)}async function HK(e){return dR(e)}async function dR(e,t){const s=t?Oc[t]:null,r=_n(e),a=r?"public_cube_season_events":"public_recent_trophies",o=[],i=1e3;for(let l=0;;l+=i){let c=de().from(a).select(cR).eq("set_code",e).order("finished_at",{ascending:!1,nullsFirst:!1}).range(l,l+i-1);r&&(c=c.eq("is_trophy",!0)),t&&(c=s?c.in("format",s):c.ilike("format",`%${t}%`));const{data:d,error:u}=await c;if(u)throw u;const f=d??[];for(const h of f)o.push(Sv(h));if(f.length<i)break}return o}function Sv(e){return{setCode:e.set_code,slug:e.slug,displayName:e.display_name,avatarUrl:e.avatar_url??null,seventeenlandsEventId:e.seventeenlands_event_id??null,format:e.format,colors:e.colors,wins:e.wins,losses:e.losses,finishedAt:e.finished_at,isTrophy:!0,endRank:e.end_rank??null}}async function GK(e){const t=Oc.LCQ,[s,r,a]=await Promise.all([de().from("public_recent_trophies").select("*").eq("set_code",e).in("format",t),de().from("public_player_draft_events").select("slug, seventeenlands_event_id, format, colors, wins, losses, finished_at, is_trophy").eq("set_code",e).in("format",vv),de().from("public_leaderboard").select("slug, display_name, avatar_url").eq("set_code",e)]);if(s.error)throw s.error;if(r.error)throw r.error;if(a.error)throw a.error;const o=new Map;for(const c of a.data??[])o.set(c.slug,c);const i=(s.data??[]).map(Sv),l=new Set(i.map(c=>
496c.seventeenlandsEventId).filter(Boolean));for(const c of r.data??[]){const d=c.seventeenlands_event_id??null;if(d&&l.has(d))continue;const u=!!c.is_trophy,f=c.losses??0;if(!u&&f<2)continue;const h=c.slug,m=o.get(h);i.push({setCode:e,slug:h,displayName:(m==null?void 0:m.display_name)??h,avatarUrl:(m==null?void 0:m.avatar_url)??null,seventeenlandsEventId:d,format:c.format,colors:c.colors??"",wins:c.wins??0,losses:f,finishedAt:c.finished_at??"",isTrophy:u})}return i.sort((c,d)=>c.finishedAt<d.finishedAt?1:c.finishedAt>d.finishedAt?-1:0)}async function VK(e){const{data:t,error:s}=await de().from("public_pod_draft_events").select("*").eq("set_code",e).order("event_time",{ascending:!1});if(s)throw s;return(t??[]).map(r=>Cv(r))}async function KK(){return(await ju((t,s)=>de().from("public_pod_draft_events").select("*").order("event_time",{ascending:!1}).range(t,s))).map(t=>Cv(t))}async function qK(e){const{data:t,error:s}=await de().from("public_pod_draft_event_participants").select("*").eq("event_id",e);if(s)throw s;return(t??[]).map(r=>oq(r))}async function ZK(e){var r;const{data:t,error:s}=await de().from("public_pod_draft_log").select("draft_log").eq("event_id",e).limit(1);if(s)throw s;return((r=t==null?void 0:t[0])==null?void 0:r.draft_log)??null}async function YK(e){const{data:t,error:s}=await de().from("public_pod_draft_events").select("*").eq("slug",e).maybeSingle();if(s)throw s;return t?Cv(t):null}async function QK(e){const{data:t,error:s}=await de().from("public_pod_draft_event_matches").select("*").eq("event_id",e).order("round",{ascending:!0});if(s)throw s;return(t??[]).map(r=>iq(r))}async function JK(e){const{data:t,error:s}=await de().from("public_pod_draft_replays").select("*").eq("event_id",e).order("game_time",{ascending:!0});if(s)throw s;return(t??[]).map(r=>lq(r))}function uR(e){const[t,s]=(e??"").split("-");return{wins:parseInt(t||"0",10)||0,losses:parseInt(s||"0",10)||0}}async function fR(e){const t=await de().from("public_pod_draft_events").select("event_id, event_time").eq("set_code",e);if(t.error)throw t.error;const s=new Map((t.data??[]).map(a=>[a.event_id,a.event_time]));if(s.size===0)return[];const r=await de().from("public_pod_draft_event_participants").select("event_id, player_slug, player_display_name, avatar_url, deck_colors, record, placement").in("event_id",Array.from(s.keys()));if(r.error)throw r.error;return(r.data??[]).map(a=>{const o=a,i=o.player_slug??null;return{eventId:o.event_id,finishedAt:s.get(o.event_id)??"",slug:i,displayName:o.player_display_name??i??"",avatarUrl:o.avatar_url??null,deckColors:o.deck_colors??null,placement:o.placement??null,...uR(o.record)}})}async function XK(e){return(await fR(e)).filter(s=>s.wins>=Sc&&s.slug).map(s=>({setCode:e,slug:s.slug,displayName:s.displayName,avatarUrl:s.avatarUrl,seventeenlandsEventId:null,format:"PodDraft",colors:s.deckColors??"",wins:s.wins,losses:s.losses,finishedAt:s.finishedAt})).sort((s,r)=>s.finishedAt<r.finishedAt?1:s.finishedAt>r.finishedAt?-1:0)}async function Nv(e,t,s){const r=await fR(e),a=ds(e),o=s?new Set(s):null,i=c=>c?t===it?Cs(c,a):t===kt?Cs(c,a)?!1:o?o.has(Bt(c)):!1:Bt(c)===t:!1,l=new Map;for(const c of r){if(c.placement===null||!c.slug||!i(c.deckColors))continue;let d=l.get(c.slug);d||(d={displayName:c.displayName,avatarUrl:c.avatarUrl,events:0,wins:0,losses:0,trophies:0,lastFinishedAt:""},l.set(c.slug,d)),d.events+=1,d.wins+=c.wins,d.losses+=c.losses,c.wins>=Sc&&(d.trophies+=1),c.finishedAt>d.lastFinishedAt&&(d.lastFinishedAt=c.finishedAt)}return Array.from(l.entries()).map(([c,d])=>({setCode:e,colors:t,slug:c,displayName:d.displayName,avatarUrl:d.avatarUrl,rank:0,score:0,trophies:d.trophies,events:d.events,wins:d.wins,losses:d.losses,lastCalculatedAt:d.lastFinishedAt||new Date(0).toISOString()})).sort((c,d)=>d.trophies!==c.trophies?d.trophies-c.trophies:d.wins!==c.wins?d.wins-c.wins:c.slug.localeCompare(d.slug)).map((c,d)=>({...c,rank:d+1}))}async function eq(e,t,s){const r=await sq(e,t,s,hR);return nq(r)}const hR="event_id, set_code, event_time, kind";async function tq(){const[e,t]=await Promise.all([ju((s,r)=>de().from("public_pod_draft_events").select(hR).order("event_id").range(s,r)),ju((s,r)=>de().from("public_pod_draft_event_participants").select("event_id, player_slug, player_display_name, avatar_url, record, placement").order("event_id").range(s,r))]);return mR(t,pR(e))}async function sq(e,t,s,r){const a=de().from("public_pod_draft_events").select(r).neq("kind","mock").gte("event_date",e).lte("event_date",t),o=de().from("public_pod_draft_events").select(r).eq("set_code",s),[i,l]=await Promise.all([a,o]);if(i.error)throw i.error;if(l.error)throw l.error;const c=new Map;for(const d of[...i.data??[],...l.data??[]])c.set(d.event_id,d);return Array.from(c.values())}async function nq(e){const t=pR(e);if(t.size===0)return[];const s=await rq(Array.from(t.keys()));return mR(s,t)}function pR(e){const t=new Map;for(const s of e){const r=s;r.kind!=="mock"&&t.set(r.event_id,{setCode:r.set_code,eventTime:r.event_time})}return t}function mR(e,t){const s=[];for(const r of e){const a=r.player_slug??null,o=t.get(r.event_id);!a||!o||r.record==null||s.push({eventId:r.event_id,setCode:o.setCode,eventTime:o.eventTime,slug:a,displayName:r.player_display_name??a,avatarUrl:r.avatar_url??null,placement:r.placement??null,...uR(r.record)})}return s}const wk=50;async function rq(e){const t=[];for(let a=0;a<e.length;a+=wk)t.push(e.slice(a,a+wk));const s=await Promise.all(t.map(a=>de().from("public_pod_draft_event_participants").select("event_id, player_slug, player_display_name, avatar_url, record, placement").in("event_id",a))),r=[];for(const{data:a,error:o}of s){if(o)throw o;r.push(...a??[])}return r}async function aq(){const{data:e,error:t}=await de().from("public_pod_draft_events").select("set_code, format_label, kind");if(t)throw t;const s=new Map;for(const r of e??[]){const a=r,o=s.get(a.set_code)??{label:null,events:0,mocks:0};o.label=o.label??a.format_label??null,a.kind==="mock"?o.mocks+=1:o.events+=1,s.set(a.set_code,o)}return Array.from(s,([r,a])=>({code:r,...a}))}function Cv(e){return{eventId:e.event_id,slug:e.slug,name:e.name,setCode:e.set_code,kind:e.kind==="mock"?"mock":"tournament",eventDate:e.event_date,eventTime:e.event_time,formatLabel:e.format_label??null,totalRounds:e.total_rounds??0,championPlayerSlug:e.champion_player_slug??null,championDisplayName:e.champion_display_name??null,championAvatarUrl:e.champion_avatar_url??null,championDeckColors:e.champion_deck_colors??null,championRecord:e.champion_record??null,participantCount:e.participant_count??0,isFinalized:e.is_finalized??!1,ordinal:e.ordinal??null,tableIndex:e.table_index??1,isTeamDraft:e.is_team_draft??!1,closedDecklist:e.closed_decklist??!1}}function oq(e){return{eventId:e.event_id,displayName:e.display_name,draftmancerName:e.draftmancer_name??null,seatIndex:e.seat_index??null,placement:e.placement??null,record:e.record??null,deckColors:e.deck_colors??null,deckScreenshotUrl:e.deck_screenshot_url??null,deckScreenshotCaption:e.deck_screenshot_caption??null,playerSlug:e.player_slug??null,playerDisplayName:e.player_display_name??null,avatarUrl:e.avatar_url??null}}function iq(e){return{eventId:e.event_id,eventName:e.event_name,round:e.round,playerAName:e.player_a_name,playerBName:e.player_b_name,winnerName:e.winner_name??null,score:e.score??null,reportedAt:e.reported_at??null}}function lq(e){return{eventId:e.event_id,eventName:e.event_name,eventDate:e.event_date,setCode:e.set_code,playerId:e.player_id,playerSlug:e.player_slug,playerDisplayName:e.player_display_name,gameId:e.game_id,link:e.link,gameTime:e.game_time,won:e.won,turns:e.turns??null,onPlay:e.on_play??null,inferredRound:e.inferred_round??null}}const cq=Object.assign({
496"./fixtures/cards-fra.ts":()=>Ja(()=>import("./cards-fra-CbdqhXwf.js"),[]).then(e=>e.default),
496"./fixtures/cards-hob.ts":()=>Ja(()=>import("./cards-hob-D-9vSkVd.js"),[]).then(e=>e.default),
496"./fixtures/cards-msh.ts":()=>Ja(()=>import("./cards-msh-DpT25Kop.js"),[]).then(e=>e.default)}),dq=Object.assign({
496"./fixtures/p0p1-ratings-hob.ts":()=>Ja(()=>import("./p0p1-ratings-hob-BWe8UhE7.js"),[]).then(e=>e.default),
496"./fixtures/p0p1-ratings-msh.ts":()=>Ja(()=>import("./p0p1-ratings-msh-Dpe4EKJZ.js"),[])
496.then(e=>e.default)});async function uq(e){const t=`./fixtures/cards-${e.toLowerCase()}.ts`,s=cq[t];if(!s)throw new Error(`No card fixture for set ${e}`);return s()}async function fq(e){const t=`./fixtures/p0p1-ratings-${e.toLowerCase()}.ts`,s=dq[t];return s?s():null}async function hq(e){const{data:t,error:s}=await de().from("p0p1_entries").select("slot, card_name, updated_at").eq("set_code",e);if(s)throw s;return(t??[]).map(r=>({slot:r.slot,cardName:r.card_name,lastUpdated:r.updated_at}))}async function pq(e,t,s){const{data:{user:r}}=await de().auth.getUser();if(!r)throw new Error("Not authenticated");const{error:a}=await de().from("p0p1_entries").upsert({user_id:r.id,set_code:e,slot:t,card_name:s,updated_at:new Date().toISOString()},{onConflict:"user_id,set_code,slot"});if(a)throw a}async function mq(e){const{error:t}=await de().from("p0p1_entries").delete().eq("set_code",e);if(t)throw t}const Lh=1e3,jk=2;async function xq(e,t){const{data:s,error:r}=await de().from("public_p0p1_ballots").select("*").eq("set_code",e).order("ballot_id",{ascending:!0}).order("slot",{ascending:!0}).range(t,t+Lh-1);if(r)throw r;return s??[]}async function gq(e){const t=[];for(let s=0;;s+=Lh*jk){const r=Array.from({length:jk},(i,l)=>s+l*Lh),a=await Promise.all(r.map(i=>xq(e,i)));let o=!1;for(const i of a){for(const l of i)t.push({setCode:l.set_code,ballotId:l.ballot_id,name:l.name,avatarUrl:l.avatar_url,slot:l.slot,cardName:l.card_name});i.length<Lh&&(o=!0)}if(o)break}return t}async function bq(e){const{data:t,error:s}=await de().from("public_p0p1_pick_stats").select("*").eq("set_code",e);if(s)throw s;return(t??[]).map(r=>({setCode:r.set_code,slot:r.slot,cardName:r.card_name,pickCount:r.pick_count,pickPct:Number(r.pick_pct)}))}const yq=null,vq=Object.freeze(Object.defineProperty({__proto__:null,LIFETIME_EVENTS_PAGE:iR,deleteAllP0P1Picks:mq,fetchAllPodEvents:KK,fetchAllPodResults:tq,fetchAllRecentTrophies:HK,fetchAvailableFormats:wK,fetchColorsLeaderboard:EK,fetchColorsSummary:TK,fetchCubeSeasons:hK,fetchDbEpisodes:iK,fetchEpisodeTranscript:cK,fetchFormatColorsLeaderboard:vK,fetchFormatLeaderboard:SK,fetchFormatRecentTrophies:WK,fetchLeaderboard:sR,fetchLifetimeDraftEvents:zK,fetchLifetimeProfile:LK,fetchLifetimeStats:BK,fetchOtherColorsLeaderboard:RK,fetchP0P1Ballots:gq,fetchP0P1Cards:uq,fetchP0P1PickStats:bq,fetchP0P1Picks:hq,fetchP0P1Ratings:fq,fetchPlayerDraftEvents:UK,fetchPlayerIdentity:$K,fetchPlayerProfile:OK,fetchPlayerSlugByDiscordId:MK,fetchPodArchetypes:bK,fetchPodCalendar:pK,fetchPodCardDecks:xK,fetchPodCardStats:mK,fetchPodDeckCards:gK,fetchPodDraftArtifact:ZK,fetchPodEventBySlug:YK,fetchPodEventMatches:QK,fetchPodEventParticipants:qK,fetchPodEventReplays:JK,fetchPodEvents:VK,fetchPodSeasonResults:eq,fetchPodSetCodes:aq,fetchRecentDbEpisodes:lK,fetchRecentTrophies:FK,fetchSetReviewMentions:dK,fetchSets:yK,fetchTranscriptIndex:fK,fetchTrophyLeaderboard:jK,initialAuthUser:yq,upsertP0P1Pick:pq},Symbol.toStringTag,{value:"Module"})),Le=yH?vq:TV,wq=Le.fetchSets,jq=Le.fetchCubeSeasons,kq=Le.fetchPodCardStats,Sq=Le.fetchPodArchetypes,Nq=Le.fetchPodCardDecks,Cq=Le.fetchPodDeckCards,_q=Le.fetchDbEpisodes,Tq=Le.fetchRecentDbEpisodes,Eq=Le.fetchEpisodeTranscript,Rq=Le.fetchTranscriptIndex,Aq=Le.fetchSetReviewMentions,xR=Le.fetchLeaderboard,Pq=Le.fetchTrophyLeaderboard,Oq=Le.fetchFormatLeaderboard,Lq=Le.fetchColorsLeaderboard,Dq=Le.fetchOtherColorsLeaderboard,Iq=Le.fetchColorsSummary,gR=Le.fetchPlayerProfile,Mq=Le.fetchPlayerIdentity,$q=Le.fetchPlayerSlugByDiscordId,Uq=Le.fetchAvailableFormats,zq=Le.fetchFormatColorsLeaderboard,bR=Le.fetchPlayerDraftEvents,Bq=Le.fetchLifetimeProfile,Fq=Le.fetchLifetimeDraftEvents,Wq=Le.fetchLifetimeStats,rg=Le.LIFETIME_EVENTS_PAGE,Hq=Le.fetchRecentTrophies,Gq=Le.fetchFormatRecentTrophies,Vq=Le.fetchAllRecentTrophies,Kq=Le.fetchPodEvents,qq=Le.fetchPodSeasonResults,Zq=Le.fetchAllPodEvents,Yq=Le.fetchAllPodResults,Qq=Le.fetchPodEventBySlug,Jq=Le.fetchPodEventParticipants,Xq=Le.fetchPodDraftArtifact,eZ=Le.fetchPodEventMatches,tZ=Le.fetchPodEventReplays,sZ=Le.fetchPodSetCodes,nZ=Le.fetchPodCalendar,rZ=Le.fetchP0P1Cards,aZ=Le.fetchP0P1Picks,oZ=Le.upsertP0P1Pick,iZ=Le.deleteAllP0P1Picks,lZ=Le.fetchP0P1PickStats,cZ=Le.fetchP0P1Ballots,dZ=Le.fetchP0P1Ratings,ag=Le.initialAuthUser,Zt={discord:"https://discord.com/invite/XWNVT9mxvU",discordPods:"https://discord.gg/p53m9RVn6R",patreon:"https://patreon.com/limitedlevelups",youtube:"https://www.youtube.com/@limitedlevel-ups",twitch:"https://www.twitch.tv/chord_o_calls",tcgplayer:"https://partner.tcgplayer.com/level-ups",apple:"https://podcasts.apple.com/us/podcast/limited-level-ups/id1486488039",spotify:"https://open.spotify.com/show/7LUZexiWvU1LM5xBpA7h2X",rss:"https://feeds.libsyn.com/limitedlevelups/rss"},uZ="775371722065051658",fZ="XWNVT9mxvU",hZ="1028072146645295125",yR="#🚀-pod-draft-coordination",vR=`https://discord.com/channels/${uZ}/${hZ}`,pZ="DisChordBot",mZ="https://discord.com/channels/@me/1499601495329341470",xZ=`Limited Level-Ups is a YouTube channel, podcast, and Discord community for Magic: The Gathering players of all skill levels who want to improve at Limited.
497
498Whether you're looking to get your first trophy, sharpen your fund
498amentals, or compete at the highest level, Limited Level-Ups is here to help you level up your game.`,gZ=xZ.split(`
499
500`),kk=e=>`https://unavatar.io/x/${e}`,wR=[{name:"Alex Nikolic",handle:"Chord_O_Calls",role:"Host & Founder",bio:"Alex is the force behind Limited Level-Ups. He founded the show in 2020 and has hosted it ever since, while also cultivating a thriving online community and building a full-time career around helping people become better at Limited Magic.",photo:kk("Chord_O_Calls"),links:[{label:"Twitch",url:Zt.twitch},{label:"Twitter",url:"https://x.com/Chord_O_Calls"}]},{name:"Marc Anderson",handle:"NEO_MTG",role:"Set Review Co-Host",bio:"Marc brings decades of competitive experience to the table. Former Canadian National Champion and current Limited consultant for Cosmos Heavy Play, he teams up with Alex each set to grade every card and map out the format before the first packs are opened.",photo:kk("NEO_MTG"),links:[{label:"Twitter",url:"https://x.com/NEO_MTG"}]}],og=wR[0],jR=[{label:"YouTube",url:Zt.youtube},{label:"Apple",url:Zt.apple},{label:"Spotify",url:Zt.spotify},{label:"RSS",url:Zt.rss}];async function bZ(){const e=`https://discord.com/api/v10/invites/${fZ}?with_counts=true`,t=await fetch(e);if(!t.ok)throw new Error(`Discord invite API responded ${t.status}`);const s=await t.json();return{memberCount:s.approximate_member_count??0,onlineCount:s.approximate_presence_count??0}}const Sk="/api/youtube";async function yZ(e=!1){const t=await fetch(e?`${Sk}?recent`:Sk);if(!t.ok)throw new Error(`YouTube proxy responded ${t.status}`);return(await t.json()).videos??[]}function kR(e,t){const s=new Set(e.map(i=>i.id)),r=new Set(e.map(i=>i.youtubeId).filter(Boolean)),a=vZ(e),o=t.filter(i=>!s.has(i.id)&&!(i.youtubeId&&r.has(i.youtubeId))).map(i=>wZ(i,a));return[...e,...o].sort((i,l)=>new Date(l.pubDate).getTime()-new Date(i.pubDate).getTime())}function vZ(e){let t;for(const s of e)s.setCode&&(!t||new Date(s.pubDate).getTime()>new Date(t.pubDate).getTime())&&(t=s);return t}function wZ(e,t){return!t||e.setCode||e.category==="Evergreen"?e:{...e,setCode:t.setCode,setName:t.setName,setReleasedAt:t.setReleasedAt}}function SR(e){const t=jZ(e.duration);return{id:`yt:${e.id}`,kind:"video",number:KV(e.title),title:ZE(e.title),link:Nk(e.id),audioUrl:"",pubDate:e.publishedAt,publishedLabel:QE(e.publishedAt),durationLabel:YE(t),durationSeconds:t,image:e.thumbnail,category:VE(e.title),youtubeId:e.id,videoUrl:Nk(e.id),isShort:GE("video",t,e.title),hasTranscript:!1}}function jZ(e){if(!e)return 0;const t=e.match(/PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?/);if(!t)return 0;const[,s,r,a]=t;return Number(s??0)*3600+Number(r??0)*60+Number(a??0)}function Nk(e){return`https://www.youtube.com/watch?v=${e}`}const kZ=[{slug:"POWERED",name:"Arena Powered Cube",expansion:"Cube - Powered",glyph:"keyrune:pz1",short:"POWER",seasoned:!0,seasons:[{code:"SPM",start_date:"2025-10-28",end_date:"2025-11-20"},{code:"TLA",start_date:"2026-01-06",end_date:"2026-01-22"},{code:"ECL",start_date:"2026-02-10",end_date:"2026-03-03"},{code:"TMT",start_date:"2026-03-31",end_date:"2026-04-21"},{code:"SOS",start_date:"2026-06-02",end_date:"2026-06-23"}]},{slug:"PLANAR",name:"Planar Cube",expansion:"Cube - Planar",glyph:"keyrune:pca",seasoned:!0,opens:"board",seasons:[{code:"PLANAR-ZEN",label:"Zendikar Week",glyph:"keyrune:zen",start_date:"2026-07-21",end_date:"2026-07-27"},{code:"PLANAR-ISD",label:"Innistrad Week",glyph:"keyrune:isd",start_date:"2026-07-28",end_date:"2026-08-03"},{code:"PLANAR-CHK",label:"Kamigawa Week",glyph:"keyrune:chk",start_date:"2026-08-04",end_date:"2026-08-11"}]},{slug:"ARENA",name:"Arena Cube",expansion:"Cube",glyph:"mana:flashback",seasoned:!1,soup:!1}],SZ={variants:kZ},vi=SZ.variants,oc=`${rs}-`,ic=e=>`${oc}${e.toUpperCase()}`;function NZ(e){const t=e.toUpperCase();return vi.find(s=>s.slug===t)}const Bm=vi.find(e=>e.seasoned)??vi[0];function CZ(e){const t=e.name.replace(/^Arena\s+/,"");return t.split(/\s+/).length>=2?t:e.name}function Fm(e){if(e.startsWith(oc))return NZ(e.slice(oc.length))}const _Z=new Map(vi.flatMap(e=>(e.seasons??[]).map(t=>[t.code,{variant:e,season:t}])));function _v(e){if(e.startsWith(oc))return _Z.get(e.slice(oc.length).toUpperCase())}function sf(e){var t;return Fm(e)??((t=_v(e))==null?void 0:t.variant)}function TZ(e){const t=_v(e);return((t==null?void 0:t.season.label)??`${e.slice(oc.length)} Season`).toUpperCase()}function NR(e){const t=sf(e);return ic((t??Bm).slug)}function EZ(e){if(!(e!=null&&e.length))return;const t=RR(e.filter(s=>s.kind==="variant"));if(t)return CR(t.setCode,e)}function CR(e,t){var r;const s=Fm(e);return(s==null?void 0:s.opens)==="board"?e:((r=RR(_R(s,t)))==null?void 0:r.setCode)??e}function _R(e,t){const s=new Set(((e==null?void 0:e.seasons)??[]).map(r=>r.code));return(t??[]).filter(r=>r.kind==="season"&&s.has(r.label))}function TR(e){var t;return((t=sf(e))==null?void 0:t.soup)!==!1}function ER(e,t=RZ()){var a;if(!e)return!1;const s=Fm(e);if(!s){const o=(a=_v(e))==null?void 0:a.season;return!!o&&t>=o.start_date&&t<=o.end_date}return(s.seasons??[]).some(o=>t>=o.start_date&&t<=o.end_date)}function RZ(){const e=new Date,t=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${e.getFullYear()}-${t}-${s}`}function RR(e){let t;for(const s of e)(!t||s.lastEvent>t.lastEvent)&&(t=s);return t}function AZ(e,t){if(!e)return;const s=new Map((t??[]).filter(a=>a.kind==="variant").map(a=>[a.setCode,a])),r=[];for(const a of vi){const o=ic(a.slug),i=s.get(o);i!=null&&i.lastEvent&&r.push({code:o,name:CZ(a),shortCode:a.short??a.slug,glyphCode:rs,startDate:i.lastEvent,endDate:i.lastEvent,isActive:ER(o)})}return[...e.filter(a=>a.code!==rs),...r]}function nf(e){const[t,s]=p.useState(()=>Date.now());return p.useEffect(()=>{const r=setInterval(()=>s(Date.now()),e);return()=>clearInterval(r)},[e]),t}function PZ(e,t){let s=Math.max(0,Math.floor((e-t)/1e3));const r=Math.floor(s/86400);s-=r*86400;const a=Math.floor(s/3600);s-=a*3600;const o=Math.floor(s/60),i=s-o*60,l=c=>String(c).padStart(2,"0");return r>0?`${r}d ${l(a)}:${l(o)}:${l(i)}`:`${l(a)}:${l(o)}:${l(i)}`}const ze=30*60*1e3,Di=60*60*1e3,OZ=3e4;
500function L1(e=!1){return je({queryKey:["youtube",e?"recent":"full"],queryFn:()=>yZ(e),staleTime:Di})}function LZ(){return je({queryKey:["discord-stats"],queryFn:bZ,staleTime:Di})}function DZ(){return je({queryKey:["db-episodes"],queryFn:_q,staleTime:Di})}function AR(e){return PR(e.youtubeId??e.id)}function PR(e){const t=je({queryKey:["episode-transcript",e],queryFn:()=>Eq(e),enabled:!!e,staleTime:Di});return{transcript:t.data??null,settled:!e||t.isFetched}}function IZ(e,t){const r=je({queryKey:["set-review-mentions",e],queryFn:()=>Aq(e),staleTime:Di}).data;return{setIndexed:((r==null?void 0:r.size)??0)>0,mention:r==null?void 0:r.get(zm(t))}}function MZ(){return je({queryKey:["transcript-index"],queryFn:Rq,staleTime:Di})}function OR(){const e=DZ(),t=L1(),s=L1(!0),r=p.useMemo(()=>$Z(s.data,t.data),[s.data,t.data]);return{data:p.useMemo(()=>{if(e.data)return qE(kR(e.data,r.map(SR)))},[e.data,r]),isPending:e.isLoading,isError:e.isError,thumbnailsPending:t.isLoading&&s.isLoading&&!e.data,setsReady:e.data!==void 0}}function $Z(e,t){const s=new Map;for(const r of e??[])s.set(r.id,r);for(const r of t??[])s.set(r.id,r);return[...s.values()]}function UZ(e=8){const t=je({queryKey:["recent-episodes",e],queryFn:()=>Tq(e),staleTime:Di}),s=L1(!0);return{data:p.useMemo(()=>{if(!t.data)return;const a=s.data?kR(t.data,s.data.map(SR)):t.data;return qE(a)},[t.data,s.data]),isLoading:t.isLoading}}function un(){return je({queryKey:["sets"],queryFn:wq,staleTime:ze})}function zZ(){return je({queryKey:["cube-seasons"],queryFn:jq,staleTime:ze})}function BZ(e){return je({queryKey:["pod-card-stats",e],queryFn:()=>kq(e),enabled:!!e,staleTime:ze})}function FZ(e,t){return je({queryKey:["pod-card-decks",e,t],queryFn:()=>Nq(e,t),enabled:!!e&&!!t,staleTime:ze})}function WZ(e){return je({queryKey:["pod-deck-cards",e],queryFn:()=>Cq(e),enabled:e.length>0,staleTime:ze})}function HZ(e){return je({queryKey:["pod-archetypes",e],queryFn:()=>Sq(e),enabled:!!e,staleTime:ze})}function Wm(e){return je({queryKey:["available-formats",e],queryFn:()=>Uq(e),enabled:!!e,staleTime:ze})}function Tv(e){return je({queryKey:["leaderboard",e],queryFn:()=>xR(e),enabled:!!e,staleTime:ze})}function GZ(e){return je({queryKey:["trophy-leaderboard",e],queryFn:()=>Pq(e),enabled:!!e,staleTime:ze})}function LR(e,t){return je({queryKey:["format-leaderboard",e,t],queryFn:()=>Oq(e,t),enabled:!!e&&!!t,staleTime:ze})}function VZ(e,t){return je({queryKey:["colors-leaderboard",e,t],queryFn:()=>Lq(e,t),enabled:!!e&&!!t,staleTime:ze})}function KZ(e,t,s){const r=Array.isArray(s)?[...s].sort().join(","):s,a=!!e&&!!t&&!!s&&(Array.isArray(s)?s.length>0:!0);return je({queryKey:["format-colors-leaderboard",e,t,r],queryFn:()=>zq(e,t,s),enabled:a,staleTime:ze})}function qZ(e,t,s){const r=t?[...t].sort().join(","):null;return je({queryKey:["other-colors-leaderboard",e,r,s??null],queryFn:()=>Dq(e,t,s),enabled:!!e&&!!t&&t.length>0,staleTime:ze})}function Ev(e,t,s=!0){return je({queryKey:["player-profile",e,t],queryFn:()=>gR(e,t),enabled:!!e&&s,staleTime:ze,placeholderData:ym})}function ZZ(e,t=!0){return je({queryKey:["player-lifetime",e],queryFn:()=>Bq(e),enabled:!!e&&t,staleTime:ze,placeholderData:ym})}function YZ(e,t=!0,s="ALL",r="ALL",a,o){return A7({queryKey:["lifetime-events",e,s,r,a??"ALL"],queryFn:({pageParam:i})=>Fq(e,i,rg,s,r,a,o),initialPageParam:0,getNextPageParam:(i,l)=>i.length<rg?void 0:l.length*rg,enabled:!!e&&t,staleTime:ze})}function QZ(e,t,s="ALL",r="ALL",a,o){return je({queryKey:["lifetime-stats",e,s,r,a??"ALL"],queryFn:()=>Wq(e,s,r,a,o),enabled:!!e&&t,staleTime:ze})}function JZ(e,t){return je({queryKey:["player-identity",e],queryFn:()=>Mq(e),enabled:!!e&&t,staleTime:ze})}function rf(e){return je({queryKey:["player-slug-by-discord",e],queryFn:()=>$q(e),enabled:!!e,staleTime:ze})}function DR(e,t,s=!0){return je({queryKey:["draft-events",e,t],queryFn:()=>bR(e,t),enabled:!!e&&s,staleTime:ze,placeholderData:ym})}function IR(e){return je({queryKey:["colors-summary",e],queryFn:()=>Iq(e),enabled:!!e,staleTime:ze})}function XZ(e,t=8){return je({queryKey:["recent-trophies",e,t],queryFn:()=>Hq(e,t),enabled:!!e,staleTime:ze,placeholderData:ym})}function eY(e,t){return je({queryKey:["format-trophies",e,t],queryFn:()=>Gq(e,t),enabled:!!e&&!!t,staleTime:ze})}function tY(e){return je({queryKey:["all-trophies",e],queryFn:()=>Vq(e),enabled:!!e,staleTime:ze})}function MR(){const e=dn(),t=p.useCallback(r=>{e.prefetchQuery({queryKey:["leaderboard",r],queryFn:()=>xR(r),staleTime:ze})},[e]),s=p.useCallback((r,a)=>{e.prefetchQuery({queryKey:["player-profile",r,a],queryFn:()=>gR(r,a),staleTime:ze}),e.prefetchQuery({queryKey:["draft-events",r,a],queryFn:()=>bR(r,a),staleTime:ze})},[e]);return{prefetchSet:t,prefetchPlayer:s}}const sY=15;function Rv(e){const{data:t,isLoading:s}=IR(e);return p.useMemo(()=>
500{if(!t)return{chips:[],otherCombos:[],loading:s};const r=t.filter(u=>u.colors!==it&&u.colors!=="").reduce((u,f)=>u+f.events,0);if(r===0)return{chips:[],otherCombos:[],loading:!1};const a=r*.01,o=[],i=[];for(const u of t)u.colors===""||u.colors===it||u.colors.length>=4||(u.events>=a?o.push(u.colors):i.push(u.colors));const l=u=>u.length===2?0:u.length===1?1:2;o.sort((u,f)=>{var w,x;const h=l(u),m=l(f);if(h!==m)return h-m;const y=((w=t.find(g=>g.colors===u))==null?void 0:w.events)??0;return(((x=t.find(g=>g.colors===f))==null?void 0:x.events)??0)-y}),i.push(...o.splice(sY));const c=[...o];return t.some(u=>u.colors===it&&u.events>0)&&TR(e)&&c.push(it),i.length>0&&c.push(kt),{chips:c,otherCombos:i,loading:!1}},[t,s,e])}function af(e){return je({queryKey:["pod-events",e],queryFn:()=>Kq(e),enabled:!!e,staleTime:ze})}function nY(e){return je({queryKey:["pod-season-results",e==null?void 0:e.code,e==null?void 0:e.startDate,e==null?void 0:e.endDate],queryFn:()=>qq(e.startDate,e.endDate,e.code),enabled:!!e,staleTime:ze})}function rY(e){return je({queryKey:["pod-events-all"],queryFn:Zq,enabled:e,staleTime:ze})}function aY(e){return je({queryKey:["pod-results-all"],queryFn:Yq,enabled:e,staleTime:ze})}function Ic(e){return je({queryKey:["pod-event-participants",e],queryFn:()=>Jq(e),enabled:!!e,staleTime:ze})}function of(e){return je({queryKey:["pod-draft-artifact",e],queryFn:()=>Xq(e),enabled:!!e,staleTime:ze})}function $R(e){return je({queryKey:["pod-event-by-slug",e],queryFn:()=>Qq(e),enabled:!!e,staleTime:ze})}function UR(e){return je({queryKey:["pod-event-matches",e],queryFn:()=>eZ(e),enabled:!!e,staleTime:ze})}function oY(e){return je({queryKey:["pod-event-replays",e],queryFn:()=>tZ(e),enabled:!!e,staleTime:ze})}function zR(){return je({queryKey:["pod-set-codes"],queryFn:sZ,staleTime:ze})}function iY(){return je({queryKey:["pod-calendar"],queryFn:nZ,staleTime:ze})}function BR(e){const t=nf(OZ);return p.useMemo(()=>e?gG(e,t)??void 0:LE(t)??void 0,[e,t])}function lY(e){return je({queryKey:["p0p1-cards",e],queryFn:()=>rZ(e),enabled:!!e,staleTime:ze})}function FR(e){return je({queryKey:["p0p1-picks",e],queryFn:()=>aZ(e),enabled:!!e,staleTime:ze})}function cY(e){const t=dn(),s=["p0p1-picks",e];return $3({mutationFn:({slot:r,cardName:a})=>oZ(e,r,a),onMutate:async({slot:r,cardName:a})=>{await t.cancelQueries({queryKey:s});const o=t.getQueryData(s);return t.setQueryData(s,(i=[])=>{const l=i.filter(c=>c.slot!==r);return l.push({slot:r,cardName:a,lastUpdated:new Date().toISOString()}),l}),{prev:o}},onError:(r,a,o)=>{o!=null&&o.prev&&t.setQueryData(s,o.prev)},onSettled:()=>t.invalidateQueries({queryKey:s})})}function dY(e,t){return je({queryKey:["p0p1-pick-stats",e],queryFn:()=>lZ(e),enabled:!!e&&t,staleTime:ze})}function uY(e,t){return je({queryKey:["p0p1-ballots",e],queryFn:()=>cZ(e),enabled:!!e&&t,staleTime:ze})}function fY(e){const t=dn(),s=["p0p1-picks",e];return $3({mutationFn:()=>iZ(e),onMutate:async()=>{await t.cancelQueries({queryKey:s});const r=t.getQueryData(s);return t.setQueryData(s,[]),{prev:r}},onError:(r,a,o)=>{o!=null&&o.prev&&t.setQueryData(s,o.prev)},onSettled:()=>t.invalidateQueries({queryKey:s})})}function WR(e){return je({queryKey:["p0p1-ratings",e],queryFn:()=>dZ(e),staleTime:1/0})}function Ck(e){const t=new Map;for(const a of e){const o=t.get(a.card_name)??{card_set:a.card_set,colors:a.colors,rarity:a.rarity,cmc:a.cmc,type_line:a.type_line,seen:0,lastSeenSum:0,sawCount:0,picked:0,pickSum:0,maindecked:0,drafts:0,games:0,gameWins:0};o.seen+=a.seen_count,o.lastSeenSum+=a.last_seen_sum,o.sawCount+=a.saw_count,o.picked+=a.pick_count,o.pickSum+=a.pick_sum,o.maindecked+=a.maindeck_count,o.drafts+=a.drafts,o.games+=a.game_count,o.gameWins+=a.game_wins,t.set(a.card_name,o)}const s=(a,o)=>o>0?a/o:null,r=[];for(const[a,o]of t)r.push({name:a,set:o.card_set,colors:o.colors??"",rarity:o.rarity,cmc:o.cmc,typeLine:o.type_line,seen:o.seen,alsa:s(o.lastSeenSum,o.sawCount),picked:o.picked,ata:s(o.pickSum,o.picked),pool:o.picked,drafts:o.drafts,maindecked:o.maindecked,playRate:s(o.maindecked,o.picked),gamesPlayed:o.games,winRate:s(o.gameWins,o.games)});return r}const hY={PEASANT:"Peasant"};function HR(e){return hY[e]??e}function pY(e){return e==="PEASANT"}const ig=e=>e==null||e===0?"—":String(e),_k=(e,t=2)=>e==null?"—":e.toFixed(t),Tk=e=>e==null?"—":`${(e*100).toFixed(1)}%`,gn=[{key:"seen",label:"# Seen",title:"Times Seen",format:e=>ig(e.seen),tier:"count"},{key:"picked",label:"# Picked",shortLabel:"# Pick",title:"Times Picked",format:e=>ig(e.picked),tier:"count"},{key:"alsa",label:"ALSA",title:"Average Last Seen At",format:e=>_k(e.alsa),tier:"stat"},{key:"ata",label:"ATA",title:"Average Taken At",format:e=>_k(e.ata),tier:"stat"},{key:"gamesPlayed",label:"# GP",title:"Games Played in Maindeck",format:e=>ig(e.gamesPlayed),tier:"count"},{key:"playRate",label:"% GP",title:"% Main-decked",format:e=>Tk(e.playRate),tier:"payoff"},{key:"winRate",label:"GP WR",title:"Maindeck Win Rate",format:e=>Tk(e.winRate),tier:"payoff"}];function mY(e,t,s){const r=s==="asc"?1:-1;return[...e].sort((a,o)=>{const i=a[t],l=o[t];return i==null&&l==null?a.name.localeCompare(o.name):i==null?1:l==null?-1:typeof i=="number"&&typeof l=="number"?(i-l)*r||a.name.localeCompare(o.name):String(i).localeCompare(String(l))*r})}const xY=["W","U","B","R","G","M","C"],gY={W:"White",U:"Blue",B:"Black",R:"Red",G:"Green",M:"Multicolor",C:"Colorless"};function GR(e){return e.length===0?"C":e.length>1?"M":e.toUpperCase()}const D1=[{key:"creature",label:"Creature",ms:"creature",types:["creature"]},{key:"instant",label:"Instant",ms:"instant",types:["instant"]},{key:"sorcery",label:"Sorcery",ms:"sorcery",types:["sorcery"]},{key:"artifact",label:"Artifact",ms:"artifact",types:["artifact"]},{key:"enchantment",label:"Enchantment",ms:"enchantment",types:["enchantment"]},{key:"planeswalker",label:"Planeswalker",ms:"planeswalker",types:["plane
500swalker"]},{key:"land",label:"Land",ms:"land",types:["land"]},{key:"battle",label:"Battle",ms:"battle",types:["battle"]}],bY=["1","2","3","4","5","6+"];function VR(e){if(e==null)return null;const t=Math.floor(e);return t>=6?"6+":String(t)}const KR={colors:[],types:[],manaValues:[],sets:[]};function qR(e){return e.colors.length+e.types.length+e.manaValues.length+e.sets.length}const yY=Object.fromEntries(D1.map(e=>[e.key,e]));function vY(e,t){if(t.colors.length>0&&!t.colors.includes(GR(e.colors))||t.sets.length>0&&(!e.set||!t.sets.includes(e.set)))return!1;const s=VR(e.cmc);if(t.manaValues.length>0&&(s==null||!t.manaValues.includes(s)))return!1;if(t.types.length>0){const r=(e.typeLine??"").toLowerCase();if(!t.types.some(o=>{var i;return(i=yY[o])==null?void 0:i.types.some(l=>r.includes(l))}))return!1}return!0}function wY(e){const t=new Map,s=new Map,r=new Map,a=new Map;for(const o of e){Jf(t,GR(o.colors));const i=VR(o.cmc);i&&Jf(r,i),o.set&&Jf(a,o.set);const l=(o.typeLine??"").toLowerCase();for(const c of D1)c.types.some(d=>l.includes(d))&&Jf(s,c.key)}return{colors:xY.map(o=>({value:o,name:gY[o],count:t.get(o)??0})),types:D1.map(o=>({value:o.key,label:o.label,ms:o.ms,count:s.get(o.key)??0})),manaValues:bY.map(o=>({value:o,count:r.get(o)??0})),sets:[...a.entries()].sort((o,i)=>o[0].localeCompare(i[0])).map(([o,i])=>({value:o,count:i}))}}function Jf(e,t){e.set(t,(e.get(t)??0)+1)}const jY={FRA:[{colors:"WU",poolId:"bWzk9SpyZv",cards:[["Unsummon",1],["Academic Ascent",2],["Surgical Precision",2],["Tam's Resistance",2],["Fatehold Chronologist // Peer Review",2],["Campus Crier",2],["Surveillance Phantasm",2],["Infinite Coursework",3],["Memory Trap",3],["Keeper of the Quiet Hour",3],["Mindseeker Oculus",3],["Semester Foreseer // Peer Review",4],["Hexhaven Battalion",6]],splitCards:[["Icy Reception",2],["Fatehold Charm",2],["Shatterwing Pegasus",3],["Prudent Fateseer // Peer Review",3],["Protege's Awakening",4],["Blossom-Blessed Angel // Seed Suture",4],["Desperate Futurescribe",4]]},{colors:"UB",poolId:"pdFsnuxH13",cards:[["Unsummon",1],["Icy Reception",2],["Last Gasp",2],["Solve for Disappointment",2],["Twinned Vision",2],["Rank Rat",2],["Void Extrapolator // Omit Variables",2],["Infinite Coursework",3],["Mindseeker Oculus",3],["Theorix Metamage // Omit Variables",3],["Extended Absence",4]],splitCards:[["Surveillance Phantasm",2],["Paradox Shaper // Omit Variables",2],["Theorix Charm",2],["Protege's Awakening",4],["Recursive Recruitment",4],["Undulating Witness",5],["Apex Witchstalker",6]]},{colors:"BR",poolId:"Y1gbZnMWsC",cards:[["Blazing Crescendo",2],["No Admittance",2],["Last Gasp",2],["Skilled Battlecarver",2],["Wrath of the Bloodmane",3],["Hallway Heckler // Vicious Verse",3],["Screeching Soulbreaker",3],["Extended Absence",4],["Heartstring Puller",4],["Awaken the Inferno",5]],splitCards:[["Stingerquill Voxmancer // Vicious Verse",1],["Afterthought Sentry",2],["Ferocity of the Hunt",2],["Eardrum Rattler",2],["Stingerquill Charm",2],["Grim Repriser",2],["Cast Away Doubt",3],["Rampart Hunter",4],["Whiplash Wordsmith // Vicious Verse",4],["Tether Technician",5]]},{colors:"RG",poolId:"ihmbHaSE4h",cards:[["No Admittance",2],["Compel Brutality",2],["Twinned Vision",2],["Something Worth Saving",2],["Arcane Amphisbaena",2],["Konstrari Improviser // Soul Tether",2],["Wrath of the Bloodmane",3],["Greenhouse Propagator",3],["Heartstring Puller",4],["Bestial Incursion",4],["Awaken the Inferno",5],["Vinelasher Adept",6]],splitCards:[["Sureshot Sower",2],["Konstrari Charm",2],["Murmuring Volume",3],["Woodwork Prodigy // Soul Tether",3],["Wrecking Gecko",5],["Craftwork Crusher",7]]},{colors:"WG",poolId:"oMjNAiSAzx",cards:[["Emergency Phytomedic // Seed Suture",1],["Compel Brutality",2],["Surgical Precision",2],["Medic's Kitesail",2],["Campus Crier",2],["Arcane Amphisbaena",2],["Unflinching Hortimancer",2],["Memory Trap",3],["Graft Surgeon",3],["Greenhouse Propagator",3],["Blossom-Blessed Angel // Seed Suture",4],["Bestial Incursion",4],["Hexhaven Battalion",6]],splitCards:[["Tethermage's Advantage",1],["Blessed Ghoul",1],["Academic Ascent",2],["Konstrari Improviser // Soul Tether",2],["Something Worth Saving",2],["Vigorbloom Charm",2],["Vigorbloom Vanguard // Seed Suture",2],["Bloombrute",4],["Fateshaper Aspirant",5]]},{colors:"WB",poolId:"mtCmKd6ZdJ",cards:[["Blessed Ghoul",1],["Surgical Precision",2],["Last Gasp",2],["Solve for Disappointment",2],["Silence the Echo",2],["Campus Crier",2],["Rank Rat",2],["Memory Trap",3],["Extended Absence",4],["Hexhaven Battalion",6],["Apex Witchstalker",6]],splitCards:[["Edgar, Ancient Bloodlord",2],["Theoretical Necromancer",3],["Twisted Fates",5]]},{colors:"BG",poolId:"m2XkdDgGDM",cards:[["Solve for Disappointment",2],["Last Gasp",2],["Compel Brutality",2],["Something Worth Saving",2],["Rank Rat",2],["Arcane Amphisbaena",2],["Extended Absence",4],["Bestial Incursion",4],["Apex Witchstalker",6],["Vinelasher Adept",6]],splitCards:[["Void Extrapolator // Omit Variables",2],["Ferocity of the Hunt",2],["Theorix Metamage // Omit Variables",3],["Primal Witchstalker",3],["Hapatra, the Desert Fang",5]]},{colors:"UG",poolId:"YJBGVr8Q8Z",cards:[["Unsummon",1],["Compel Brutality",2],["Tam's Resistance",2],["Surveillance Phantasm",2],["Arcane Amphisbaena",2],["Infinite Coursework",3],["Keeper of the Quiet Hour",3],["Mindseeker Oculus",3],["Protege's Awakening",4],["Bestial Incursion",4]],splitCards:[["Icy Reception",2],["Something Worth Saving",2],["Sureshot Sower",2],["Murmuring Volume",3],["Inspired Tethermage",3],["Kiora of Salt and Sand",3],["Mind Meanderer",6]]},{colors:"UR",poolId:"dfUoj2Erd8",cards:[["Unsummon",1],["No Admittance",2],["Twinned Vision",2],["Mindseeker Oculus",3],["Wrath of the Bloodmane",3],["Heartstring Puller",4],["Awaken the Inferno",5]],splitCards:[["Artifist Acumen",1],["Surveillance Phantasm",2],["Icy Reception",2],["Blazing Crescendo",2],["Konstrari Improviser // Soul Tether",2],["Tam's Resistance",2],["Cryotheory Adept",2],["Skilled Battlecarver",2],["Infinite Coursework",3],["Chandra's Emberling",3],["Clash of Elements",3],["Protege's Awakening",4],["Whiplash Wordsmith // Vicious Verse",4],["Saheeli, Jewel of Avishkar",4]]},{colors:"WR",poolId:"46LomaRBpQ",cards:[["Surgical Precision",2],["No Admittance",2],["Skilled Battlecarver",2],["Campus Crier",2],["Memory Trap",3],["Wrath of the Bloodmane",3],["Graft Surgeon",3],["Heartstring Puller",4],["Awaken the Inferno",5],["Hexhaven Battalion",6]],splitCards:[["Emergency Phytomedic // Seed Suture",1],["Blazing Crescendo",2],["Konstrari Improviser // Soul Tether",2],["Medic's Kitesail",2],["Unflinching Hortimancer",2],["Shatterwing Pegasus",3],["Charge the Sanctum",3],["Mabel, Valley Hero",3],["Blossom-Blessed Angel // Seed Suture",4],["Warrior's Blades",4]]}],HOB:[{colors:"WU",poolId:"meuRkRJix5",cards:[["Plunder the Trollshaws",2],["Lakeshore Apothecary",2],["Enchanted River's Grasp",3],["Bilbo Baggins, Burglar",3],["Confusticate and Bebother",3],["Patient Instructor",3],["Uneasy Partings",4],["Long Lake Nuisance",4],["Esgaroth Garrison",5],["Magnificent End",5]],splitCards:[["Moment of Glory",1],["Dwarven Provisioner",2],["Bard the Bowman",3],["Thorin's Last Stand",4],["Eagle's Rescue",4]]},{colors:"BR",poolId:"ywz5ZRxnz1",cards:[["Stir Up Trouble",1],["Front Porch Sentries",2],["Stony-Voiced Goblins",2],["Goblin-town Flunkies",2],["Pinecone Strike",2],["Ragged Short Spear",2],["Goblin Plate Mail",2],["Bilbo's Deadly Slice",3],["Crude Bent Blade",3],["Rage into the Valley",3],["Gundabad Opportunist",4]],splitCards:[["Tidings of War",1],["Reverent Howl",3],["Dori, Bearer of Friends",3],["Fearsome Goblin Pair",3],["Bolg of the North",5],["Smaug, the Great Calamity",7]]},{colors:"BG",poolId:"mWKhTYSL5x",cards:[["Ravening Warg",2],["Quarrel",2],["Wargling",2],["Bilbo's Deadly Slice",3],["Crude Bent Blade",3],["Rage into the Valley",3],["Duskwatch Hunter",3],["Ordinary Bear",4]],splitCards:[["Gollum, Silent Slinker",4],["The Chief Warg",4],["Beorn, Reluctant Host",5],["Large Bear",5],["Boughside Wanderers",6]]},{colors:"WR",poolId:"1rsV9yhVb9",cards:[["Pinecone Strike",2],["Ragged Short Spear",2],["Goblin Plate Mail",2],["Dori, Bearer of Friends",3],["Dwarven Shortsword",4],["Iron Hills Stalwart",5]],splitCards:[["Well-Worn Spatula",1],["Goblin-town Flunkies",2],["Dwarven Provisioner",2],["Vow to Erebor",2],["Óin the Brave",2],["Nori, Teller of Tales",2],["Thorin Oakenshield",2],["Ori, Keeper of Songs",3],["Gundabad Opportunist",4],["Bifur, Melodic Rider",6],["Smaug, the Great Calamity",7]]},{colors:"UG",poolId:"kkBNLoDQBD",cards:[["Plunder the Trollshaws",2],["Quarrel",2],["Attercop",2],["Bilbo Baggins, Burglar",3],["Enchanted River's Grasp",3],["Confusticate and Bebother",3],["Wood Elves",3],["Mirkwood Nurturer",3],["Uneasy Partings",4],["Boughside Wanderers",6]],splitCards:[["Elvenking's Harper",2],["Guardian of the Halls",2],["Thranduil, Sindarin Liege",4],["Silvan Reveler",4]]}]};function ZR(e){const t=jY[e.toUpperCase()];if(!t)return[];const s=e.toLowerCase(),r=a=>a.map(([o,i])=>({n:o,cn:null,s,r:null,c:null,cmc:i,type:null}));return t.map(a=>({colors:a.colors,poolId:a.poolId,cards:r(a.cards),splitCards:r(a.splitCards)}))}function kY(e){const t=[...e.cards,...e.splitCards];let s=1;for(const c of t)(c.cmc??0)>s&&(s=c.cmc??0);const r=(c,d)=>
500d===1?(c.cmc??0)<=1:c.cmc===d,a=c=>Array.from({length:s},(d,u)=>c.filter(f=>r(f,u+1))),o=a(e.cards),i=a(e.splitCards),l=o.map((c,d)=>c.length>0||i[d].length>0);return{columns:o.filter((c,d)=>l[d]),splitColumns:i.filter((c,d)=>l[d])}}function SY(){var f;const{pathname:e}=Rt(),t=e.split("/").filter(Boolean),{data:s}=un(),r=new Set((s??[]).map(h=>h.code.toUpperCase())),{slug:a,setCode:o}=_Y(t),i=(f=(s??[]).find(h=>h.isActive))==null?void 0:f.code,{data:l}=Ev(a,o??i??_s),c=dn().getQueryData(["db-episodes"]),u=p.useSyncExternalStore(CY,()=>YR)??TY(t,l==null?void 0:l.displayName,r,c);return p.useEffect(()=>{document.title=u===$d?$d:`${u}${eK}${$d}`},[u]),null}function NY(e){p.useEffect(()=>(Ek(e),()=>Ek(null)),[e])}let YR=null;const I1=new Set,Ek=e=>{YR=e;for(const t of I1)t()},CY=e=>(I1.add(e),()=>I1.delete(e)),_Y=e=>{var r,a,o,i,l;const[t,...s]=e;return t==="player"?{slug:(r=s[0])==null?void 0:r.toLowerCase(),setCode:(a=s[1])==null?void 0:a.toUpperCase()}:t!=="leaderboard"?{}:s[0]==="player"?{slug:(o=s[1])==null?void 0:o.toLowerCase()}:s[1]==="player"?{slug:(i=s[2])==null?void 0:i.toLowerCase(),setCode:(l=s[0])==null?void 0:l.toUpperCase()}:{}},Zi=(e,t)=>e.split("-").map(s=>{const r=s.toUpperCase();return t.has(r)?r:s.charAt(0).toUpperCase()+s.slice(1)}).join(" "),Rk=e=>{const t=e.toUpperCase();if(t==="CUBE")return"Cube";const s=Fm(t);return s?s.name:t.startsWith("CUBE-")?`Cube ${t.slice(5)}`:t},Ak=(e,t)=>{if(!t)return null;const s=e.toLowerCase();for(const r of t)if(KE(r)===s)return r.title;return null},TY=(e,t,s,r)=>{if(e.length===0)return $d;const[a,...o]=e;if(a==="player"&&o[0])return t??Zi(o[0],s);if(a==="leaderboard")return o.length===0?"Leaderboard":o[0]==="about"?"About":o[0]==="player"&&o[1]?t??Zi(o[1],s):o[1]==="player"&&o[2]?t??Zi(o[2],s):`${Rk(o[0])} Leaderboard`;if(a==="tier-list"){if(!o[0])return"Tier List";const i=o[0].toUpperCase();return o[1]==="archetypes"&&ZR(i).length>0?`${i} Archetype Skeletons`:`${i} Tier List`}if(a==="pods")return o[0]==="guide"?"Pod Guide":o[0]&&o[1]==="data"?`${HR(o[0].toUpperCase())} Cube Card Data`:o[0]?Zi(o[0],s):"Pod Drafts";if(a==="p0p1"||a==="p0p1-mocks")return"P0P1";if(a==="episodes"){const i=o[0];if(!i)return"Episodes";if(o[1])return Ak(o[1],r)??Zi(o[1],s);if(i==="shorts")return"Shorts";if(i==="audio")return"Audio";const l=HE(i);return l?`${l} Episodes`:s.has(i.toUpperCase())?`${Rk(i)} Episodes`:Ak(i,r)??Zi(i,s)}return a==="community"?"Community":a==="tools"?o[0]?o[1]?`${o[1].toUpperCase()} Bulk Crafting`:"Bulk Crafting":"Tools":a==="about"?"About":$d};var QR={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Pk=wt.createContext&&wt.createContext(QR),EY=["attr","size","title"];function RY(e,t){if(e==null)return{};var s,r,a=AY(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)s=o[r],t.indexOf(s)===-1&&{}.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}function AY(e,t){if(e==null)return{};var s={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;s[r]=e[r]}return s}function Op(){return Op=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)({}).hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},Op.apply(null,arguments)}function Ok(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),s.push.apply(s,r)}return s}function Lp(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?Ok(Object(s),!0).forEach(function(r){PY(e,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Ok(Object(s)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(s,r))})}return e}function PY(e,t,s){return(t=OY(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function OY(e){var t=LY(e,"string");return typeof t=="symbol"?t:t+""}function LY(e,t){if(typeof e!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var r=s.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function JR(e){return e&&e.map((t,s)=>wt.createElement(t.tag,Lp({key:s},t.attr),JR(t.child)))}function Vt(e){return t=>wt.createElement(DY,Op({attr:Lp({},e.attr)},t),JR(e.child))}function DY(e){var t=s=>{var{attr:r,size:a,title:o}=e,i=RY(e,EY),l=a||s.size||"1em",c;return s.className&&(c=s.className),e.className&&(c=(c?c+" ":"")+e.className),wt.createElement("svg",Op({stroke:"currentColor",fill:"
500currentColor",strokeWidth:"0"},s.attr,r,i,{className:c,style:Lp(Lp({color:e.color||s.color},s.style),e.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),o&&wt.createElement("title",null,o),e.children)};return Pk!==void 0?wt.createElement(Pk.Consumer,null,s=>t(s)):t(QR)}function IY(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8 12.5v-9l6 4.5-6 4.5z"},child:[]}]})(e)}function MY(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M6 19h4V5H6v14zm8-14v14h4V5h-4z"},child:[]}]})(e)}function $Y(e){return Vt({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M11 6h9"},child:[]},{tag:"path",attr:{d:"M11 12h9"},child:[]},{tag:"path",attr:{d:"M12 18h8"},child:[]},{tag:"path",attr:{d:"M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4"},child:[]},{tag:"path",attr:{d:"M6 10v-6l-2 2"},child:[]}]})(e)}function UY(e){return Vt({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3.604 7.197l7.138 -3.109a.96 .96 0 0 1 1.27 .527l4.924 11.902a1 1 0 0 1 -.514 1.304l-7.137 3.109a.96 .96 0 0 1 -1.271 -.527l-4.924 -11.903a1 1 0 0 1 .514 -1.304z"},child:[]},{tag:"path",attr:{d:"M15 4h1a1 1 0 0 1 1 1v3.5"},child:[]},{tag:"path",attr:{d:"M20 6c.264 .112 .52 .217 .768 .315a1 1 0 0 1 .53 1.311l-2.298 5.374"},child:[]}]})(e)}function zY(e){return Vt({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 12h-5"},child:[]},{tag:"path",attr:{d:"M15 8h-5"},child:[]},{tag:"path",attr:{d:"M19 17V5a2 2 0 0 0-2-2H4"},child:[]},{tag:"path",attr:{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3"},child:[]}]})(e)}function Hm(e){return Vt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M253.8 30.44c-9.5 1.2-18.1 12.3-18.1 26.8 0 8 2.7 15 6.7 19.9l4.9 5.8-7.5 1.4c-5.2 1-9 3.8-12.3 8.3-3.4 4.6-5.9 10.76-7.6 18.06-3.2 13.1-3.9 29.1-4 43.3h17.5l1.6 21.9c6.8-.3 13.8-.5 20.9-.5 7.5 0 14.8.2 21.9.6l1.5-22h16.6c0-14.3-.2-30.6-3.1-43.9-1.6-7.2-4-13.46-7.3-17.96s-7.4-7.2-13.3-8.1l-7.6-1.2 4.8-6c3.9-4.8 6.5-11.8 6.5-19.6 0-15.4-9.6-26.8-20.1-26.8zM61.9 174.4c-9.5 1.2-18.1 12.3-18.1 26.8 0 8 2.7 15 6.7 19.9l4.9 5.8-7.5 1.4c-5.2 1-9 3.8-12.3 8.3-3.4 4.6-5.9 10.8-7.6 18.1-3.2 13.1-3.9 29.1-4 43.3h17.5l4.7 64.3c12.2 2.8 25.2 2.6 36.94 0l4.3-64.3H104c0-14.3-.2-30.6-3.1-43.9-1.57-7.2-3.97-13.5-7.27-18-3.29-4.5-7.39-7.2-13.29-8.1l-7.64-1.2 4.8-6c3.94-4.8 6.54-11.8 6.54-19.6 0-15.4-9.64-26.8-20.14-26.8zm384 0c-9.5 1.2-18.1 12.3-18.1 26.8 0 8 2.7 15 6.7 19.9l4.9 5.8-7.5 1.4c-5.2 1-9 3.8-12.3 8.3-3.4 4.6-5.9 10.8-7.6 18.1-3.2 13.1-3.9 29.1-4 43.3h17.5l4.7 64.3c12.2 2.8 25.2 2.6 36.9 0l4.3-64.3H488c0-14.3-.2-30.6-3.1-43.9-1.6-7.2-4-13.5-7.3-18s-7.4-7.2-13.3-8.1l-7.6-1.2 4.8-6c3.9-4.8 6.5-11.8 6.5-19.6 0-15.4-9.6-26.8-20.1-26.8zm-190 19c-36.7 0-69.9 5.3-93.2 13.5-11.6 4.1-20.7 9-26.3 13.7-5.7 4.7-7.5 8.6-7.5 11.8 0 3.2 1.8 7.1 7.5 11.8 5.6 4.7 14.7 9.5 26.3 13.7 23.3 8.2 56.5 13.5 93.2 13.5s69.9-5.3 93.2-13.5c11.6-4.2 20.7-9 26.3-13.7 5.7-4.7 7.5-8.6 7.5-11.8 0-3.2-1.8-7.1-7.5-11.8-5.6-4.7-14.7-9.6-26.3-13.7-23.3-8.2-56.5-13.5-93.2-13.5zm-105 79.2v45.8h18v-39.8c-4.2-1.2-8.3-2.4-12.2-3.8-2-.7-3.9-1.4-5.8-2.2zm210 0c-1.9.8-3.8 1.5-5.8 2.2-3.9 1.4-8 2.6-12.2 3.8v39.8h18zm-107.1 19c-9.5 1.2-18.1 12.3-18.1 26.8 0 8 2.7 15 6.7 19.9l4.9 5.8-7.5 1.4c-5.2 1-9 3.8-12.3 8.3-3.4 4.6-5.9 10.8-7.6 18.1-3.2 13.1-3.9 29.1-4 43.3h17.5l4.7 64.3c12.2 2.8 25.2 2.6 36.9 0l4.3-64.3h16.6c0-14.3-.2-30.6-3.1-43.9-1.6-7.2-4-13.5-7.3-18s-7.4-7.2-13.3-8.1l-7.6-1.2 4.8-6c3.9-4.8 6.5-11.8 6.5-19.6 0-15.4-9.6-26.8-20.1-26.8z"},child:[]}]})(e)}function BY(e){return Vt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M463 20.3L315.6 75.65 368.5 109C274 228 137.3 301.3 21.8 329.2l32.72 59.6C184.3 346.5 321.7 270.2 410.2 135.4l40.3 25.4L463 20.3zm7.7 116.7l-4.8 54.8-51.3-32.4c-1.8 2.7-3.7 5.3-5.6 8V487h78V137h-16.3zM320.1 265c-12.7 11-25.8 21.4-39.1 31.2V487h78V265h-38.9zm-123.7 84c-14.4 7.6-28.8 14.6-43.4 21.2V487h78V349h-34.6zM25 393v94h78v-94h-5.68c-14.82 5.5-29.63 10.6-44.35 15.3l-7.06 2.2-9.6-17.5H25z"},child:[]}]})(e)}function FY(e){return Vt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M331.088 488.95l-101.23-47.053c-6.698-3.122-9.62-11.094-6.503-17.815l71.63-154.11c3.117-6.71 11.1-9.624 17.804-6.508l101.23 47.066c6.71 3.115 9.62 11.088 6.51 17.797l-71.64 154.11c-3.12 6.714-11.098 9.618-1
5007.802 6.514zM86.8 472.134L19.596 316.04c-2.927-6.797.218-14.686 7.004-17.607l33.275-14.328 41.578 156.25c3.99 14.937 19.32 23.84 34.267 19.864l33.14-8.823-64.445 27.752c-6.798 2.92-14.687-.22-17.614-7.017zm28.774-35.535L71.87 272.362c-1.905-7.152 2.362-14.498 9.502-16.398l28.89-7.683-3.475 25.864c-2.06 15.313 8.68 29.423 24.01 31.488l67.774 9.135-27.586 92.934c-2.845 9.578-.313 19.486 5.83 26.472l-44.847 11.926c-7.146 1.906-14.493-2.35-16.393-9.5zm92.055-4.043l-13.603-4.042c-7.1-2.112-11.14-9.565-9.034-16.664l48.364-162.92c2.112-7.1 9.577-11.14 16.658-9.04l41.667 12.38.006-.006.112.035-.118-.03c-4.19 2.76-7.677 6.68-9.937 11.547L210.1 417.944c-2.194 4.733-2.96 9.772-2.47 14.61zm-4.846-131.957l-70.033-9.44c-7.328-.992-12.48-7.743-11.494-15.078l22.695-168.43c.987-7.33 7.75-12.48 15.06-11.496l110.65 14.912c7.322.99 12.48 7.748 11.488 15.07l-13.96 103.622-13.02-3.866c-14.828-4.408-30.412 4.066-34.808 18.878l-16.576 55.828zm253.322-8.668l-7.253-15.94 37.418-16.98 7.23 15.95-37.394 16.97zm-9.353-27.805l-32.792-72.222c11.484-2.738 22.354-7.624 32.026-14.41l32.726 72.133-31.96 14.5zm-83.41-88.155c-41.006-16.174-61.152-62.585-44.977-103.603 16.18-40.993 62.603-61.15 103.603-44.977 41.01 16.18 61.15 62.604 44.982 103.62-16.187 40.995-62.604 61.147-103.61 44.96zm86.378-51.78c12.434-31.488-3.038-67.135-34.55-79.563-31.493-12.427-67.14 3.045-79.58 34.544-12.427 31.5 3.05 67.16 34.557 79.58 31.5 12.43 67.146-3.043 79.574-34.56zm-30.106-16.96c1.96-22.547-12.634-42.758-33.676-48.653 3.86-.732 7.9-.956 12.014-.602 24.27 2.1 42.292 23.492 40.197 47.768-2.078 23.94-22.914 41.79-46.766 40.274 15.366-6.48 26.702-21.03 28.23-38.787z"},child:[]}]})(e)}function WY(e){return Vt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M226.063 24.22l-9.782 32.624c12.992-2.652 26.423-4.032 40.19-4.032 10.475 0 20.766.82 30.81 2.376l-9.405-30.97h-51.813zm30.406 48.843c-99.627 0-180.19 80.53-180.19 180.156 0 99.624 80.563 180.155 180.19 180.155 99.624 0 180.155-80.53 180.155-180.156 0-99.627-80.53-180.157-180.156-180.157zm0 41.687c76.482 0 138.467 61.985 138.467 138.47 0 76.482-61.985 138.5-138.468 138.5-76.485 0-138.5-62.018-138.5-138.5 0-76.485 62.015-138.47 138.5-138.47zm-.033 38.938c-54.96 0-99.53 44.54-99.53 99.5s44.57 99.5 99.53 99.5 99.5-44.54 99.5-99.5-44.54-99.5-99.5-99.5zm.032 39.687c33.052 0 59.842 26.79 59.842 59.844 0 33.052-26.79 59.843-59.843 59.843-33.055 0-59.845-26.79-59.845-59.844 0-33.055 26.79-59.845 59.844-59.845zm0 30.906c-15.993 0-28.97 12.947-28.97 28.94 0 15.99 12.977 28.968 28.97 28.968 15.99 0 28.936-12.977 28.936-28.97 0-15.99-12.945-28.937-28.937-28.937zM114.905 395l-27.844 92.875h46.876l20.28-62.313c-14.35-8.54-27.56-18.833-39.312-30.562zm277.188 5.688c-11.982 11.026-25.324 20.595-39.72 28.468l19.25 58.72h46.907l-26.436-87.188zm-165.03 50.78v36.407h52.092v-35.53c-7.45.84-15.015 1.28-22.687 1.28-9.99 0-19.81-.74-29.408-2.156z"},child:[]}]})(e)}function HY(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M7.22 14.47 9.69 12 7.22 9.53a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l3 3a.75.75 0 0 1 0 1.06l-3 3a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Z"},child:[]},{tag:"path",attr:{d:"M3.75 2h16.5c.966 0 1.75.784 1.75 1.75v16.5A1.75 1.75 0 0 1 20.25 22H3.75A1.75 1.75 0 0 1 2 20.25V3.75C2 2.784 2.784 2 3.75 2ZM3.5 3.75v16.5c0 .138.112.25.25.25H15v-17H3.75a.25.25 0 0 0-.25.25Zm13 16.75h3.75a.25.25 0 0 0 .25-.25V3.75a.25.25 0 0 0-.25-.25H16.5Z"},child:[]}]})(e)}function GY(e){return Vt({attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M12.433 10.07C14.133 10.585 16 11.15 16 8a8 8 0 1 0-8 8c1.996 0 1.826-1.504 1.649-3.08-.124-1.101-.252-2.237.351-2.92.465-.527 1.42-.237 2.433.07M8 5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m4.5 3a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3M5 6.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m.5 6.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3"},child:[]}]})(e)}function VY(e){return Vt({attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M8 0a1 1 0 0 1 1 1v5.268l4.562-2.634a1 1 0 1 1 1 1.732L10 8l4.562 2.634a1 1 0 1 1-1 1.732L9 9.732V15a1 1 0 1 1-2 0V9.732l-4.562 2.634a1 1 0 1 1-1-1.732L6 8 1.438 5.366a1 1 0 0 1 1-1.732L7 6.268V1a1 1 0 0 1 1-1"},child:[]}]})(e)}function Gm(e){return Vt({attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"},child:[]}]})(e)}function XR(e){return Vt({attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M11.571 4.714h1.715v5.143H11.57zm4.715 0H18v5.143h-1.714zM6 0L1.714 4.286v15.428h5.143V24l4.286-4.286h3.428L22.286 12V0zm14.571 11.143l-3.428 3.428h-3.429l-3 3v-3H6.857V1.714h13.714Z"},child:[]}]})(e)}function e6(e){return Vt({attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z"},child:[]}]})(e)}function t6(e){return Vt({attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M19.199 24C19.199 13.467 10.533 4.8 0 4.8V0c13.165 0 24 10.835 24 24h-4.801zM3.291 17.415c1.814 0 3.293 1.479 3.293 3.295 0 1.813-1.485 3.29-3.301 3.29C1.47 24 0 22.526 0 20.71s1.475-3.294 3.291-3.295zM15.909 24h-4.665c0-6.169-5.075-11.245-11.244-11.245V8.09c8.727 0 15.909 7.184 15.909 15.91z"},child:[]}]})(e)}function Av(e){return Vt({attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M22.957 7.21c-.004-3.064-2.391-5.576-5.191-6.482-3.478-1.125-8.064-.962-11.384.604C2.357 3.231 1.093 7.391 1.046 11.54c-.039 3.411.302 12.396 5.369 12.46 3.765.047 4.326-4.804 6.068-7.141 1.24-1.662 2.836-2.132 4.801-2.618 3.376-.836 5.678-3.501 5.673-7.031Z"},child:[]}]})(e)}function KY(e){return Vt({attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 
5000 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"},child:[]}]})(e)}function s6(e){return Vt({attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5.34 0A5.328 5.328 0 000 5.34v13.32A5.328 5.328 0 005.34 24h13.32A5.328 5.328 0 0024 18.66V5.34A5.328 5.328 0 0018.66 0zm6.525 2.568c2.336 0 4.448.902 6.056 2.587 1.224 1.272 1.912 2.619 2.264 4.392.12.59.12 2.2.007 2.864a8.506 8.506 0 01-3.24 5.296c-.608.46-2.096 1.261-2.336 1.261-.088 0-.096-.091-.056-.46.072-.592.144-.715.48-.856.536-.224 1.448-.874 2.008-1.435a7.644 7.644 0 002.008-3.536c.208-.824.184-2.656-.048-3.504-.728-2.696-2.928-4.792-5.624-5.352-.784-.16-2.208-.16-3 0-2.728.56-4.984 2.76-5.672 5.528-.184.752-.184 2.584 0 3.336.456 1.832 1.64 3.512 3.192 4.512.304.2.672.408.824.472.336.144.408.264.472.856.04.36.03.464-.056.464-.056 0-.464-.176-.896-.384l-.04-.03c-2.472-1.216-4.056-3.274-4.632-6.012-.144-.706-.168-2.392-.03-3.04.36-1.74 1.048-3.1 2.192-4.304 1.648-1.737 3.768-2.656 6.128-2.656zm.134 2.81c.409.004.803.04 1.106.106 2.784.62 4.76 3.408 4.376 6.174-.152 1.114-.536 2.03-1.216 2.88-.336.43-1.152 1.15-1.296 1.15-.023 0-.048-.272-.048-.603v-.605l.416-.496c1.568-1.878 1.456-4.502-.256-6.224-.664-.67-1.432-1.064-2.424-1.246-.64-.118-.776-.118-1.448-.008-1.02.167-1.81.562-2.512 1.256-1.72 1.704-1.832 4.342-.264 6.222l.413.496v.608c0 .336-.027.608-.06.608-.03 0-.264-.16-.512-.36l-.034-.011c-.832-.664-1.568-1.842-1.872-2.997-.184-.698-.184-2.024.008-2.72.504-1.878 1.888-3.335 3.808-4.019.41-.145 1.133-.22 1.814-.211zm-.13 2.99c.31 0 .62.06.844.178.488.253.888.745 1.04 1.259.464 1.578-1.208 2.96-2.72 2.254h-.015c-.712-.331-1.096-.956-1.104-1.77 0-.733.408-1.371 1.112-1.745.224-.117.534-.176.844-.176zm-.011 4.728c.988-.004 1.706.349 1.97.97.198.464.124 1.932-.218 4.302-.232 1.656-.36 2.074-.68 2.356-.44.39-1.064.498-1.656.288h-.003c-.716-.257-.87-.605-1.164-2.644-.341-2.37-.416-3.838-.218-4.302.262-.616.974-.966 1.97-.97z"},child:[]}]})(e)}function et(e){return function(s){const r=s.className?`shrink-0 ${s.className}`:"shrink-0";return n.jsx(e,{...s,className:r})}}const qY=et(nc);function Jt(e){return n.jsx(qY,{strokeWidth:3,...e})}const ZY=et(OU),Lk=et(Ky),Et=et(fs),lo=et(Zy),co=et(rc),YY=et(qU),n6=et(Yy),QY=et(az),JY=et(Pz),XY=et(Dz),eQ=et(zz),en=et($T),tQ=et(UT),sQ=et(Ac),nQ=et(gz),M1=et(yz),Pv=et(wz),r6=et(Wz),$1=et(KT),rQ=et(qT),a6=et(ev),Ov=et(DT),aQ=et(MY);function lc({size:e=24,className:t,...s}){return n.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:t?`shrink-0 ${t}`:"shrink-0",...s,children:n.jsx("path",{d:"M5 4.623V19.38a1.5 1.5 0 002.26 1.29L22 12 7.26 3.33A1.5 1.5 0 005 4.623Z"})})}const oQ=et(IY),Gn=et(UY),o6=et($Y),cc=et(zY),i6=et(FY),gr=et(Hm),iQ=et(WY),lQ=et(HY),uo=et(VY),ia=et(GY),l6=et(KY);function la({size:e=16,className:t}){return n.jsx(l6,{size:e,className:t,"aria-hidden":!0})}function c6(e){var t,s,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]&&(s=c6(e[t]))&&(r&&(r+=" "),r+=s)}else for(s in e)e[s]&&(r&&(r+=" "),r+=s);return r}function cQ(){for(var e,t,s=0,r="",a=arguments.length;s<a;s++)(e=arguments[s])&&(t=c6(e))&&(r&&(r+=" "),r+=t);return r}const dQ=(e,t)=>{const s=new Array(e.length+t.length);for(let r=0;r<e.length;r++)s[r]=e[r];for(let r=0;r<t.length;r++)s[e.length+r]=t[r];return s},uQ=(e,t)=>({classGroupId:e,validator:t}),d6=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),Dp="-",Dk=[],fQ="arbitrary..",hQ=e=>{const t=mQ(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return pQ(i);const l=i.split(Dp),c=l[0]===""&&l.length>1?1:0;return u6(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=r[i],d=s[i];return c?d?dQ(d,c):c:d||Dk}return s[i]||Dk}}},u6=(e,t,s)=>{if(e.length-t===0)return s.classGroupId;const a=e[t],o=s.nextPart.get(a);if(o){const d=u6(e,t+1,o);if(d)return d}const i=s.validators;if(i===null)return;const l=t===0?e.join(Dp):e.slice(t).join(Dp),c=i.length;for(let d=0;d<c;d++){const u=i[d];if(u.validator(l))return u.classGroupId}},pQ=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),s=t.indexOf(":"),r=t.slice(0,s);return r?fQ+r:void 0})(),mQ=e=>{const{theme:t,classGroups:s}=e;return xQ(s,t)},xQ=(e,t)=>{const s=d6();for(const r in e){const a=e[r];Lv(a,s,r,t)}return s},Lv=(e,t,s,r)=>{const a=e.length;for(let o=0;o<a;o++){const i=e[o];gQ(i,t,s,r)}},gQ=(e,t,s,r)=>{if(typeof e=="string"){bQ(e,t,s);return}if(typeof e=="function"){yQ(e,t,s,r);return}vQ(e,t,s,r)},bQ=(e,t,s)=>
vendor: 6,957 bytes, line 500
500{const r=e===""?t:f6(t,e);r.classGroupId=s},yQ=(e,t,s,r)=>{if(wQ(e)){Lv(e(r),t,s,r);return}t.validators===null&&(t.validators=[]),t.validators.push(uQ(s,e))},vQ=(e,t,s,r)=>{const a=Object.entries(e),o=a.length;for(let i=0;i<o;i++){const[l,c]=a[i];Lv(c,f6(t,l),s,r)}},f6=(e,t)=>{let s=e;const r=t.split(Dp),a=r.length;for(let o=0;o<a;o++){const i=r[o];let l=s.nextPart.get(i);l||(l=d6(),s.nextPart.set(i,l)),s=l}return s},wQ=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,jQ=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=Object.create(null),r=Object.create(null);const a=(o,i)=>{s[o]=i,t++,t>e&&(t=0,r=s,s=Object.create(null))};return{get(o){let i=s[o];if(i!==void 0)return i;if((i=r[o])!==void 0)return a(o,i),i},set(o,i){o in s?s[o]=i:a(o,i)}}},U1="!",Ik=":",kQ=[],Mk=(e,t,s,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:r,isExternal:a}),SQ=e=>{const{prefix:t,experimentalParseClassName:s}=e;let r=a=>{const o=[];let i=0,l=0,c=0,d;const u=a.length;for(let b=0;b<u;b++){const w=a[b];if(i===0&&l===0){if(w===Ik){o.push(a.slice(c,b)),c=b+1;continue}if(w==="/"){d=b;continue}}w==="["?i++:w==="]"?i--:w==="("?l++:w===")"&&l--}const f=o.length===0?a:a.slice(c);let h=f,m=!1;f.endsWith(U1)?(h=f.slice(0,-1),m=!0):f.startsWith(U1)&&(h=f.slice(1),m=!0);const y=d&&d>c?d-c:void 0;return Mk(o,m,h,y)};if(t){const a=t+Ik,o=r;r=i=>i.startsWith(a)?o(i.slice(a.length)):Mk(kQ,!1,i,void 0,!0)}if(s){const a=r;r=o=>s({className:o,parseClassName:a})}return r},NQ=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((s,r)=>{t.set(s,1e6+r)}),s=>{const r=[];let a=[];for(let o=0;o<s.length;o++){const i=s[o],l=i[0]==="[",c=t.has(i);l||c?(a.length>0&&(a.sort(),r.push(...a),a=[]),r.push(i)):a.push(i)}return a.length>0&&(a.sort(),r.push(...a)),r}},CQ=e=>({cache:jQ(e.cacheSize),parseClassName:SQ(e),sortModifiers:NQ(e),...hQ(e)}),_Q=/\s+/,TQ=(e,t)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:o}=t,i=[],l=e.trim().split(_Q);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:f,modifiers:h,hasImportantModifier:m,baseClassName:y,maybePostfixModifierPosition:b}=s(u);if(f){c=u+(c.length>0?" "+c:c);continue}let w=!!b,x=r(w?y.substring(0,b):y);if(!x){if(!w){c=u+(c.length>0?" "+c:c);continue}if(x=r(y),!x){c=u+(c.length>0?" "+c:c);continue}w=!1}const g=h.length===0?"":h.length===1?h[0]:o(h).join(":"),v=m?g+U1:g,k=v+x;if(i.indexOf(k)>-1)continue;i.push(k);const S=a(x,w);for(let N=0;N<S.length;++N){const C=S[N];i.push(v+C)}c=u+(c.length>0?" "+c:c)}return c},EQ=(...e)=>{let t=0,s,r,a="";for(;t<e.length;)(s=e[t++])&&(r=h6(s))&&(a&&(a+=" "),a+=r);return a},h6=e=>{if(typeof e=="string")return e;let t,s="";for(let r=0;r<e.length;r++)e[r]&&(t=h6(e[r]))&&(s&&(s+=" "),s+=t);return s},RQ=(e,...t)=>{let s,r,a,o;const i=c=>{const d=t.reduce((u,f)=>f(u),e());return s=CQ(d),r=s.cache.get,a=s.cache.set,o=l,l(c)},l=c=>{const d=r(c);if(d)return d;const u=TQ(c,s);return a(c,u),u};return o=i,(...c)=>o(EQ(...c))},AQ=[],Kt=e=>{const t=s=>s[e]||AQ;return t.isThemeGetter=!0,t},p6=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,m6=/^\((?:(\w[\w-]*):)?(.+)\)$/i,PQ=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,OQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,LQ=/\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$/,DQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,IQ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,MQ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,pa=e=>PQ.test(e),Ke=e=>!!e&&!Number.isNaN(Number(e)),ma=e=>!!e&&Number.isInteger(Number(e)),lg=e=>e.endsWith("%")&&Ke(e.slice(0,-1)),Sr=e=>OQ.test(e),x6=()=>!0,$Q=e=>LQ.test(e)&&!DQ.test(e),Dv=()=>!1,UQ=e=>IQ.test(e),zQ=e=>MQ.test(e),BQ=e=>!xe(e)&&!ve(e),FQ=e=>So(e,y6,Dv),xe=e=>p6.test(e),Po=e=>So(e,v6,$Q),$k=e=>So(e,YQ,Ke),WQ=e=>So(e,j6,x6),HQ=e=>So(e,w6,Dv),Uk=e=>So(e,g6,Dv),GQ=e=>So(e,b6,zQ),Xf=e=>So(e,k6,UQ),ve=e=>m6.test(e),od=e=>Ii(e,v6),VQ=e=>Ii(e,w6),zk=e=>Ii(e,g6),KQ=e=>Ii(e,y6),qQ=e=>Ii(e,b6),eh=e=>Ii(e,k6,!0),ZQ=e=>Ii(e,j6,!0),So=(e,t,s)=>{const r=p6.exec(e);return r?r[1]?t(r[1]):s(r[2]):!1},Ii=(e,t,s=!1)=>{const r=m6.exec(e);return r?r[1]?t(r[1]):s:!1},g6=e=>e==="position"||e==="percentage",b6=e=>e==="image"||e==="url",y6=e=>e==="length"||e==="size"||e==="bg-size",v6=e=>e==="length",YQ=e=>e==="number",w6=e=>e==="family-name",j6=e=>e==="number"||e==="weight",k6=e=>e==="shadow",QQ=()=>{const e=Kt("color"),t=Kt("font"),s=Kt("text"),r=Kt("font-weight"),a=Kt("tracking"),o=Kt("leading"),i=Kt("breakpoint"),l=Kt("container"),c=Kt("spacing"),d=Kt("radius"),u=Kt("shadow"),f=Kt("inset-shadow"),h=Kt("text-shadow"),m=Kt("drop-shadow"),y=Kt("blur"),b=Kt("perspective"),w=Kt("aspect"),x=Kt("ease"),g=Kt("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...k(),ve,xe],N=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],_=()=>[ve,xe,c],T=()=>[pa,"full","auto",..._()],E=()=>[ma,"none","subgrid",ve,xe],A=()=>["auto",{span:["full",ma,ve,xe]},ma,ve,xe],P=()=>[ma,"auto",ve,xe],M=()=>["auto","min","max","fr",ve,xe],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",..._()],q=()=>[pa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],O=()=>[pa,"screen","full","dvw","lvw","svw","min","max","fit",..._()],H=()=>[pa,"screen","full","lh","dvh","lvh","svh","min","max","fit",..._()],B=()=>[e,ve,xe],D=()=>[...k(),zk,Uk,{position:[ve,xe]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",KQ,FQ,{size:[ve,xe]}],V=()=>[lg,od,Po],z=()=>["","none","full",d,ve,xe],K=()=>["",Ke,od,Po],W=()=>["solid","dashed","dotted","double"],J=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>[Ke,lg,zk,Uk],Y=()=>["","none",y,ve,xe],ae=()=>["none",Ke,ve,xe],pe=()=>["none",Ke,ve,xe],ye=()=>[Ke,ve,xe],De=()=>[pa,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Sr],breakpoint:[Sr],color:[x6],container:[Sr],"drop-shadow":[Sr],ease:["in","out","in-out"],font:[BQ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Sr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Sr],shadow:[Sr],spacing:["px",Ke],text:[Sr],"text-shadow":[Sr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",pa,xe,ve,w]}
vendor: 6,090 bytes, line 500
500],container:["container"],columns:[{columns:[Ke,xe,ve,l]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"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"],sr:["sr-only","not-sr-only"],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:S()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[ma,"auto",ve,xe]}],basis:[{basis:[pa,"full","auto",l,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ke,pa,"auto","initial","none",xe]}],grow:[{grow:["",Ke,ve,xe]}],shrink:[{shrink:["",Ke,ve,xe]}],order:[{order:[ma,"first","last","none",ve,xe]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":M()}],"auto-rows":[{"auto-rows":M()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...U(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pbs:[{pbs:_()}],pbe:[{pbe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mbs:[{mbs:I()}],mbe:[{mbe:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...O()]}],"min-inline-size":[{"min-inline":["auto",...O()]}],"max-inline-size":[{"max-inline":["none",...O()]}],"block-size":[{block:["auto",...H()]}],"min-block-size":[{"min-block":["auto",...H()]}],"max-block-size":[{"max-block":["none",...H()]}],w:[{w:[l,"screen",...q()]}],"min-w":[{"min-w":[l,"screen","none",...q()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",s,od,Po]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ZQ,WQ]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",lg,xe]}],"font-family":[{font:[VQ,HQ,t]}],"font-features":[{"font-features":[xe]}],"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:[a,ve,xe]}],"line-clamp":[{"line-clamp":[Ke,"none",ve,$k]}],leading:[{leading:[o,..._()]}],"list-image":[{"list-image":["none",ve,xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ve,xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...W(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ke,"from-font","auto",ve,Po]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[Ke,"auto",ve,xe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ve,xe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ve,xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:D()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ma,ve,xe],radial:["",ve,xe],conic:[ma,ve,xe]},qQ,GQ]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:V()}
500],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-bs":[{"border-bs":K()}],"border-w-be":[{"border-be":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...W(),"hidden","none"]}],"divide-style":[{divide:[...W(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-bs":[{"border-bs":B()}],"border-color-be":[{"border-be":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}
vendor: 5,730 bytes, line 500
500],"divide-color":[{divide:B()}],"outline-style":[{outline:[...W(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ke,ve,xe]}],"outline-w":[{outline:["",Ke,od,Po]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",u,eh,Xf]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",f,eh,Xf]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[Ke,Po]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",h,eh,Xf]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[Ke,ve,xe]}],"mix-blend":[{"mix-blend":[...J(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":J()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ke]}],"mask-image-linear-from-pos":[{"mask-linear-from":Z()}],"mask-image-linear-to-pos":[{"mask-linear-to":Z()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":Z()}],"mask-image-t-to-pos":[{"mask-t-to":Z()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":Z()}],"mask-image-r-to-pos":[{"mask-r-to":Z()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":Z()}],"mask-image-b-to-pos":[{"mask-b-to":Z()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":Z()}],"mask-image-l-to-pos":[{"mask-l-to":Z()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":Z()}],"mask-image-x-to-pos":[{"mask-x-to":Z()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":Z()}],"mask-image-y-to-pos":[{"mask-y-to":Z()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[ve,xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":Z()}],"mask-image-radial-to-pos":[{"mask-radial-to":Z()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[Ke]}],"mask-image-conic-from-pos":[{"mask-conic-from":Z()}],"mask-image-conic-to-pos":[{"mask-conic-to":Z()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ve,xe]}],filter:[{filter:["","none",ve,xe]}],blur:[{blur:Y()}],brightness:[{brightness:[Ke,ve,xe]}],contrast:[{contrast:[Ke,ve,xe]}],"drop-shadow":[{"drop-shadow":["","none",m,eh,Xf]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",Ke,ve,xe]}],"hue-rotate":[{"hue-rotate":[Ke,ve,xe]}],invert:[{invert:["",Ke,ve,xe]}],saturate:[{saturate:[Ke,ve,xe]}],sepia:[{sepia:["",Ke,ve,xe]}],"backdrop-filter":[{"backdrop-filter":["","none",ve,xe]}],"backdrop-blur":[{"backdrop-blur":Y()}],"backdrop-brightness":[{"backdrop-brightness":[Ke,ve,xe]}],"backdrop-contrast":[{"backdrop-contrast":[Ke,ve,xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ke,ve,xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ke,ve,xe]}],"backdrop-invert":[{"backdrop-invert":["",Ke,ve,xe]}],"backdrop-opacity":[{"backdrop-opacity":[Ke,ve,xe]}],"backdrop-saturate":[{"backdrop-saturate":[Ke,ve,xe]}],"backdrop-sepia":[{"backdrop-sepia":["",Ke,ve,xe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ve,xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ke,"initial",ve,xe]}],ease:[{ease:["linear","initial",x,ve,xe]}],delay:[{delay:[Ke,ve,xe]}],animate:[{animate:["none",g,ve,xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,ve,xe]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:pe()}],"scale-x":[{"scale-x":pe()}],"scale-y":[{"scale-y":pe()}],"scale-z":[{"scale-z":pe()}],"scale-3d":["scale-3d"],skew:[{skew:ye()}],"skew-x":[{"skew-x":ye()}],"skew-y":[{"skew-y":ye()}],transform:[{transform:[ve,xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:De()}],"translate-x":[{"translate-x":De()}],"translate-y":[{"translate-y":De()}],"translate-z":[{"translate-z":De()}],"translate-none":["translate-none"],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}
500],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",ve,xe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mbs":[{"scroll-mbs":_()}],"scroll-mbe":[{"scroll-mbe":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pbs":[{"scroll-pbs":_()}],"scroll-pbe":[{"scroll-pbe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ve,xe]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[Ke,od,Po,$k]}],stroke:[{stroke:["none",...B()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","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-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","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-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","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-pbs","scroll-pbe","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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},JQ=RQ(QQ);function j(...e){return JQ(cQ(e))}const Ip="/llu-logo.svg";function yr({size:e=32}){return n.jsx("img",{src:Ip,alt:"Limited Level-Ups",style:{height:e,width:"auto"},className:"block"})}function XQ({size:e="md",subtitle:t="LEADERBOARD",subtitleShort:s}){if(e==="sm")return n.jsxs("div",{className:"flex items-center font-display whitespace-nowrap",style:{gap:10},children:[n.jsx("span",{className:"text-text leading-none",style:{fontSize:18,letterSpacing:"0.07em"},children:"LIMITED LEVEL-UPS"}),n.jsx("span",{className:"bg-border2 shrink-0",style:{width:1,height:16}}),n.jsx("span",{className:"text-green leading-none",style:{fontSize:15,letterSpacing:"0.14em"},children:s??t})]});const r=e==="lg"?26:18,a=e==="lg"?14:10;return n.jsxs("div",{className:"flex flex-col font-display whitespace-nowrap",style:{lineHeight:.95},children:[n.jsx("span",{className:"text-text",style:{fontSize:r,letterSpacing:"0.09em"},children:"LIMITED LEVEL-UPS"}),n.jsx("span",{className:"text-green",style:{fontSize:a,letterSpacing:"0.28em",marginTop:4},children:t})]})}const Xr="polygon(8% 0, 100% 0, 100% 92%, 92% 100%, 0 100%, 0 8%)";function as({displayName:e,avatarUrl:t,size:s=36,green:r=!1}
500){const[a,o]=wt.useState(!1),i=e.split(/[\s\-_().]+/).filter(Boolean).map(l=>l[0]).join("").slice(0,2).toUpperCase();return t&&!a?n.jsx("img",{src:t,alt:e,width:s,height:s,onError:()=>o(!0),className:"block shrink-0 object-cover",style:{clipPath:Xr}}):n.jsx("div",{className:j("bg-surface2 border flex items-center justify-center font-display tracking-[0.05em] shrink-0",r?"border-green text-green":"border-border2 text-text"),style:{width:s,height:s,fontSize:s*.45,clipPath:Xr},children:i})}function ct({size:e=12,color:t,className:s}){return n.jsx("svg",{width:e,height:e,viewBox:"0 0 16 16",className:s?`shrink-0 ${s}`:"shrink-0",style:t?{color:t}:void 0,"aria-hidden":"true",children:n.jsx("path",{d:"M4 2h8v3a4 4 0 0 1-8 0V2zm-2 1h2v2a4 4 0 0 1-2-2zm10 0h2a4 4 0 0 1-2 2V3zM6 9h4v2H9v2h2v1H5v-1h2v-2H6V9z",fill:t??"currentColor"})})}const ea=e=>Math.round(e).toLocaleString("en-US"),S6={CUBE:"pz1",PEASANT:"pz1",IPA:"inv",CHAOS:"mb2"},z1={EVG:{src:Ip,mode:"image"},MEMA:{src:"/set-symbols/mema.png",mode:"mask"}};function Vm(e){return S6[e]??e.toLowerCase()}const eJ=Object.fromEntries([...vi.map(e=>[ic(e.slug),e.glyph]),...vi.flatMap(e=>(e.seasons??[]).map(t=>[ic(t.code),t.glyph??`keyrune:${t.code.toLowerCase()}`]))]),tJ=.82,sJ={FLASHBACK:"mana:flashback"};function nJ(e){const t=sJ[e]??eJ[e];if(t===void 0)return{className:`ss ss-${Vm(e)}`,scale:1};const[s,r]=t.split(":");return s==="mana"?{className:`ms ms-${r}`,scale:tJ}:{className:`ss ss-${r}`,scale:1}}function Qt(e){return e.glyphCode?e.glyphCode:e.custom&&!(e.code in S6)&&!(e.code in z1)?"CUBE":e.code}function N6({code:e,rarity:t,size:s}){const r=t==="common";return n.jsx("i",{className:j("ss",`ss-${Vm(e)}`,!r&&`ss-${t} ss-grad`),style:{fontSize:s,color:r?"#fff":void 0}})}function Ae({code:e,size:t=18,className:s="text-white"}){const r=nJ(e),a=typeof t=="number"?t*r.scale:`calc(${t} * ${r.scale})`;return n.jsx("span",{className:"inline-flex items-center justify-center shrink-0 overflow-visible",style:{width:t,height:t},"aria-hidden":"true",children:z1[e]?n.jsx(rJ,{glyph:z1[e],size:t,className:s}):n.jsx("i",{className:`${r.className} ${s}`,style:{fontSize:a,lineHeight:1}})})}function rJ({glyph:e,size:t,className:s}){return e.mode==="image"?n.jsx("img",{src:e.src,alt:"",style:{width:t,height:t},className:"block object-contain"}):n.jsx("span",{className:s,style:{width:t,height:t,backgroundColor:"currentColor",WebkitMaskImage:`url(${e.src})`,maskImage:`url(${e.src})`,WebkitMaskSize:"contain",maskSize:"contain",WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat",WebkitMaskPosition:"center",maskPosition:"center"}})}function ut(e=720){const[t,s]=wt.useState(typeof window<"u"?window.innerWidth<e:!1);return wt.useEffect(()=>{const r=window.matchMedia(`(max-width: ${e-1}px)`),a=o=>s(o.matches);return a(r),r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[e]),t}function Km(){const e="(orientation: landscape) and (max-height: 520px)",[t,s]=wt.useState(typeof window<"u"?window.matchMedia(e).matches:!1);return wt.useEffect(()=>{const r=window.matchMedia(e),a=o=>s(o.matches);return a(r),r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[]),t}function Mc(){const e=ut(),t=Km();return e||t}const C6=[[1400,6],[1100,5]],aJ=2,Bk=4;function Fk(){if(typeof window>"u")return Bk;for(const[e,t]of C6)if(window.matchMedia(`(min-width: ${e}px)`).matches)return t;return Bk}function oJ(e,t=0){const[s,r]=wt.useState(Fk);return wt.useEffect(()=>{const a=C6.map(([i])=>window.matchMedia(`(min-width: ${i}px)`)),o=()=>r(Fk());return a.forEach(i=>i.addEventListener("change",o)),o(),()=>a.forEach(i=>i.removeEventListener("change",o))},[]),Math.max(aJ,Math.min(e,s-t))}const _6=[[1024,3],[768,2]];function Wk(){if(typeof window>"u")return 1;for(const[e,t]of _6)if(window.matchMedia(`(min-width: ${e}px)`).matches)return t;return 1}function iJ(){const[e,t]=wt.useState(Wk);return wt.useEffect(()=>{const s=_6.map(([a])=>window.matchMedia(`(min-width: ${a}px)`)),r=()=>t(Wk());return s.forEach(a=>a.addEventListener("change",r)),r(),()=>s.forEach(a=>a.removeEventListener("change",r))},[]),e}const lJ=null,Hk=()=>{},T6=p.createContext({user:null,loading:!0,signIn:Hk,signOut:Hk});function cJ(){const e=new URLSearchParams(window.location.search);if(!e.has("code")&&!e.has("state"))return;e.delete("code"),e.delete("state");const t=e.toString();window.history.replaceState(null,"",window.location.pathname+(t?`?${t}`:"")+window.location.hash)}function Gk(e){var r;if(!(e!=null&&e.user))return null;const t=e.user.user_metadata,s=t.provider_id??t.sub??"";return s?{id:e.user.id,discordId:s,username:((r=t.custom_claims)==null?void 0:r.global_name)??t.full_name??t.name??"Unknown",avatarUrl:t.avatar_url??null}:null}function dJ({children:e}){const[t,s]=p.useState(ag),[r,a]=p.useState(!ag);p.useEffect(()=>{if(!$t)return;$t.auth.getSession().then(({data:{session:c}})=>{s(Gk(c)),a(!1)});const{data:{subscription:l}}=$t.auth.onAuthStateChange((c,d)=>{s(Gk(d)),cJ()});return()=>l.unsubscribe()},[]);const o=()=>
500{if(!$t){s(ag);return}$t.auth.signInWithOAuth({provider:"discord",options:{redirectTo:window.location.href}})},i=()=>{if(!$t){s(null);return}$t.auth.signOut()};return n.jsx(T6.Provider,{value:{user:t,loading:r,signIn:o,signOut:i},children:e})}function Qn(){return p.useContext(T6)}const uJ=!1,Vk=new Set;function fJ(){return"live"}let hJ=fJ();function pJ(e){return Vk.add(e),()=>Vk.delete(e)}function E6(){return p.useSyncExternalStore(pJ,()=>hJ,()=>"live")}const Kk=new Set;function mJ(){return"auto"}let xJ=mJ();function gJ(e){return Kk.add(e),()=>Kk.delete(e)}function R6(){return p.useSyncExternalStore(gJ,()=>xJ,()=>"auto")}function wi(e){return Date.now()}function ji(e){return`p0p1-picks-${e}`}function A6(e){try{const t=localStorage.getItem(ji(e));return t?JSON.parse(t):[]}catch{return[]}}function bJ(e,t){localStorage.setItem(ji(e),JSON.stringify(t)),window.dispatchEvent(new StorageEvent("storage",{key:ji(e)}))}function yJ(e,t,s){const r=A6(e).filter(a=>a.slot!==t);r.push({slot:t,cardName:s,lastUpdated:new Date().toISOString()}),bJ(e,r)}function qk(e){localStorage.removeItem(ji(e)),window.dispatchEvent(new StorageEvent("storage",{key:ji(e)}))}function vJ(e){return A6(e)}function wJ(e){const t=p.useCallback(a=>{const o=ji(e),i=l=>{(l.key===o||l.key===null)&&a()};return window.addEventListener("storage",i),()=>window.removeEventListener("storage",i)},[e]),s=p.useCallback(()=>localStorage.getItem(ji(e))??"",[e]),r=p.useSyncExternalStore(t,s);try{return r?JSON.parse(r):[]}catch{return[]}}const jJ=260;function kJ(e){const{user:t,loading:s,signIn:r}=Qn();E6();const a=uJ,o=!!t,i=BR(e),l=i==null?void 0:i.code;i==null||i.scoringDate;const{data:c,isLoading:d}=lY(l),{data:u,isFetched:f}=FR(o?l:void 0),h=wJ(l??""),m=cY(l??""),y=fY(l??""),[b,w]=p.useState(null),x=p.useRef(!1);p.useEffect(()=>{if(!o||!u||!l||x.current)return;x.current=!0;const we=vJ(l);if(we.length===0)return;const He=new Set(u.map(Q=>Q.slot)),ee=we.filter(Q=>!He.has(Q.slot));for(const Q of ee)m.mutate({slot:Q.slot,cardName:Q.cardName});qk(l)},[t,u,m,l]);const v=s?void 0:o?u??(f?[]:void 0):h,k=!!(i&&c)&&v!==void 0,S=p.useCallback((we,He)=>{l&&(o?m.mutate({slot:we,cardName:He}):yJ(l,we,He))},[o,m,l]),N=p.useCallback(()=>{l&&(o?y.mutate():qk(l))},[o,y,l]),C=p.useMemo(()=>Um(l?Lc[l]:void 0),[l]),_=p.useMemo(()=>c?new Map(c.map(we=>[we.name,we])):new Map,[c]),T=p.useMemo(()=>v?new Map(v.map(we=>[we.slot,we.cardName])):new Map,[v]),E=p.useMemo(()=>new Set(T.values()),[T]),A=p.useMemo(()=>{const we=new Map;for(const He of C){const ee=T.get(He.key);ee&&we.set(ee,He.label)}return we},[T,C]),P=p.useCallback(we=>{const He=T.get(we);if(!He)return E;const ee=new Set(E);return ee.delete(He),ee},[E,T]),M=wi(),U=i?M>i.votingDeadline.getTime():!1,F=i?M>=i.scoringDate.getTime():!1,{data:I,isLoading:q}=dY(l,U),{data:O,error:H,isLoading:B}=WR(l??"");p.useEffect(()=>{H&&console.warn("P0P1 ratings fetch failed",H)},[H]);const D=SJ(t),L=NJ(T),$=!!(O&&c&&I),V=B||d||q,z=i!=null&&i.comingSoon?"comingSoon":P6(U,F,O??void 0,$,V),K=a,W=U&&F&&(O==null?void 0:O.phase)==="final",{data:J,error:Z}=uY(l,W),Y=p.useMemo(()=>J,[K,J,I,l]),ae=p.useMemo(()=>Y,[a,z,Y,L,D,l]),pe=v!==void 0&&(!U||z!=="loading"&&(z!=="final"||ae!==void 0||!!Z)),ye=U&&(s||!!D&&!pe),De=C.filter(we=>L.has(we.key)).length,Fe=De===C.length,tt=U&&!!D&&De>0,st=p.useMemo(()=>{var we;return((we=C.find(He=>!T.has(He.key)))==null?void 0:we.key)??C[0].key},[T,C]),ie=b??st,Se=C.find(we=>we.key===ie),Ie=p.useCallback(we=>{const He=C.findIndex(ee=>ee.key===we);if(He===-1)return we;for(let ee=1;ee<C.length;ee++){const Q=C[(He+ee)%C.length];if(!T.has(Q.key))return Q.key}return we},[T,C]),_e=p.useRef(null);p.useEffect(()=>()=>clearTimeout(_e.current??void 0),[]);const We=p.useCallback((we,He)=>{S(we,He),clearTimeout(_e.current??void 0),_e.current=setTimeout(()=>w(Ie(we)),jJ)},[S,Ie]);return{featured:i,cards:c,cardsByName:_,dataReady:k,resultsDataReady:$,ballotReady:pe,ballotPending:ye,user:D,authLoading:s,signIn:r,picksBySlot:L,pickedExcept:P,pickedSlotLabels:A,scoringFilled:De,isComplete:Fe,isPastDeadline:U,hasParticipated:tt,pickStats:I,ratingsSnapshot:O??void 0,phase:z,ballots:ae,persistPick:S,handleClearAll:N,clearPending:o?y.isPending:!1,editingSlotKey:b,setEditingSlotKey:w,activeSlotKey:ie,activeSlot:Se,contestSlots:C,selectAdvance:We}}function SJ(e,t){return e}function NJ(e,t,s){return e}function P6(e,t,s,r,a,o){return e?a?"loading":t?(s==null?void 0:s.phase)==="final"&&r?"final":"midway":s!=null&&s.phase&&s.phase!=="final"&&r?s.phase:"postVoting":"voting"}const Yi=[{label:"P0 P1",icon:i6,iconSize:21,badge:EJ,to:"/p0p1",match:e=>e.startsWith("/p0p1")},{label:"EPISODES",icon:oQ,to:"/episodes",match:e=>e.startsWith("/episodes")},{label:"TIER LIST",icon:o6,to:"/tier-list",match:e=>e.startsWith("/tier-list")},{label:"LEADERBOARD",icon:a6,to:"/leaderboard",match:e=>e==="/leaderboard"||e.startsWith("/leaderboard/")||e.startsWith("/player/")},{label:"POD DRAFTS",icon:gr,iconSize:23,to:"/pods",match:e=>e.startsWith("/pods")},{label:"COMMUNITY",icon:rQ,to:"/community",match:e=>e.startsWith("/community")},{label:"TOOLS",icon:tQ,to:"/tools",match:e=>e.startsWith("/tools")}],CJ={label:"HOME",icon:nQ,to:"/",match:e=>e==="/"},Dh="h-12 px-5 inline-flex items-center no-underline border transition-colors whitespace-nowrap",id="flex items-center gap-4 min-h-[54px] px-5 font-display text-[17px] tracking-[0.14em] border-b border-border transition-colors";function St({subtitle:e="LEADERBOARD",subtitleShort:t,fill:s=!1}){const r=Rt(),a=ut(),[o,i]=p.useState(!1),[l,c]=p.useState(Yi.length),d="/",u=p.useRef(null),f=p.useRef(null),h=p.useRef(null),m=p.useRef(null);p.useEffect(()=>{i(!1)},[r.pathname]),p.useEffect(()=>{if(!o)return;const b=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=b}},[o]),p.useLayoutEffect(()=>{const b=u.current,w=f.current,x=h.current,g=m.current;if(!b||!w||!x)return;const v=32,k=4,S=8,N=48,C=()=>
500{if(a){c(0);return}const T=getComputedStyle(b),E=b.clientWidth-parseFloat(T.paddingLeft)-parseFloat(T.paddingRight),A=g?g.scrollWidth:0,P=Array.from(x.children).map(I=>I.scrollWidth),M=I=>I===0?0:P.slice(0,I).reduce((q,O)=>q+O,0)+S*(I-1),U=(I,q)=>{const O=M(I)+(I>0?k:0),H=q?k+N:0;return w.scrollWidth+v+O+A+H<=E};if(U(P.length,!1)){c(P.length);return}let F=P.length-1;for(;F>0&&!U(F,!0);)F--;c(F)},_=new ResizeObserver(C);return _.observe(b),_.observe(w),_.observe(x),C(),()=>_.disconnect()},[a,e]);const y=a||l<Yi.length;return p.useEffect(()=>{y||i(!1)},[y]),n.jsxs("header",{ref:u,className:j("border-b border-border flex items-center justify-between bg-bg shrink-0 relative",a?"py-1.5 px-3":"py-4 pl-10 pr-10"),style:s&&!a?{paddingRight:"calc(2.5rem + var(--app-scrollbar, 0px))"}:void 0,children:[n.jsxs(te,{ref:f,to:d,className:j("flex items-center no-underline shrink-0",a?"gap-3 pl-2":"gap-6 pl-[13px]"),children:[n.jsx("div",{className:"flex items-center justify-center shrink-0 overflow-visible",style:{height:a?44:64},children:n.jsx(yr,{size:a?42:55})}),n.jsx(XQ,{size:a?"sm":"lg",subtitle:e,subtitleShort:t})]}),n.jsx("div",{ref:h,"aria-hidden":"true",className:"absolute -left-[9999px] top-0 flex gap-2 font-display text-[19px] tracking-[0.14em]",children:Yi.map(b=>n.jsx("span",{className:Dh,children:b.label},b.label))}),n.jsx("span",{ref:m,"aria-hidden":"true",className:j("absolute -left-[9999px] top-0 font-display text-[19px] tracking-[0.14em]",Dh),children:"LOG IN"}),n.jsxs("div",{className:"flex items-center gap-1",children:[!a&&l>0&&n.jsx("nav",{className:"flex gap-2 font-display text-[19px] tracking-[0.14em]",children:Yi.slice(0,l).map(b=>{const w=b.match(r.pathname);return n.jsxs(te,{to:b.to,className:j(Dh,b.badge&&"relative",w?"text-bg bg-green border-green":"text-text border-transparent hover:bg-surface hover:text-green"),children:[b.label,b.badge&&n.jsx(b.badge,{active:w})]},b.label)})}),!a&&n.jsx(_J,{}),y&&n.jsx("button",{type:"button",onClick:()=>i(b=>!b),"aria-label":o?"Close menu":"Open menu","aria-expanded":o,className:j("w-12 h-12 border flex items-center justify-center cursor-pointer transition-colors",o?"border-green text-green bg-surface":"border-border2 text-muted bg-transparent"),children:n.jsx("span",{className:"text-[28px] leading-none",children:o?"×":"≡"})})]}),y&&o&&n.jsx(TJ,{items:a?[CJ,...Yi]:Yi.slice(l),includeAuth:a,pathname:r.pathname,onClose:()=>i(!1)})]})}function _J(){const{user:e,loading:t,signIn:s,signOut:r}=Qn(),{data:a}=rf(e==null?void 0:e.discordId),[o,i]=p.useState(!1),l=p.useRef(null);if(p.useEffect(()=>{if(!o)return;const d=u=>{l.current&&!l.current.contains(u.target)&&i(!1)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[o]),t)return null;if(!e)return n.jsxs("button",{type:"button",onClick:s,className:j(Dh,"inline-flex items-center gap-2.5 font-display text-[19px] tracking-[0.14em] cursor-pointer text-text border-border hover:bg-surface bg-transparent"),children:[n.jsx(la,{size:19}),"LOG IN"]});const c=(d,u)=>e.avatarUrl?n.jsx("img",{src:e.avatarUrl,alt:"",className:j(d,"rounded-full")}):n.jsx("div",{className:j(d,"rounded-full bg-surface2 flex items-center justify-center text-subtle font-semibold",u),children:e.username.charAt(0).toUpperCase()});return n.jsxs("div",{ref:l,className:"relative",children:[n.jsxs("button",{type:"button",onClick:()=>i(d=>!d),className:j("flex items-center gap-2.5 cursor-pointer bg-transparent border rounded-full pl-1.5 pr-2.5 py-1.5 transition-colors",o?"bg-surface border-border":"border-transparent hover:bg-surface hover:border-border"),children:[c("w-9 h-9","text-[15px]"),n.jsx("span",{className:"text-text text-[15px] font-medium max-w-[160px] truncate",children:e.username}),n.jsx(fs,{size:16,className:j("text-muted transition-transform",o&&"rotate-180")})]}),o&&n.jsxs("div",{className:"absolute right-0 top-full mt-2 w-56 bg-surface border border-border2 rounded-lg shadow-xl shadow-black/40 overflow-hidden z-50 animate-fadeUpIn",children:[a&&n.jsxs(te,{to:`/player/${a}`,onClick:()=>i(!1),className:"flex items-center gap-2.5 px-3 py-2.5 font-display text-[15px] tracking-[0.14em] no-underline text-subtle hover:bg-surface2 hover:text-green transition-colors",children:[n.jsx(fB,{size:16}),"MY PROFILE"]}),n.jsxs("button",{type:"button",onClick:()=>{r(),i(!1)},className:"w-full flex items-center gap-2.5 px-3 py-2.5 font-display text-[15px] tracking-[0.14em] text-subtle hover:bg-surface2 hover:text-green curs
500or-pointer bg-transparent border-none transition-colors",children:[n.jsx(WT,{size:16}),"LOG OUT"]})]})]})}function TJ({items:e,includeAuth:t,pathname:s,onClose:r}){const{user:a,loading:o,signIn:i,signOut:l}=Qn(),{data:c}=rf(a==null?void 0:a.discordId),d=a&&(a.avatarUrl?n.jsx("img",{src:a.avatarUrl,alt:"",className:"w-6 h-6 rounded-full"}):n.jsx("div",{className:"w-6 h-6 rounded-full bg-surface"}));return n.jsxs(n.Fragment,{children:[n.jsx("div",{onClick:r,className:"absolute top-full left-0 right-0 h-screen bg-black/60 z-30","aria-hidden":"true"}),n.jsxs("nav",{className:"absolute top-full right-0 left-0 bg-bg border-b border-border z-40 flex flex-col",role:"menu",children:[t&&!o&&a&&(c?n.jsxs(te,{to:`/player/${c}`,onClick:r,role:"menuitem",className:j(id,"no-underline text-text bg-transparent hover:bg-surface"),children:[n.jsx(ld,{children:d}),"MY PROFILE"]}):n.jsxs("div",{className:j(id,"font-sans tracking-normal"),children:[n.jsx(ld,{children:d}),n.jsx("span",{className:"text-text text-sm truncate",children:a.username})]})),e.map(u=>{const f=u.match(s);return n.jsxs(te,{to:u.to,role:"menuitem",className:j(id,"no-underline",f?"bg-green text-bg":"text-text bg-transparent hover:bg-surface"),children:[n.jsx(ld,{children:n.jsx(u.icon,{size:u.iconSize??19,className:f?"text-bg":"text-muted"})}),u.label,u.badge&&n.jsx(RJ,{active:f})]},u.label)}),t&&!o&&!a&&n.jsxs("button",{type:"button",onClick:()=>{i(),r()},role:"menuitem",className:j(id,"text-text bg-transparent hover:bg-surface cursor-pointer border-x-0 border-t-0"),children:[n.jsx(ld,{children:n.jsx(la,{size:19})}),"LOG IN"]}),t&&!o&&a&&n.jsxs("button",{type:"button",onClick:()=>{l(),r()},role:"menuitem",className:j(id,"text-text bg-transparent hover:bg-surface cursor-pointer border-x-0 border-t-0"),children:[n.jsx(ld,{children:n.jsx(WT,{size:19,className:"text-muted"})}),"LOG OUT"]})]})]})}function ld({children:e}){return e?n.jsx("span",{"aria-hidden":"true",className:"w-6 flex items-center justify-center shrink-0 -translate-y-px",children:e}):null}function O6(){const{user:e}=Qn(),t=BR(),s=t==null?void 0:t.code,{data:r}=FR(e?s:void 0),{data:a,isLoading:o}=WR(s??"");E6();const i=wi(t==null?void 0:t.scoringDate),l=t?i>t.votingDeadline.getTime():!1,c=t?i>=t.scoringDate.getTime():!1,d=P6(l,c,a??void 0,!!a,o),u=e?(r==null?void 0:r.length)??0:0;return{user:e,phase:d,filled:u,total:s?Ft(s).length:0,setCode:s}}function L6(e){return e==="final"?"RESULTS":e==="midway"||e==="postVoting"?"PRELIM DATA":null}function EJ({active:e}){const{user:t,phase:s,filled:r,total:a}=O6();if(s==="loading")return null;const o=j("absolute -top-1.5 z-10 rounded-full border border-green px-1.5 py-0.5 text-[9px] leading-none font-sans font-bold tracking-wide",e?"bg-bg text-green":"bg-green text-bg"),i=L6(s);return i?n.jsx("span",{className:j(o,"left-1/2 -translate-x-1/2 whitespace-nowrap"),children:i}):n.jsx("span",{className:j(o,"-right-1.5"),children:D6(!!t,r,a)})}function D6(e,t,s){return!e||t===0?"OPEN":t===s?"VOTED!":`${t}/${s}`}function RJ({active:e}){const{user:t,phase:s,filled:r,total:a,setCode:o}=O6();if(s==="loading")return null;const i=j("ml-3 inline-flex items-center gap-2 text-[14px] font-semibold font-sans tracking-[0.08em]",e?"text-bg":"text-green");return n.jsxs("span",{className:i,children:[L6(s)??D6(!!t,r,a),o&&n.jsx(Ae,{code:o,size:16,className:e?"text-bg":"text-green"})]})}function I6(e){return Vt({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z"},child:[]}]})(e)}const Zk="/sponsors/tcgplayer-horizontal.png";function M6({className:e}){return n.jsx("span",{"aria-hidden":!0,className:j("block bg-current",e),style:{aspectRatio:"3334 / 538",WebkitMaskImage:`url(${Zk})`,maskImage:`url(${Zk})`,WebkitMaskSize:"contain",maskSize:"contain",WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat",WebkitMaskPosition:"center",maskPosition:"center"}})}const AJ={Apple:s6,Spotify:e6,YouTube:I6,RSS:t6,Patreon:Av},Yk=Zt.tcgplayer,PJ={color:"/sponsors/tcgplayer-stacked-offwhite.png"},OJ="/sponsors/tcgplayer-stacked-hover.png";function $6({sponsorVariant:e="gray"}){const t=[...jR,{label:"Patreon",url:Zt.patreon}],s=Object.fromEntries(t.map(h=>[h.label,h])),r=({label:h,url:m},y="")=>{const b=AJ[h];return n.jsxs("a",{href:m,target:"_blank",rel:"noreferrer",className:j("inline-flex items-center gap-1.5 no-underline hover:text-green transition-colors",y),children:[b?n.jsx(b,{className:"text-[16px]"}):null,h]},h)},a=n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"© Limited Level-Ups is unofficial Fan Content permitted under the Fan Content Policy."})," ",n.jsx("span",{children:"Not approved or endorsed by Wizards. Portions © Wizards of the Coast."})]}),o=(h,m="")=>e==="gray"?n.jsx("a",{rel:"sponsored",href:Yk,target:"_blank","aria-label":"TCGplayer",className:j("inline-flex shrink-0 text-muted hover:text-green transition-colors",m),children:n.jsx(M6,{className:h})}):n.jsxs("a",{rel:"sponsored",href:Yk,target:"_blank","aria-label":"TCGplayer",className:j("group relative inline-block shrink-0",m),children:[n.jsx("img",{src:PJ.color,alt:"TCGplayer",width:477,height:200,className:j("block w-auto max-w-none",h)}),n.jsx("img",{src:OJ,alt:"","aria-hidden":!0,width:477,height:200,className:j("pointer-events-none absolute left-0 top-0 hidden w-auto max-w-none group-hover:block",h)})]}
500),i=e==="color"?"h-9":"h-5",l=e==="color"?"h-7":"h-[15px]",c=e==="gray"?"justify-self-center":"",d=e==="gray"?"grid-cols-[repeat(3,auto)]":"grid-cols-3",f=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"relative hidden items-center justify-between text-[12px] text-muted lg:flex",children:[n.jsx("span",{className:"font-mono flex flex-col gap-0.5 text-[10px] leading-tight",children:a}),n.jsx("div",{className:"pointer-events-none absolute inset-0 grid grid-cols-[minmax(300px,360px)_minmax(0,1fr)_clamp(300px,22vw,340px)] items-center gap-4",children:o(i,j("pointer-events-auto col-start-2 justify-self-center",e==="color"&&"-translate-y-[3px]"))}),n.jsx("nav",{className:"flex items-center justify-center gap-5 font-display tracking-[0.12em] text-[15px]",children:t.map(h=>r(h))})]}),n.jsxs("div",{className:"flex flex-col items-center gap-3 text-[11px] text-muted lg:hidden",children:[n.jsxs("nav",{className:j("grid items-center justify-items-start gap-x-5 gap-y-3.5 font-display tracking-[0.12em] text-[15px]",d),children:[r(s.YouTube),o(l,"justify-self-center"),r(s.Patreon),r(s.Apple),r(s.Spotify,c),r(s.RSS)]}),n.jsx("span",{className:"font-mono block text-center text-[10px] leading-tight",children:a})]})]});return n.jsx("footer",{className:"border-t border-border",children:n.jsx("div",{className:"px-4 lg:px-5 py-3",children:f})})}function $c({subtitle:e,fill:t=!1,sponsorVariant:s="gray",children:r}){return p.useEffect(()=>{if(!t)return;const a=document.documentElement,o=a.style.scrollbarGutter,i=document.createElement("div");i.style.cssText="position:absolute;top:-9999px;width:100px;height:100px;overflow:scroll",document.body.appendChild(i);const l=i.offsetWidth-i.clientWidth;return i.remove(),a.style.setProperty("--app-scrollbar",`${l}px`),a.style.scrollbarGutter="auto",()=>{a.style.scrollbarGutter=o,a.style.removeProperty("--app-scrollbar")}},[t]),n.jsxs("div",{className:j("bg-bg text-text flex flex-col page-fade min-h-screen",t&&"lg:h-screen lg:min-h-0 lg:overflow-hidden"),children:[n.jsx(St,{subtitle:e,fill:t}),n.jsx("main",{className:j("flex-1",t?"lg:min-h-0 lg:overflow-hidden":"flex flex-col"),children:r}),n.jsx($6,{sponsorVariant:s})]})}const Uc="polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px)",LJ={sm:"gap-2.5 text-[12.5px] tracking-[0.1em] px-4 py-2",lg:"gap-3 text-[15px] md:text-[17px] tracking-[0.12em] px-6 py-3.5"},DJ={sm:13,lg:16},IJ="inline-flex items-center bg-green text-bg font-mono font-bold no-underline hover:bg-green-2 transition-colors",MJ="transition-[transform,background-color] duration-200 hover:scale-105";function Iv({label:e,icon:t,href:s,target:r,size:a="sm",grow:o=!1,className:i}){const l=n.jsxs(n.Fragment,{children:[t,e,n.jsx(Jt,{size:DJ[a]})]}),c={className:j(IJ,LJ[a],o&&MJ,i),style:{clipPath:Uc}};return s?n.jsx("a",{href:s,target:r,rel:r==="_blank"?"noreferrer":void 0,...c,children:l}):n.jsx("span",{...c,children:l})}const $J={"Set Review":"bg-teal text-bg",Draft:"bg-indigo text-bg",Sealed:"bg-blue text-bg",Rankings:"bg-purple text-bg",Metagame:"bg-gold text-bg",Coaching:"bg-pink text-bg",Guest:"bg-orange text-bg",Evergreen:"bg-green text-bg"},B1={"Set Review":"text-teal",Draft:"text-indigo",Sealed:"text-blue",Rankings:"text-purple",Metagame:"text-gold",Coaching:"text-pink",Guest:"text-orange",Evergreen:"text-green"};function F1({category:e,className:t}){return n.jsx("span",{className:j("inline-block font-display tracking-[0.14em] uppercase text-[12.5px] leading-none px-2 py-1",$J[e],t),children:e})}function eo({episode:e,glyphSize:t=20,className:s}){return n.jsxs("span",{className:j("flex items-center gap-2 shrink-0",s),children:[e.setCode?n.jsx(Ae,{code:e.setCode,size:t}):e.category==="Evergreen"?n.jsx(Ae,{code:"EVG",size:t}):null,n.jsx(F1,{category:e.category})]})}function ki({src:e,pending:t,className:s,portrait:r}){const[a,o]=p.useState(!1),[i,l]=p.useState(!1),[c,d]=p.useState(!1),u=p.useRef(null);p.useEffect(()=>{const w=u.current,x=(w==null?void 0:w.complete)&&w.naturalWidth>0;o(!!x),l(!1),d(!1)},[e]),p.useEffect(()=>{if(!a)return;const w=setTimeout(()=>l(!0),350);return()=>clearTimeout(w)},[a]);const f=!!e&&!c,h=!e&&!t||c,m=!h&&!i,y=r?"w-[70%] max-w-[220px]":"w-[42%] max-w-[220px]",b=r?"w-1/2 max-w-[180px]":"w-[34%] max-w-[180px]";return n.jsxs(n.Fragment,{children:[m?n.jsxs("div",{className:"absolute inset-0 flex items-center justify-center overflow-hidden bg-surface",children:[n.jsx("img",{src:Ip,alt:"",className:j(y,"opacity-[0.06] grayscale-[0.6]")}),n.jsx("div",{className:"pointer-events-none absolute inset-0 animate-[thumbSweep_1.8s_ease-in-out_-0.64s_infinite] bg-[linear-gradient(100deg,transparent_25%,rgba(255,255,255,0.13)_50%,transparent_75%)]"})]}):null,h?n.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-surface",children:n.jsx("img",{src:Ip,alt:"",className:j(b,"opacity-90",s)})}):null,f?n.jsx("img",{ref:u,src:e,alt:"",loading:"lazy",decoding:"async",onLoad:()=>o(!0),onError:()=>d(!0),className:j("absolute inset-0 h-full w-full object-cover transition-opacity duration-500",a?"opacity-100":"opacity-0",s)}):null]})}const Mv=p.forwardRef(({src:e,title:t,image:s,pending:r,onTime:a},o)=>{const i=p.useRef(null),[l,c]=p.useState(!1),[d,u]=p.useState(0),[f,h]=p.useState(0);p.useEffect(()=>{const w=i.current;w&&w.play().catch(()=>c(!1))},[e]);const m=()=>{const w=i.current;w&&(w.paused?w.play():w.pause())},y=w=>{const x=i.current;x&&(x.currentTime=w,u(w),a==null||a(w))};p.useImperativeHandle(o,()=>({seek:y}),[]);const b=f>0?d/f:0;return n.jsxs("div",{className:"flex items-center gap-3 border border-border bg-surface p-2.5",children:[n.jsx("audio",{ref:i,src:e,autoPlay:!0,onPlay:()=>c(!0),onPause:()=>c(!1),onEnded:()=>c(!1),onTimeUpdate:w=>{u(w.currentTarget.currentTime),a==null||a(w.currentTarget.currentTime)},onLoadedMetadata:w=>h(w.currentTarget.duration)}),n.jsxs("button",{type:"button",onClick:m,"aria-label":l?`Pause ${t}`:`Play ${t}`,className:"group/art relative h-16 w-16 shrink-0 cursor-pointer overflow-hidden border border-border bg-surface2",children:[n.jsx(ki,{src:s??void 0,pending:r}),n.jsx("span",{className:"absolute inset-0 flex items-center justify-center bg-bg/25 transition-colors group-hover/art:bg-bg/40",children:n.jsx("span",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-green/85 text-white transition-colors group-hover/art:bg-green",children:l?n.jsx(aQ,{size:16}):n.jsx(lc,{size:18})})})]}),n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5",children:[n.jsx(UJ,{playing:l}),n.jsx("span",{className:"font-num text-[11px] text-text tabular-nums shrink-0",children:Qk(d)}),n.jsx("input",{type:"range",className:"audio-scrubber flex-1 min-w-0",min:0,max:f||0,step:"any",value:d,onChange:w=>y(Number(w.target.value)),"aria-label":"Seek",style:{"--pct":b}}),n.jsx("span",{className:"font-num text-[11px] text-muted tabular-nums shrink-0",children:Qk(f)})]})]})});Mv.displayName="PodcastAudioPlayer";function UJ({playing:e}){return n.jsx("span",{className:"flex items-end gap-0.5 h-3.5 w-[13px] shrink-0","aria-hidden":"true",children:[0,1,2].map(t=>n.jsx("span",{className:j("w-[3px] h-full origin-bottom bg-green transition-opacity",e?"opacity-100":"opacity-40"),style:e?{animation:`eqBar 0.9s ease-in-out ${t*.18}s infinite`}:{transform:"scaleY(0.4)"}},t))})}function Qk(e){if(!Number.isFinite(e)||e<=0)return"0:00";const t=Math.floor(e),s=String(t%60).padStart(2,"0"),r=Math.floor(t/60)%60,a=Math.floor(t/3600);return a?`${a}
500:${String(r).padStart(2,"0")}:${s}`:`${r}:${s}`}function $v({children:e}){return n.jsx("span",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-green/70 text-white",children:e})}function U6({episode:e,thumbnailPending:t=!1,aspect:s,audioMode:r=!1,portrait:a=!1,linkTo:o,playing:i,onPlayingChange:l}){const c=l!==void 0,[d,u]=p.useState(!1),f=c?!!i:d,h=b=>{c?l(b):u(b)},{canPlayAudio:m,playable:y}=z6(e,r);return n.jsx("div",{className:j("relative bg-surface border border-border rounded-lg overflow-hidden transition-[border-color,box-shadow] duration-150 group-hover:border-green group-hover:shadow-[0_0_8px_1px_rgba(46,232,92,0.32)]",s),children:o?n.jsx(te,{to:o,"aria-label":e.title,className:"absolute inset-0 block w-full",children:n.jsx(cg,{episode:e,thumbnailPending:t,audio:m,portrait:a})}):f?n.jsxs(n.Fragment,{children:[n.jsx(B6,{episode:e,thumbnailPending:t,audioMode:r}),c?n.jsx("button",{type:"button",onClick:()=>h(!1),"aria-label":"Close player",className:"absolute top-2 right-2 z-20 flex h-8 w-8 items-center justify-center rounded-full bg-bg/80 text-text transition-colors hover:bg-bg hover:text-green",children:n.jsx(rn,{size:16,strokeWidth:2.5})}):null]}):y?n.jsx("button",{type:"button",onClick:()=>h(!0),"aria-label":`Play ${e.title}`,className:"absolute inset-0 block w-full cursor-pointer",children:n.jsx(cg,{episode:e,thumbnailPending:t,audio:m,portrait:a})}):n.jsx("a",{href:e.link,target:"_blank",rel:"noreferrer",className:"absolute inset-0 block w-full",children:n.jsx(cg,{episode:e,thumbnailPending:t,audio:!1,portrait:a})})})}function z6(e,t=!1){const s=!!e.youtubeId,r=!!e.audioUrl,a=s&&!t,o=r&&(t||!s);return{canEmbed:a,canPlayAudio:o,playable:a||o}}function B6({episode:e,thumbnailPending:t=!1,audioMode:s=!1,iframeRef:r,enableJsApi:a=!1,audioControlsRef:o}){const[i,l]=p.useState(!1);if(e.youtubeId&&!s){const c=`https://www.youtube.com/embed/${e.youtubeId}?autoplay=1&playsinline=1&rel=0&cc_load_policy=0${a?"&enablejsapi=1":""}`;return n.jsxs(n.Fragment,{children:[n.jsx("iframe",{ref:r,src:c,title:e.title,className:"absolute inset-0 h-full w-full",allow:"autoplay; encrypted-media; picture-in-picture; fullscreen",allowFullScreen:!0,onLoad:()=>l(!0)}),i?null:n.jsx("div",{className:"absolute inset-0",children:n.jsx(ki,{pending:!0})})]})}return n.jsxs(n.Fragment,{children:[n.jsx(ki,{src:e.image,pending:t,className:"transition-transform duration-300 scale-[1.07]"}),n.jsx(Mv,{ref:o,src:e.audioUrl,title:e.title})]})}function cg({episode:e,thumbnailPending:t,audio:s,portrait:r}){const a=!e.youtubeId&&!!e.audioUrl;return n.jsxs(n.Fragment,{children:[n.jsx(ki,{src:e.image,pending:t,portrait:r,className:"transition-transform duration-300 group-hover:scale-[1.07]"}),a||e.durationLabel?n.jsxs("span",{className:"absolute bottom-2 right-2 flex items-center gap-1.5 font-mono text-[11px] text-text bg-bg/85 px-1.5 py-0.5",children:[a?n.jsx(sQ,{size:12}):null,e.durationLabel?e.durationLabel:null]}):null,n.jsx("span",{className:"absolute inset-0 flex items-center justify-center bg-bg/30 opacity-0 transition-opacity group-hover:opacity-100",children:n.jsx($v,{children:s?n.jsx(r6,{size:24}):n.jsx(lc,{size:32})})})]})}function lf({cost:e,size:t=14}){const s=[...e.matchAll(/\{([^}]+)\}/g)].map(r=>r[1]);return s.length===0?n.jsx("span",{children:"—"}):n.jsx("span",{className:"inline-flex gap-px items-center",children:s.map((r,a)=>n.jsx("i",{className:`ms ms-${r.replace("/","").toLowerCase()} ms-cost ms-shadow shrink-0`,style:{fontSize:t,letterSpacing:0},"aria-label":r},a))})}function fr({c:e,size:t=14}){return n.jsx("i",{className:`ms ms-${e.toLowerCase()} ms-cost ms-shadow shrink-0`,style:{fontSize:t,letterSpacing:0},"aria-label":e})}function Be({colors:e,size:t=12}){if(!e)return n.jsx("i",{className:"ms ms-c ms-cost ms-shadow shrink-0",style:{fontSize:t,letterSpacing:0},"aria-label":"C"});const s=[...e];return n.jsx("span",{className:"inline-flex gap-px items-center",children:s.map((r,a)=>{const o=r===r.toUpperCase(),i=r.toUpperCase();return n.jsx(fr,{c:i,size:o?t:Math.round(t*.75)},`${r}-${a}`)})})}const zJ=/(#\d+|\bmock\b)/gi;function BJ({event:e}){return G3(e.name,e.setCode,e.formatLabel).toUpperCase()}function Si(e){const t=e.split(zJ);return t.map((s,r)=>{if(/^mock$/i.test(s))return n.jsx("span",{className:"text-green",children:s},r);if(/^#\d+$/.test(s)){const o=t.slice(0,r).join("").trim()===""?"text-green":"text-muted";return n.jsx("span",{className:o,children:s},r)}return s})}const FJ={top:"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2 border-b border-r",bottom:"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 border-t border-l",left:"r
500ight-0 top-1/2 -translate-y-1/2 translate-x-1/2 border-r border-t",right:"left-0 top-1/2 -translate-y-1/2 -translate-x-1/2 border-l border-b"};function Ne({label:e,side:t,align:s,children:r,className:a,open:o,onOpenChange:i,delayDuration:l,hideArrow:c,collisionPadding:d}){return n.jsxs(bU,{open:o,onOpenChange:i,delayDuration:l,children:[n.jsx(yU,{asChild:!0,children:r}),n.jsx(vU,{children:n.jsxs(wU,{side:t,align:s,sideOffset:7,collisionPadding:d??8,className:j("relative z-50 pointer-events-none select-none rounded-md px-2.5 py-1.5","border border-border2 bg-black text-text text-[12px] leading-tight","shadow-lg shadow-black/60",a),children:[e,!c&&n.jsx("span",{className:j("absolute h-2.5 w-2.5 rotate-45 bg-black border-border2",FJ[t??"top"])})]})})]})}const No=e=>e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey,WJ=16;function F6(e){const t=p.useRef(null);return p.useEffect(()=>{const s=t.current;if(!e||!s)return;const r=a=>{if(HJ(a.target,s))return;a.preventDefault();const o=GJ(s);o&&(o.scrollTop+=VJ(a,o))};return s.addEventListener("wheel",r,{passive:!1}),()=>s.removeEventListener("wheel",r)},[e]),t}function W6(e){const t=getComputedStyle(e).overflowY;return(t==="auto"||t==="scroll")&&e.scrollHeight>e.clientHeight}function HJ(e,t){let s=e instanceof Element?e:null;for(;s&&s!==t;){if(W6(s))return!0;s=s.parentElement}return!1}function GJ(e){for(const t of e.querySelectorAll("*"))if(W6(t))return t;return null}function VJ(e,t){return e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*WJ:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*t.clientHeight:e.deltaY}const KJ=8;function yt({label:e,value:t,options:s,onChange:r,hrefFor:a,variant:o="desktop",align:i="left",renderValue:l,renderOption:c,renderTrigger:d,searchable:u,searchPlaceholder:f="Search…",emptyText:h="No matches",openOnHover:m=!1,triggerClassName:y,menuClassName:b,optionClassName:w,className:x,mobileCentered:g=!1}){const v=o==="mobile",k=s.find(L=>L.value===t)??s[0],[S,N]=p.useState(!1),[C,_]=p.useState(!1),[T,E]=p.useState(""),[A,P]=p.useState(0),M=p.useRef(null),U=p.useRef(null),F=F6(S),I=ln(),q=u??s.length>KJ,O=()=>{m?C?N(!1):(_(!0),N(!0)):N(L=>!L)},H=L=>{r?r(L):a&&I(a(L)),N(!1)};p.useLayoutEffect(()=>{var $;if(!S||!g)return;const L=($=U.current??M.current)==null?void 0:$.getBoundingClientRect();L&&P(L.bottom+4)},[S,g]),p.useEffect(()=>{if(!S){E(""),_(!1);return}const L=V=>{var z;(z=M.current)!=null&&z.contains(V.target)||N(!1)},$=V=>{V.key==="Escape"&&N(!1)};return document.addEventListener("mousedown",L),document.addEventListener("keydown",$),()=>{document.removeEventListener("mousedown",L),document.removeEventListener("keydown",$)}},[S]);const B=T.trim().toLowerCase(),D=B?s.filter(L=>L.label.toLowerCase().includes(B)||L.value.toLowerCase().includes(B)):s;return n.jsxs("div",{ref:M,className:j("relative",v?"flex-1 min-w-0":"",x),onMouseEnter:m?()=>N(!0):void 0,onMouseLeave:m&&!C?()=>N(!1):void 0,children:[d?d({open:S,selected:k,toggle:O}):n.jsxs("button",{ref:U,type:"button",onClick:O,className:j("flex items-center gap-2 w-full bg-transparent border border-border2 font-display text-text cursor-pointer transition-colors hover:bg-surface",v?"h-full px-2.5 py-1.5 text-[15px] tracking-[0.1em]":"px-3.5 py-1.5 min-w-[220px] text-[15px] tracking-[0.12em]",S&&"bg-surface",y),children:[e?n.jsx("span",{className:j("text-muted tracking-[0.22em]",v?"text-[11px]":"text-[12px]"),children:e}):null,n.jsx("span",{className:"flex flex-1 items-center gap-1.5 min-w-0 truncate",children:l?l(k):k.label}),n.jsx(Et,{size:v?18:16,strokeWidth:2.5,className:j("text-muted transition-transform",S&&"rotate-180")})]}),S&&n.jsxs("div",{ref:F,className:j("absolute top-[calc(100%+4px)] min-w-full w-max max-w-[calc(100vw-24px)] flex max-h-[min(60vh,420px)] flex-col bg-surface border border-border2 z-20 shadow-lg",i==="right"?"right-0":"left-0",g&&"max-sm:!fixed max-sm:!left-1/2 max-sm:!right-auto max-sm:!-translate-x-1/2 max-sm:!top-[var(--menu-top)]",b),style:g?{"--menu-top":`${A}px`}:void 0,role:"listbox",children:[q&&n.jsx("div",{className:"shrink-0 border-b border-border p-1.5",children:n.jsx("input",{autoFocus:!0,value:T,onChange:L=>E(L.target.value),onKeyDown:L=>{L.key==="Enter"&&D.length>0&&(L.preventDefault(),H(D[0].value))},placeholder:f,className:"w-full bg-bg border border-border px-2.5 py-1.5 font-body text-[14px] tracking-normal text-text placeholder:text-dim outline-none focus:border-green"})}),n.jsxs("div",{className:"menu-scrollbar min-h-0 flex-1 overflow-y-auto",children:[D.map((L,$)=>{var K;const V=L.value===t,z=L.section&&L.section!==((K=D[$-1])==null?void 0:K.section);return n.jsxs(wt.Fragment,{children:[z&&n.jsxs("div",{className:"flex items-center gap-3 px-3.5 py-1 select-none",children:[n.jsx("span",{className:"h-px flex-1 bg-border2"}),n.jsx("span",{className:"font-display text-[12px] tracking-[0.22em] text-subtle",children:L.section}),n.jsx("span",{className:"h-px flex-1 bg-border2"})]}),n.jsx(qJ,{href:a==null?void 0:a(L.value),onSelect:()=>H(L.value),selected:V,className:j("w-full text-left flex items-center gap-2 border-l-2 font-display cursor-pointer transition-colors whitespace-nowrap",v?"px-2.5 py-2.5 text-[15px] tracking-[0.08em]":"px-3.5 py-2.5 text-[15px] tracking-[0.06em]",$>0&&!z&&"border-t border-border",V?"border-l-green bg-surface2 text-green":"border-l-transparent bg-transparent text-text hover:bg-surface2",w),children:c?c(L):L.label})]},L.value)}),D.length===0&&n.jsx("div",{className:"px-3.5 py-3 font-body text-[14px] text-muted",children:h})]})]})]})}const qJ=({href:e,onSelect:t,selected:s,className:r,children:a})=>e===void 0?n.jsx("button",{type:"button",onClick:t,role:"option","aria-selected":s,className:r,children:a}):n.jsx(te,{to:e,onClick:o=>{No(o)&&(o.preventDefault(),t())},role:"option","aria-selected":s,className:j(r,"no-underline"),children:a});function ku({sets:e,activeCode:t,glyphCode:s,label:r,isMobile:a,loading:o=!1,onChange:i,hrefFor:l,compact:c=!1,align:d="left",openOnHover:u=!1,triggerClassName:f,labelRef:h}){const m=c?20:a?26:38,y=c?"text-[18px]":"text-[17px] md:text-[30px]",b=c?"h-4 w-4":"h-4 w-4 md:h-5 md:w-5";if(!o&&e.length<=1)return n.jsxs("span",{className:"flex items-center gap-2 md:gap-3 min-w-0",children:[n.jsx(Ae,{code:s,size:m}),n.jsx("span",{className:"flex-1 min-w-0 truncate font-display tracking-[0.06em] text-[17px] md:text-[30px]",children:r})]});const w=e.length>1,x=new Map(e.map(k=>[k.code,k])),g=e.map(k=>({value:k.code,label:k.name})),v=d==="right"?"top-[calc(100%+6px)]":"top-full";return n.jsx(yt,{value:t,options:g,onChange:i,hrefFor:l,align:d,searchable:e.length>7,searchPlaceholder:"Search sets…",emptyText:"No sets match",openOnHover:u,className:"min-w-0",menuClassName:j("z-30 max-h-[min(60vh,400px)] max-w-[80vw] overflow-hidden shadow-xl",v),optionClassName:"gap-3",renderOption:k=>n.jsx(ZJ,{set:x.get(k.value),active:k.value===t}),renderTrigger:({open:k,toggle:S})=>n.jsxs("button",{type:"button",disabled:!w,onClick:S,"aria-expanded":k,className:j("group flex max-w-full min-w-0 items-center border border-border2 text-text transition-colors",c?"h-7 gap-1.5 px-2":"gap-2 px-3 py-1.5 md:gap-3",k&&"bg-surface",w&&"cursor-pointer hover:bg-surface",f),children:[n.jsx(Ae,{code:s,size:m}),n.jsx("span",{ref:h,className:j("flex-1 min-w-0 truncate font-display tracking-[0.06em]",y),children:r}),n.jsx(Et,{strokeWidth:2.5,className:j("text-muted transition-transform",b,k&&"rotate-180")}
500)]})})}const ZJ=({set:e,active:t})=>{const s=new Date().toISOString().slice(0,10);return n.jsxs(n.Fragment,{children:[n.jsx(Ae,{code:Qt(e),size:24}),n.jsx("span",{className:"flex-1 truncate text-[17px] leading-none",children:e.name.toUpperCase()}),e.isActive?n.jsx("span",{className:j("text-[13px] tracking-[0.18em]",t?"text-green":"text-muted"),children:"LIVE"}):e.startDate>s&&n.jsx("span",{className:"text-[13px] tracking-[0.18em]",style:{color:"#cca54e"},children:"PREVIEW"})]})},Ni=p.forwardRef(function({label:t,active:s,dir:r,onClick:a,align:o="right",inline:i=!1,fill:l=!1,grow:c=!0,trailing:d=null,className:u,...f},h){const m=s&&r==="asc"?Yy:fs;if(l){const b=o==="center"?"justify-center":o==="left"?"justify-start":"justify-end";return n.jsxs("button",{ref:h,type:"button",onClick:a,"aria-label":`Sort by ${t}`,"aria-sort":s?r==="asc"?"ascending":"descending":"none",className:j("flex items-center gap-0.5 cursor-pointer transition-colors tracking-[inherit] text-[inherit] font-[inherit]",c?"w-full":"w-fit",b,s?"text-text":"hover:text-text",u),...f,children:[n.jsx("span",{children:t}),n.jsx(m,{size:11,strokeWidth:2.5,className:j("shrink-0",s?"opacity-100":"opacity-30"),"aria-hidden":"true"}),d]})}const y=o==="center";return n.jsxs("button",{ref:h,type:"button",onClick:a,"aria-label":`Sort by ${t}`,"aria-sort":s?r==="asc"?"ascending":"descending":"none",className:j("relative cursor-pointer transition-colors tracking-[inherit] text-[inherit] font-[inherit]",i?"inline-flex items-center":y?"flex w-full items-center justify-center gap-0.5":"block w-full text-right",s?"text-text":"hover:text-text"),...f,children:[n.jsx("span",{children:t}),n.jsx(m,{size:11,strokeWidth:2.5,className:j(y?"shrink-0":"absolute left-full top-1/2 -translate-y-1/2 ml-0.5 shrink-0",s?"opacity-100":"opacity-30"),"aria-hidden":"true"})]})});function ht({wins:e,losses:t,mono:s=!1,color:r,separatorMargin:a=0,centered:o=!1,className:i,style:l}){if(o){const c=!s&&!r,d={...l,display:"inline-grid",gridTemplateColumns:"1fr auto 1fr",alignItems:"center",...r?{color:r}:null};return n.jsxs("span",{className:j(s&&!r?"text-text":"",i),style:d,children:[n.jsx("span",{className:j("text-right",c&&"text-green"),children:e}),n.jsx("span",{className:"text-dim",style:a?{margin:`0 ${a}px`}:void 0,children:"–"}),n.jsx("span",{className:j("text-left",c&&"text-muted"),children:t})]})}return s?n.jsxs("span",{className:j(r?"":"text-text",i),style:{...r?{color:r}:null,...l},children:[e,n.jsx("span",{className:"text-dim",style:a?{margin:`0 ${a}px`}:void 0,children:"–"}),t]}):n.jsxs("span",{className:i,style:l,children:[n.jsx("span",{className:"text-green",children:e}),n.jsx("span",{className:"text-dim",children:"–"}),n.jsx("span",{className:"text-muted",children:t})]})}function Uv({error:e,onRetry:t,compact:s=!1}){return n.jsxs("div",{className:s?"p-6 text-center":"p-10 text-center",children:[n.jsx("div",{className:s?"font-display text-base tracking-[0.04em] text-red":"font-display text-[22px] tracking-[0.04em] text-red",children:"SOMETHING WENT WRONG"}),n.jsx("div",{className:"font-mono text-[11px] text-muted mt-2 max-w-[460px] mx-auto break-words",children:e.message||"UNKNOWN ERROR"}),t&&n.jsx("button",{onClick:t,className:"mt-3 py-1.5 px-[18px] bg-transparent border border-border2 text-text font-display text-[12px] tracking-[0.16em] cursor-pointer transition-colors hover:bg-surface2",children:"RETRY"})]})}function H6({className:e,size:t=14,label:s}){const r=Rt(),a=n.jsxs(te,{to:{pathname:r.pathname,search:r.search,hash:QT},state:gi,"aria-label":s??"About Points",className:j("inline-flex items-center justify-center cursor-pointer transition-colors no-underline",s?"gap-1.5 text-muted hover:text-green font-display tracking-[0.10em] text-[12px] leading-none whitespace-nowrap":"text-muted hover:text-green",e),children:[n.jsx(Cp,{size:t,strokeWidth:2}),s?n.jsx("span",{children:s}):null]});return s?a:n.jsx(Ne,{label:"About Points",children:a})}function Su(e){return e==="Direct"?"direct":e==="LCQ"?"lcq":"points"}const G6={key:"score",dir:"desc"},YJ={key:"trophies",dir:"desc"},QJ={key:"boxes",dir:"desc"};function V6(e){return e==="direct"?QJ:G6}const JJ={score:e=>e.score??0,trophies:e=>e.trophies,events:e=>e.events,record:e=>e.wins,winPct:e=>e.wins/Math.max(1,e.wins+e.losses),earnings:e=>e.earnings??0,boxes:e=>e.boxes??0};function K6(e,{key:t,dir:s}){const r=JJ[t],a=s==="desc"?-1:1;return[...e].sort((o,i)=>{const l=r(o),c=r(i);if(l!==c)return a*(l<c?-1:1);const d=o.score??0,u=i.score??0;return d!==u?u-d:d===0&&o.trophies!==i.trophies?i.trophies-o.trophies:o.rank-i.rank})}
500const th="minmax(175px, 1fr)",sh="minmax(62px, 70px) minmax(44px, 72px) minmax(52px, 68px) minmax(48px, 54px) minmax(44px, 90px)",q6={points:`44px ${th} ${sh}`,lcq:`44px ${th} 44px ${sh}`,pod:`44px ${th} ${sh}`,direct:`44px ${th} ${sh}`},Z6={points:"20px 1fr 44px 50px",lcq:"20px 1fr 44px 40px 50px",pod:"20px 1fr 40px 46px 50px",direct:"20px 1fr 40px 56px 44px"};function zv({rows:e,variant:t,loading:s=!1,error:r,emptyMessage:a,renderExpanded:o,showHeader:i=!0,mode:l="points",sort:c,onSort:d,playerHref:u,rowExpandable:f,onRowPrefetch:h,highlightSlug:m,stickyTop:y=0}){const[b,w]=p.useState(null),[x,g]=p.useState(null);p.useEffect(()=>{if(b){g(b);return}if(x==null)return;const _=setTimeout(()=>g(null),220);return()=>clearTimeout(_)},[b,x]);const v=t==="mobile",[k,S]=p.useState(null),[N,C]=p.useState("hidden");return p.useEffect(()=>{if(!k){C("hidden");return}const _=()=>{const A=k.getBoundingClientRect();A.bottom>y&&A.top<window.innerHeight?C("hidden"):A.top<y?C("overlay"):C("inflow")},T=new IntersectionObserver(_,{rootMargin:`${-y}px 0px 0px 0px`,threshold:0});T.observe(k);const E=requestAnimationFrame(_);return()=>{T.disconnect(),cancelAnimationFrame(E)}},[k,y]),r?n.jsx(Uv,{error:r,compact:v}):s?n.jsx(tX,{variant:t}):!e||e.length===0?n.jsx(sX,{children:a}):n.jsxs("div",{children:[i&&n.jsx(Bv,{variant:t,mode:l,sort:c,onSort:d}),n.jsxs("div",{className:j("flex flex-col",v?"gap-0":"gap-[1px]"),children:[n.jsx(XJ,{row:m?e.find(_=>_.slug===m):void 0,mode:l,variant:t,stickyTop:y,pinMode:N,onScrollToRow:()=>k==null?void 0:k.scrollIntoView({behavior:"smooth",block:"center"})}),e.map(_=>{const T=b===_.slug,E=!!o&&((f==null?void 0:f(_))??!0),A=(u==null?void 0:u(_))??null,P=!!m&&_.slug===m;return n.jsxs("div",{ref:P?S:void 0,onMouseEnter:h?()=>h(_):void 0,onFocus:h?()=>h(_):void 0,className:j("transition-colors",v&&"border-b border-border",T?"bg-surface2":P?"bg-surface":v?"bg-transparent":"bg-surface",(E||A)&&!v&&"hover:bg-surface2",P&&!T&&"bg-[linear-gradient(rgba(46,232,92,0.07),rgba(46,232,92,0.07))]",P&&"shadow-[inset_3px_0_0_0_#2ee85c,inset_-3px_0_0_0_#2ee85c]"),children:[v?n.jsx(J6,{row:_,mode:l,href:A,onToggle:E?()=>w(T?null:_.slug):void 0}):n.jsx(Q6,{row:_,mode:l,href:A,onToggle:E?()=>w(T?null:_.slug):void 0}),o&&E&&n.jsx("div",{className:j("grid transition-[grid-template-rows] duration-200 ease-out",T?"grid-rows-[1fr]":"grid-rows-[0fr]"),"aria-hidden":!T,children:n.jsx("div",{className:"overflow-hidden",children:x===_.slug&&o(_)})})]},_.slug)})]})]})}function XJ({row:e,mode:t,variant:s,stickyTop:r,pinMode:a,onScrollToRow:o}){if(!e)return null;const i=a==="hidden",l=a==="inflow";return n.jsx("div",{className:j("sticky z-[5]",i&&"pointer-events-none opacity-0"),style:{top:r,height:l?void 0:0},"aria-hidden":i,children:n.jsx("div",{onClick:o,className:j("cursor-pointer bg-surface",s==="mobile"?"border-b border-border":!l&&"border-b border-bg","bg-[linear-gradient(rgba(46,232,92,0.07),rgba(46,232,92,0.07))]","shadow-[inset_3px_0_0_0_#2ee85c,inset_-3px_0_0_0_#2ee85c]"),children:s==="mobile"?n.jsx(J6,{row:e,mode:t}):n.jsx(Q6,{row:e,mode:t})})})}function Bv({variant:e,mode:t="points",sort:s,onSort:r}){return e==="mobile"?n.jsxs("div",{className:"grid gap-3 py-1.5 pl-2 pr-3.5 font-display text-[10px] tracking-[0.2em] text-muted border-b border-border",style:{gridTemplateColumns:Z6[t]},children:[n.jsx("span",{className:"text-center",children:"#"}),n.jsx("span",{children:"PLAYER"}),t==="lcq"&&n.jsx(mn,{label:"$",sortKey:"earnings",sort:s,onSort:r}),n.jsx(mn,{label:"TR",sortKey:"trophies",sort:s,onSort:r}),(t==="points"||t==="lcq")&&n.jsx(dg,{label:"PTS",sort:s,onSort:r}),t==="pod"&&n.jsxs(n.Fragment,{children:[n.jsx(mn,{label:"RECORD",sortKey:"record",sort:s,onSort:r}),n.jsx(dg,{label:"PTS",sort:s,onSort:r})]}),t==="direct"&&n.jsxs(n.Fragment,{children:[n.jsx(mn,{label:"RECORD",sortKey:"record",sort:s,onSort:r,align:"center"}),n.jsx(mn,{label:"BOXES",sortKey:"boxes",sort:s,onSort:r})]})]}):n.jsxs("div",{className:"grid gap-x-5 py-2.5 pl-2 pr-5 font-display text-[11px] tracking-[0.2em] text-muted",style:{gridTemplateColumns:q6[t]},children:[n.jsx("span",{className:"text-center",children:"RANK"}),n.jsx("span",{children:"PLAYER"}
500),t==="lcq"&&n.jsx(mn,{label:"$",sortKey:"earnings",sort:s,onSort:r}),n.jsx(mn,{label:"TROPHIES",sortKey:"trophies",sort:s,onSort:r}),n.jsx(mn,{label:"EVENTS",sortKey:"events",sort:s,onSort:r}),n.jsx(mn,{label:"RECORD",sortKey:"record",sort:s,onSort:r,align:"center"}),n.jsx(mn,{label:"WIN %",sortKey:"winPct",sort:s,onSort:r}),(t==="points"||t==="lcq"||t==="pod")&&n.jsx(dg,{label:"POINTS",sort:s,onSort:r}),t==="direct"&&n.jsx(mn,{label:"BOXES",sortKey:"boxes",sort:s,onSort:r})]})}function mn({label:e,sortKey:t,sort:s,onSort:r,inline:a=!1,align:o="right"}){const i=o==="center";return r?n.jsx(Ni,{label:e,active:(s==null?void 0:s.key)===t,dir:(s==null?void 0:s.dir)??"desc",onClick:()=>r(t),align:o,inline:a}):n.jsx("span",{className:i?"block w-full text-center":"text-right",children:e})}function dg({label:e,sort:t,onSort:s}){return n.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[n.jsx(H6,{}),n.jsx(mn,{label:e,sortKey:"score",sort:t,onSort:s,inline:!0})]})}const Y6=e=>e>0?String(e):"—",ug=()=>n.jsx("span",{className:"font-num text-right text-[13px] text-dim",children:"—"});function Q6({row:e,mode:t,onToggle:s,href:r}){const a=q6[t],o=!!r&&!s,i=n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-num text-[13px] text-muted text-center",children:Y6(e.rank)}),n.jsx(eA,{row:e,avatarSize:30,nameSize:18,linked:o}),t==="lcq"&&n.jsx(sA,{earnings:e.earnings??0}),n.jsx(tA,{trophies:e.trophies,compact:!1,large:t==="pod"}),e.events>0?n.jsx("span",{className:"font-num text-right text-[13px] text-muted",children:e.events}):n.jsx(ug,{}),e.events>0?n.jsx(ht,{centered:!0,className:"font-num text-[13px] w-full",wins:e.wins,losses:e.losses}):n.jsx(ug,{}),e.events>0?n.jsxs("span",{className:"font-num text-right text-[13px] text-muted",children:[Nc(e.wins,e.losses),"%"]}):n.jsx(ug,{}),(t==="points"||t==="lcq"||t==="pod")&&n.jsx(eX,{score:e.score??0,large:!0,unranked:e.rank===0}),t==="direct"&&n.jsx(nA,{boxes:e.boxes??0,large:!0})]});return n.jsx(X6,{href:r,onToggle:s,className:"grid items-center gap-x-5 py-2.5 pl-2 pr-5",style:{gridTemplateColumns:a},children:i})}function J6({row:e,mode:t,onToggle:s,href:r}){const a=Z6[t],o=!!r&&!s,i=n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-num text-[12px] text-muted text-center",children:Y6(e.rank)}),n.jsx(eA,{row:e,avatarSize:26,nameSize:17,linked:o}),t==="lcq"&&n.jsx(sA,{earnings:e.earnings??0,compact:!0}),n.jsx(tA,{trophies:e.trophies,compact:!0,large:t==="pod"}),(t==="points"||t==="lcq")&&(e.rank===0?n.jsx("span",{className:"font-num text-right text-[13px] text-dim",children:"—"}):n.jsx("span",{className:"font-display text-right text-[18px] tracking-[0.02em] tabular-nums leading-none",children:ea(e.score??0)})),t==="pod"&&n.jsxs(n.Fragment,{children:[n.jsx(ht,{className:"font-num text-[13px] block text-right",wins:e.wins,losses:e.losses}),e.rank===0?n.jsx("span",{className:"font-num text-right text-[13px] text-dim",children:"—"}):n.jsx("span",{className:"font-display text-right text-[18px] tracking-[0.02em] tabular-nums leading-none",children:ea(e.score??0)})]}),t==="direct"&&n.jsxs(n.Fragment,{children:[n.jsx(ht,{centered:!0,className:"font-num text-[13px] w-full",wins:e.wins,losses:e.losses}),n.jsx(nA,{boxes:e.boxes??0})]})]});return n.jsx(X6,{href:r,onToggle:s,className:"py-[9px] pl-2 pr-3.5 grid gap-3 items-center",style:{gridTemplateColumns:a},children:i})}const X6=({href:e,onToggle:t,className:s,style:r,children:a})=>{if(!e)return n.jsx("div",{onClick:t,className:j(s,t&&"cursor-pointer"),style:r,children:a});const o=i=>{!t||!No(i)||(i.preventDefault(),t())};return n.jsx(te,{to:e,onClick:o,className:j(s,"cursor-pointer no-underline text-inherit",!t&&"group/row"),style:r,children:a})};function eA({row:e,avatarSize:t,nameSize:s,linked:r=!1}){return n.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[n.jsx(as,{displayName:e.displayName,avatarUrl:e.avatarUrl,size:t}),n.jsx("div",{className:j("font-display leading-none tracking-[0.04em] whitespace-nowrap overflow-hidden text-ellipsis",r&&"transition-colors group-hover/row:text-green"),style:{fontSize:s},children:e.displayName.toUpperCase()})]})}function tA({trophies:e,compact:t,large:s=!1}){const r=t?15:18,a=t?s?"text-[18px]":"text-[15px]":"text-[18px]";return n.jsx("div",{className:j("text-right flex items-center justify-end",t?"ga
500p-1":"gap-1.5"),children:e>0?n.jsxs(n.Fragment,{children:[n.jsx(ct,{size:r,color:"#ffc63a"}),n.jsx("span",{className:j("font-display tracking-[0.02em] tabular-nums leading-none",a),children:e})]}):n.jsx("span",{className:j("font-display text-dim tabular-nums leading-none",a),children:"—"})})}function eX({score:e,large:t,unranked:s}){return s?n.jsx("span",{className:"font-num text-right text-[13px] text-dim",children:"—"}):n.jsx("div",{className:j("text-right font-display tracking-[0.02em] tabular-nums",t?"text-[24px] leading-none":"text-[18px] leading-none"),children:ea(e)})}function sA({earnings:e,compact:t=!1}){return e<=0?n.jsx("span",{className:"font-num text-right text-[13px] text-dim",children:"—"}):n.jsxs("span",{className:j("text-right font-display tracking-[0.02em] tabular-nums leading-none text-green",t?"text-[16px]":"text-[18px]"),children:["$",e/1e3,"K"]})}function nA({boxes:e,large:t=!1}){return n.jsxs("div",{className:j("flex items-center justify-end",t?"gap-1.5":"gap-1"),children:[n.jsx("span",{className:j("leading-none",t?"text-[15px]":"text-[11px]"),"aria-hidden":"true",children:"📦"}),n.jsx("span",{className:j("font-display tracking-[0.02em] tabular-nums leading-none",t?"text-[24px]":"text-[18px]",e===0&&"text-dim"),children:e})]})}function tX({variant:e}){return n.jsx("div",{className:e==="mobile"?"py-2 px-3.5":"py-3 px-3.5",children:[0,1,2,3,4].map(t=>n.jsxs("div",{className:"grid gap-2.5 py-2.5 border-b border-border items-center",style:{gridTemplateColumns:"32px 1fr 60px"},children:[n.jsx("div",{className:"h-8 bg-surface2"}),n.jsx("div",{className:"h-3.5 bg-surface2 animate-pulse",style:{width:`${50+t*8}%`}}),n.jsx("div",{className:"h-3.5 bg-surface2"})]},t))})}function sX({children:e}){return n.jsxs("div",{className:"p-10 text-center",children:[n.jsx("div",{className:"font-display text-[22px] tracking-[0.04em] text-text",children:"NO EVENTS YET"}),n.jsx("div",{className:"font-mono text-[11px] text-muted mt-2",children:e??"NO PLAYER DATA FOR THIS SET / FILTER YET. CHECK BACK SOON."})]})}const rA=e=>`https://www.17lands.com/card_data?expansion=${e}&format=PremierDraft`,nX=(e,t)=>`https://www.17lands.com/card_data/details?${new URLSearchParams({card_id:String(t),expansion:e,format:"PremierDraft",time_period:"ALL_TIME"})}`,aA=100,rX=500;function aX(e){const t=new Map;for(const a of Object.keys(e.cards))t.set(a,{all:null,pairs:{}});const s=Object.entries(e.cards).map(([a,o])=>({name:a,wr:o.gihWr,games:o.gihGames}));for(const[a,o]of Jk(s))t.get(a).all=o;const r=new Set;for(const a of Object.values(e.cards))for(const o of Object.keys(a.pairs))r.add(o);for(const a of r){const o=Object.entries(e.cards).map(([i,l])=>{var c,d;return{name:i,wr:((c=l.pairs[a])==null?void 0:c.gihWr)??null,games:((d=l.pairs[a])==null?void 0:d.gihGames)??0}});for(const[i,l]of Jk(o))t.get(i).pairs[a]=l}return t}const oX=[["A+",99],["A",95],["A-",90],["B+",85],["B",76],["B-",68],["C+",57],["C",45],["C-",36],["D+",27],["D",17],["D-",5],["F",0]];function Jk(e){const t=e.filter(l=>l.wr!==null&&l.games>=aA),s=new Map;if(t.length<=1)return s;const r=t.map(l=>l.wr),a=r.reduce((l,c)=>l+c,0)/r.length,o=r.reduce((l,c)=>l+(c-a)**2,0)/(r.length-1),i=Math.sqrt(o);for(const l of t){if(l.games<=rX)continue;const c=iX((l.wr-a)/i)*100;for(const[d,u]of oX)if(c>=u){s.set(l.name,d);break}}return s}function iX(e){const t=1/(1+.3275911*(Math.abs(e)/Math.SQRT2)),r=1-t*(.254829592+t*(-.284496736+t*(1.421413741+t*(-1.453152027+t*1.061405429))))*Math.exp(-(e*e)/2);return e>=0?(1+r)/2:(1-r)/2}function Fv(e){var r;const t=XE[e],s=eR[e]??[];return{uid:t,graders:s,comparison:!t&&s.length>0,effectiveUid:t||((r=s[0])==null?void 0:r.uid)}}function oA(e){const t=(e??[]).filter(a=>vk(a.code)),s=new Set(t.map(a=>a.code));return[...Object.entries(nK).filter(([a])=>vk(a)&&!s.has(a)).map(([a,o])=>({code:a,name:o.name,startDate:o.startDate,endDate:"",isActive:!1})),...t].sort((a,o)=>o.startDate.localeCompare(a.startDate))}const Ci=["A+","A","A-","B+","B","B-","C+","C","C-","D+","D","D-","F","SB","TBD"],Xk=Ci.filter(e=>e!=="SB"&&e!=="TBD");function Fs(e){const t=Xk.indexOf(e);return t===-1?"#4a5260":`hsl(${Math.round(130-130*t/(Xk.length-1))}, 62%, 47%)`}const Wv={"A+":{title:"The Best Cards in the set",body:"Game winning when cast or hugely catch you up from behind"},A:{title:"Game Warping Card",body:"Often generates value or is difficult to deal with"},"A-":{title:"Very strong card",body:`Game winning if it sticks, usually a bit easier to deal with than A or A+ cards.
501Hyper efficient cards like Lightning Bolt also often get an A- grade`},"B+":{title:"Cards you're excited to first pick",body:"Not quite bomb tier but will be one of the best cards in your deck"},B:{title:"Good early picks",body:"Cards you might consider pivoting for"},"B-":{title:"Some of the better cards in your deck",body:"Often the top commons live here"},"C+":{title:"Cards that are close to uncuttable",body:"Cards you're happy to take if they're in your color, not quite good enough to pivot for"},C:{title:"Good Filler/Pillars of certain archetypes"},"C-":{title:"Solid Filler"},"D+":{title:"Medium Filler/Not fully supported Synergy Cards"},D:{title:"Bad Filler"},"D-":{title:"Try to avoid"},F:{title:"Actual Limited unplayable",body:"Cards that will always make your deck worse"},SB:{title:"Sideboard card",body:"Not maindeckable, but worth bringing in against the right deck"}},lX=[["A+","A","A-"],["B+","B","B-"],["C+","C","C-"],["D+","D","D-"],["F"],["SB"]],br=["W","U","B","R","G","M","C"],Mp={W:"White",U:"Blue",B:"Black",R:"Red",G:"Green",M:"Multicolor",C:"Colorless"},_i=e=>e==="L"?"C":e,cX=[{key:"synergy",glyph:"🤝",label:"Synergy"},{key:"buildaround",glyph:"🛠️",label:"Build-Around"}];function iA(e){return cX.filter(t=>e.flags[t.key])}const El={up:"#4ade80",down:"#f87171"},Ih={up:"▲",down:"▼"},dX={up:"Up since the set review",down:"Down since the set review"};function uX(e){if(!e.trend)return 0;const t=Ci.indexOf(e.trend_from??""),s=Ci.indexOf(e.tier);return t===-1||s===-1?1:Math.max(1,Math.abs(s-t))}function Hv(e){if(!e.trend)return[];const t=Ih[e.trend];return Array.from({length:Math.min(uX(e),3)},()=>t)}const W1=[{key:"creature",label:"Creature",ms:"creature",types:["creature"]},{key:"spell",label:"Instant / Sorcery",ms:"instant",types:["instant","sorcery"]},{key:"permanent",label:"Artifact / Enchantment / Planeswalker",ms:"enchantment",types:["artifact","enchantment","planeswalker"]},{key:"battle",label:"Battle",ms:"battle",types:["battle"]},{key:"land",label:"Land",ms:"land",types:["land"]}],fX=Object.fromEntries(W1.map(e=>[e.key,e])),hX=["1","2","3","4","5","6+"];function pX(e){const t=Math.floor(e);return t>=6?"6+":String(t)}const eS={sets:[],colors:[],manaValues:[],rarities:[],cardTypes:[],trends:[]};function lA(e){return e.sets.length+e.colors.length+e.manaValues.length+e.rarities.length+e.cardTypes.length+e.trends.length}function qm(e){return lA(e)>0}function mX(e,t){if(t.trends.length>0&&(!e.trend||!t.trends.includes(e.trend))||t.sets.length>0&&!t.sets.includes(e.expansion)||t.colors.length>0&&!t.colors.includes(_i(e.color))||t.manaValues.length>0&&!t.manaValues.includes(pX(e.cmc))||t.rarities.length>0&&!t.rarities.includes(e.rarity))return!1;if(t.cardTypes.length>0){const s=new Set(e.types.map(a=>a.toLowerCase()));if(!t.cardTypes.some(a=>{var o;return(o=fX[a])==null?void 0:o.types.some(i=>s.has(i))}))return!1}return!0}function Nu(e,t){return qm(t)?!mX(e,t):!1}const xX=12,tS=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase();function gX(e,t,s=xX){const r=tS(t.trim());if(!r)return[];const a=[];for(const o of e){const i=yX(tS(o.name),r);i!==-1&&a.push({card:o,start:i,end:i+r.length,rank:i===0?0:1})}return a.sort((o,i)=>o.rank-i.rank||o.card.name.localeCompare(i.card.name)),a.slice(0,s).map(({card:o,start:i,end:l})=>({card:o,start:i,end:l}))}const bX=/[\p{L}\p{N}']/u;function yX(e,t){let s=e.indexOf(t);for(;s>0&&bX.test(e[s-1]);)s=e.indexOf(t,s+1);return s}const vX=["C","U","R","M"],wX={C:"Common",U:"Uncommon",R:"Rare",M:"Mythic"},xl=["Main Set","Bonus Sheet","Special Guests","Source Material"];function $p(e){const t=xl.indexOf(e);return t===-1?xl.length:t}function jX(e){const t=new Map,s=new Map,r=new Map,a=new Map,o={up:0,down:0};for(const l of e){l.trend&&(o[l.trend]+=1);const c=t.get(l.expansion);c?c.count+=1:t.set(l.expansion,{label:l.inclusion_type,count:1});const d=_i(l.color);s.set(d,(s.get(d)??0)+1),r.set(l.rarity,(r.get(l.rarity)??0)+1);const u=new Set(l.types.map(f=>f.toLowerCase()));for(const f of W1)f.types.some(h=>u.has(h))&&a.set(f.key,(a.get(f.key)??0)+1)}return{sets:[...t.entries()].map(([l,{label:c,count:d}])=>({value:l,label:c,count:d})).sort((l,c)=>{const d=xl.indexOf(l.label),u=xl.indexOf(c.label);return(d===-1?xl.length:d)-(u===-1?xl.length:u)}),colors:br.filter(l=>
501s.has(l)).map(l=>({value:l,name:Mp[l],count:s.get(l)})),rarities:vX.filter(l=>r.has(l)).map(l=>({value:l,name:wX[l],count:r.get(l)})),types:W1.filter(l=>a.has(l.key)).map(l=>({value:l.key,label:l.label,ms:l.ms,count:a.get(l.key)})),trends:o}}const sS="tierListHideArt";function kX(){const[e,t]=p.useState(()=>typeof window>"u"?!1:window.localStorage.getItem(sS)==="1");return p.useEffect(()=>{window.localStorage.setItem(sS,e?"1":"0")},[e]),[e,t]}function SX(){const e="tierListDataGrades",[t,s]=p.useState(()=>window.localStorage.getItem(e)==="1");return[t,a=>{s(a),window.localStorage.setItem(e,a?"1":"0")}]}const cA=60*60*1e3,Ua=e=>e.split(" // ")[0].trim().toLowerCase();function NX(e){return typeof e=="number"?e>0?"up":e<0?"down":null:e==="up"||e==="down"?e:null}const nS=e=>e.map(t=>({...t,trend:NX(t.trend)}));async function rS(e){const t=aK[e],s=await fetch(t??`${rK}/${e}`);if(!s.ok)throw new Error(`Tier list fetch failed: ${s.status}`);const r=await s.json();if(Array.isArray(r))return{cards:nS(r),lastUpdated:null};const a=r!=null&&r.last_updated?`${String(r.last_updated).replace(" ","T")}Z`:null;return{cards:nS((r==null?void 0:r.ratings)??[]),lastUpdated:a}}function Zm(e,t=[]){var i,l;const s=R7({queries:[{queryKey:["tier-list",e],queryFn:()=>rS(e),enabled:!!e,staleTime:cA},...t.map(c=>({queryKey:["tier-list",c.uid],queryFn:()=>rS(c.uid),staleTime:1/0,gcTime:1/0}))]}),[r,...a]=s;let o=(i=r.data)==null?void 0:i.cards;if(o&&t.length>0){const c=a.map(d=>{var f;const u=new Map;for(const h of((f=d.data)==null?void 0:f.cards)??[])u.set(Ua(h.name),h.tier);return u});o=o.map(d=>({...d,graders:t.map((u,f)=>({name:u.name,tier:c[f].get(Ua(d.name))})).filter(u=>!!u.tier)}))}return{data:o,lastUpdated:((l=r.data)==null?void 0:l.lastUpdated)??null,isLoading:r.isLoading,isError:r.isError}}function cf(e){const s=je({queryKey:["card-stats",e],queryFn:()=>CX(e),enabled:sK.includes(e),staleTime:cA}).data;return p.useMemo(()=>s?_X(s):null,[s])}async function CX(e){const t=await fetch(`/api/card-stats/${e}`);if(!t.ok)throw new Error(`Card stats fetch failed: ${t.status}`);return t.json()}function _X(e){const t=new Map;for(const[a,o]of Object.entries(e.cards))t.set(Ua(a),o);const s=new Map;let r=!1;for(const[a,o]of aX(e))s.set(Ua(a),o),r||(r=o.all!==null);return{statsFor:a=>t.get(Ua(a)),gradesFor:a=>s.get(Ua(a)),hasStats:t.size>0,hasGrades:r,updatedAt:e.updatedAt}}const Sn="[text-shadow:1px_1px_1px_rgba(0,0,0,0.85),-1px_-1px_1px_rgba(0,0,0,0.85),1px_-1px_1px_rgba(0,0,0,0.85),-1px_1px_1px_rgba(0,0,0,0.85)]",wd=[{border:"border-[#2ee85c]",name:"text-[#2ee85c]"},{border:"border-[#5ab0ff]",name:"text-[#5ab0ff]"},{border:"border-[#f0b74a]",name:"text-[#f0b74a]"},{border:"border-[#f087c0]",name:"text-[#f087c0]"}];function aS({setCode:e,stats:t,grades:s,docked:r}){const a=EX(t,s);return r?n.jsxs("div",{className:TX,children:[n.jsxs("div",{className:j(oS,"relative"),children:[n.jsx("span",{className:"absolute -left-5 top-0 flex h-full w-[141px] items-center justify-center",children:n.jsx(AX,{setCode:e,mtgaId:t.mtgaId})}),n.jsx("span",{className:"flex flex-1 justify-center pl-[60px]",children:a.length>0&&n.jsx(PX,{grade:(s==null?void 0:s.all)??null})})]}),n.jsx(RX,{stats:t,className:oS}),n.jsx("div",{children:a.length>0&&n.jsx(iS,{decks:a,compact:!0})}),n.jsx(lS,{rows:uA(t),columns:1})]}):n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto text-text",children:[a.length>0&&n.jsx(iS,{decks:a,compact:!1}),n.jsx(lS,{rows:MX(t),columns:1})]})}const oS="flex h-[68px] shrink-0 items-start pt-[15px]",TX=j("grid min-h-0 grid-cols-[236px_minmax(0,1fr)] items-start gap-x-4","overflow-y-auto px-5 pb-5 text-text");function EX(e,t){const s=[];for(const[a,o]of Object.entries(e.pairs))(o==null?void 0:o.gihWr)!=null&&o.gihGames>=aA&&s.push({key:a,pair:a,gihWr:o.gihWr,gihGames:o.gihGames,grade:t==null?void 0:t.pairs[a]});if(s.sort((a,o)=>o.gihGames-a.gihGames),e.gihWr===null)return s;const r=(t==null?void 0:t.all)??void 0;return[{key:"all",pair:null,gihWr:e.gihWr,gihGames:e.gihGames,grade:r},...s]}function RX({stats:e,className:t}){const s=e.iwd===null?"–":`${e.iwd>=0?"+":""}${(e.iwd*100).toFixed(1)}`,r=[["ALSA",Up(e.alsa),Is.alsa],["ATA",Up(e.ata),Is.ata],["IWD",s,Is.iwd,e.iwd===null?void 0:"pp"]];return n.jsx("div",{className:j("flex",t),children:r.map(([a,o,i,l])=>n.jsx(dA,{caption:a,description:i,className:"flex-1",children:n.jsxs("span",{className:j("font-display text-[22px] leading-none text-white",Sn),children:[o,l&&n.jsx("span",{className:"ml-0.5 font-num text-[12px] lowercase",children:l})]})},a))})}function AX({setCode:e,mtgaId:t}){return n.jsxs("a",{href:t?nX(e,t):rA(e),target:"_blank",rel:"noreferrer",onClick:s=>s.stopPropagation(),className:j("flex items-center gap-1 whitespace-nowrap text-[12px] font-semibold uppercase tracking-[0.1em]","leading-none text-white no-underline transition-colors hover:text-green",Sn),children:["17LANDS",
501n.jsx(en,{size:11})]})}function PX({grade:e}){return n.jsx(dA,{caption:"GIH WR",description:Is.gihWr,children:n.jsx("span",{className:j("font-display text-[22px] leading-none",Sn),style:{color:e?Fs(e):"rgba(255,255,255,0.5)"},children:e??"–"})})}function dA({caption:e,description:t,className:s,children:r}){return n.jsx(Ne,{label:t,side:"top",className:"z-[250] max-w-[320px]",children:n.jsxs("span",{className:j("flex cursor-default flex-col items-center gap-2",s),children:[n.jsx("span",{className:j("text-[12px] font-semibold uppercase tracking-[0.1em] leading-none text-white",Sn),children:e}),r]})})}function iS({decks:e,compact:t}){return n.jsxs("div",{className:"flex shrink-0 border border-white/15",children:[n.jsx("div",{className:j("flex shrink-0 flex-col bg-white/[0.04] py-[6px]",t?"w-[60px]":"w-[76px]"),children:e.map(s=>n.jsx("span",{className:j("flex h-[49px] items-center justify-center",!s.grade&&"opacity-50"),children:n.jsx(DX,{deck:s})},s.key))}),n.jsx("div",{className:j("flex min-w-0 flex-1 flex-col py-[6px]",t?"px-2.5":"px-3"),children:e.map(s=>n.jsx(Ne,{label:`${H1(s.gihGames)} Games In Hand`,side:"right",className:"z-[250]",children:n.jsx("span",{className:j("flex h-[49px] items-center",!s.grade&&"opacity-50"),children:n.jsx(LX,{deck:s})})},s.key))})]})}function OX({grade:e}){return e?n.jsxs("span",{className:"relative",children:[e[0],n.jsx("span",{className:"absolute left-full",children:e.slice(1)})]}):n.jsx("span",{children:"–"})}function LX({deck:e}){const t=e.grade?Fs(e.grade):"#454951";return n.jsxs("span",{className:"flex h-11 flex-1 items-stretch overflow-hidden rounded-md border-2",style:{borderColor:t,backgroundColor:t},children:[n.jsx("span",{className:"flex w-14 items-center justify-center font-display text-[24px] leading-none text-bg pr-1",children:n.jsx(OX,{grade:e.grade})}),n.jsx("span",{className:"flex flex-1 items-center justify-center bg-[#161b26] font-num text-[20px] leading-none",children:gl(e.gihWr)})]})}function DX({deck:e}){return e.pair?n.jsx(Be,{colors:e.pair,size:16}):n.jsx("span",{className:"font-display text-[20px] leading-none",children:"AVG"})}const IX="flex h-[42px] cursor-default items-center justify-between gap-3 bg-[#161b26] px-3 text-[15px]";function lS({rows:e,columns:t}){return n.jsx("div",{className:j("grid shrink-0 grid-cols-1 gap-px border border-white/15 bg-white/10",t===2&&"min-[440px]:grid-cols-2"),children:e.map(([s,r,a])=>n.jsx(Ne,{label:a,side:"bottom",align:"start",className:"z-[250] max-w-[320px]",children:n.jsxs("div",{className:IX,children:[n.jsx("span",{children:s}),n.jsx("span",{className:"font-num",children:r})]})},s))})}function MX(e){const[t,s,r,a,o,i]=uA(e);return[["Average last seen at",Up(e.alsa),Is.alsa],["Average taken at",Up(e.ata),Is.ata],t,s,r,a,o,["Games in hand win rate",gl(e.gihWr),Is.gihWr],i,["Improvement when drawn",$X(e.iwd),Is.iwd]]}function uA(e){return[["Number of games played",H1(e.gp),Is.gp],["Number of games in hand",H1(e.gihGames),Is.gihGames],["Games played win rate",gl(e.gpWr),Is.gpWr],["Opening hand win rate",gl(e.ohWr),Is.ohWr],["Games drawn win rate",gl(e.gdWr),Is.gdWr],["Games not drawn win rate",gl(e.gnsWr),Is.gnsWr]]}const Is={alsa:"Average pick number where this card was last seen in packs",ata:"Average pick number at which this card was taken by 17Lands drafters",gp:"Number of games played with this card in the maindeck",gihGames:"Number of times this card was drawn, either in the opening hand or later",gpWr:"Win rate of decks with this card in the maindeck",ohWr:"Win rate of games where this card was in the opening hand",gdWr:"Win rate of games where this card was drawn, not counting cards from the opening hand",gihWr:"Win rate of games where this card was drawn, either in the opening hand or later",gnsWr:"Win rate of games where this card was in the maindeck, but was never drawn",iwd:"Difference between Games in hand win rate and Games not drawn win rate"},gl=e=>e===null?"–":`${(e*100).toFixed(1)}%`,$X=e=>e===null?"–":`${e>=0?"+":""}${(e*100).toFixed(1)}pp`,Up=e=>e===null?"–":e.toFixed(2),H1=e=>e.toLocaleString("en-US"),UX="#161b26",fA=p.createContext(()=>{});function zX({children:e}){const[t,s]=p.useState(null),[r,a]=p.useState(!1),o=p.useCallback(i=>{s(i??null),a(!0)},[]);return n.jsxs(fA.Provider,{value:o,children:[e,r&&It.createPortal(n.jsx(WX,{focusTier:t,onClose:()=>a(!1)}),document.body)]})}function hA(){return p.useContext(fA)}function BX({className:e,children:t}){const s=hA();return n.jsx(Ne,{label:"Grade Guide",side:"bottom",children:n.jsx("button",{type:"button",onClick:()=>s(),"aria-label":"Grade Guide",className:j("inline-flex items-center transition-colors hover:text-green",e),children:t})})}function FX({className:e}){return n.jsx(Pv,{size:13,className:j("shrink-0",e)})}function pA({tier:e,className:t,style:s}){const r=hA(),a=Wv[e],o=n.jsx("button",{type:"button",onClick:()=>r(e),"aria-label":a?`${e}: ${a.title}`:e,className:j("transition-colors hover:text-[var(--tier-color)]",t),style:{...s,"--tier-color":Fs(e)},children:e});return a?n.jsx(Ne,{label:n.jsx(mA,{tier:e,watermark:!0}),side:"right",className:"max-w-[320px] px-3 py-2.5",children:o}):o}function mA({tier:e,watermark:t=!1}){const{title:s,body:r}=Wv[e];return n.jsxs("span",{className:t?"relative flex min-h-[26px] flex-col justify-center pr-12":"relative block",children:[t&&n.jsx("span",{"aria-hidden":!0,
501className:j("pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 font-display text-[26px] leading-none",Sn),style:{color:Fs(e)},children:e}),n.jsx("span",{className:"relative block text-[13px] font-semibold leading-snug text-text",children:s}),r&&n.jsx("span",{className:"relative mt-1 block whitespace-pre-line text-[13px] leading-snug text-muted",children:r})]})}function WX({focusTier:e,onClose:t}){const s=p.useRef(null);return p.useEffect(()=>{var r;(r=s.current)==null||r.scrollIntoView({block:"center"})},[]),p.useEffect(()=>{const r=a=>{a.key==="Escape"&&t()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t]),n.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/70 p-4",onClick:t,children:n.jsxs("div",{className:"flex max-h-[calc(100dvh-32px)] w-full max-w-[720px] flex-col rounded-xl border border-white/15 shadow-2xl sm:border-white/60",style:{backgroundColor:UX},onClick:r=>r.stopPropagation(),children:[n.jsxs("div",{className:"relative flex items-center justify-center border-b border-white/15 px-12 py-3.5 sm:border-white/60",children:[n.jsx("h2",{className:"font-display text-[17px] leading-none tracking-[0.12em] text-text",children:"GRADE GUIDE"}),n.jsx("button",{type:"button",onClick:t,"aria-label":"Close",className:"absolute right-4 top-1/2 -translate-y-1/2 px-1 text-[20px] leading-none text-muted transition-colors hover:text-text",children:"×"})]}),n.jsx("div",{className:"overflow-y-auto px-4 py-1.5",children:lX.map(r=>n.jsx("div",{className:"border-t border-white/10 py-2 first:border-t-0",children:r.map(a=>n.jsxs("div",{ref:a===e?s:void 0,className:j("grid grid-cols-[32px_minmax(0,1fr)] items-start gap-x-2 rounded-md px-2 py-1.5",a===e&&"bg-white/10"),children:[n.jsx("span",{className:j("flex h-[18px] items-center font-display text-[21px] leading-none",Wv[a].body&&"translate-y-[1px]"),style:{color:Fs(a)},children:a}),n.jsx("div",{children:n.jsx(mA,{tier:a})})]},a))},r[0]))})]})})}const HX={prev:"M15 18l-6-6 6-6",next:"M9 6l6 6 -6 6"};function za({dir:e,onClick:t,to:s,label:r,srLabel:a}){const o=Rt(),l=j("flex items-center justify-center border border-white/40 text-text","transition-[transform,background-color,border-color] duration-150 ease-out","touch-manipulation [-webkit-tap-highlight-color:transparent]",r?"h-10 gap-2 rounded-lg px-3 font-display text-[14px] tracking-[0.14em]":"h-10 w-10 rounded-lg",!!t||!!s?"hover:border-white/60 hover:bg-white/10 active:scale-90 active:bg-white/20 motion-reduce:active:scale-100":"opacity-30"),c=n.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:HX[e]})}),d=n.jsxs(n.Fragment,{children:[e==="prev"&&c,r==null?void 0:r.toUpperCase(),e==="next"&&c]});return s?n.jsx(te,{to:s,replace:!0,state:o.state,"aria-label":r?void 0:a,className:j(l,"no-underline"),children:d}):n.jsx("button",{type:"button",onClick:t,disabled:!t,"aria-label":r?void 0:a,className:l,children:d})}function Cu(e){return e.split("//")[0].normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/['’]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}const fo=new Set;function GX(e){return fo.has(e)}function VX(e){fo.add(e)}function dc(e,t){if(fo.has(e)){t==null||t();return}const s=new Image,r=()=>{fo.add(e),t==null||t()};s.onload=r,s.onerror=r,s.src=e,s.complete&&s.naturalWidth>0&&r()}function KX(e){const[t,s]=p.useState(()=>fo.has(e));return p.useEffect(()=>{if(fo.has(e)){s(!0);return}s(!1);let r=!0;return dc(e,()=>{r&&s(!0)}),()=>{r=!1}},[e]),t}function xA(e){const[t,s]=p.useState(!1),[r,a]=p.useState(!1);return p.useLayoutEffect(()=>{const i=fo.has(e);s(i),a(i)},[e]),{loaded:t,instant:r,onLoad:()=>{fo.add(e),s(!0)}}}const Gv=e=>e.replace(/\s*>{2,}\s*/g," ").replace(/\s{2,}/g," ").trim();function qX(e,t){const s=/\s*>{2,}\s*/,r=new Map,a=c=>(r.has(c)||r.set(c,r.size),r.get(c));let o=0;for(const c of e)c.speaker?a(c.speaker):o=(o+c.text.split(s).length-1)%2;const i=[],l=(c,d,u)=>{const f=i[i.length-1];f&&f.lane===c&&u?f.paragraphs.push(d):i.push({lane:c,paragraphs:[d]})};for(const c of t){if(c.speaker){l(a(c.speaker),Gv(c.text),!0);continue}
501c.text.split(s).forEach((d,u)=>{u>0&&(o=1-o);const f=d.trim();f&&l(o,f,u===0)})}return i}function ZX(e,t){const s=[e];for(const r of t){const a=Gv(r.text);r.heading?s.push("",`# ${r.heading}`,"",a):r.subheading?s.push("",`## ${r.subheading}`,"",a):s.push(a)}return`${s.join(`
502`).replace(/\n{3,}/g,`
503
504`).trim()}
505`}function YX(e,t){const s=new Blob([t],{type:"text/plain;charset=utf-8"}),r=URL.createObjectURL(s),a=document.createElement("a");a.href=r,a.download=e,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(r)}const cS={C:"#ffffff",U:"#707883",R:"#a58e4a",M:"#bf4427"},QX={W:"w",U:"u",B:"b",R:"r",G:"g",M:"multicolor",C:"c"};function df(e){return e==="M"?"ms ms-multicolor ms-duo ms-duo-color ms-grad":`ms ms-cost ms-${QX[e]}`}const gA=p.createContext(!1),bA=p.createContext(!1);function JX({setCode:e,uid:t,graders:s,comparison:r=!1,filters:a,hideArt:o,dataGrades:i=!1,stickyTop:l}){const{data:c,isLoading:d,isError:u}=Zm(t,s),f=cf(e),h=ut();if(d||!c)return u?n.jsx("div",{className:"border border-border bg-surface py-16 text-center text-muted text-[14px]",children:"Couldn't load this tier list."}):n.jsx(XX,{isMobile:h,stickyTop:l});const m=i&&(f==null?void 0:f.hasGrades),y=w=>{var x;return m?((x=f.gradesFor(w.name))==null?void 0:x.all)??"TBD":w.tier},b=new Map;for(const w of c){const x=`${_i(w.color)}|${y(w)}`,g=b.get(x);g?g.push(w):b.set(x,[w])}for(const w of b.values())w.sort((x,g)=>{var C,_;if(m)return(((C=f.statsFor(g.name))==null?void 0:C.gihWr)??0)-(((_=f.statsFor(x.name))==null?void 0:_.gihWr)??0);const v=$p(x.inclusion_type),k=$p(g.inclusion_type);if(v!==k)return v-k;const S=x.sort_key??Number.MAX_SAFE_INTEGER,N=g.sort_key??Number.MAX_SAFE_INTEGER;return S-N||x.name.localeCompare(g.name)});return n.jsx(gA.Provider,{value:r,children:n.jsx(bA.Provider,{value:!!m,children:h?n.jsx(tee,{setCode:e,byKey:b,filters:a,hideArt:o}):n.jsx(eee,{setCode:e,byKey:b,filters:a,hideArt:o,stickyTop:l})})})}const dS=["A","B","C","D","F","SB"],uS=(e,t)=>(e*3+t*2)%4;function XX({isMobile:e,stickyTop:t}){if(e)return n.jsx("div",{className:"flex flex-col gap-[5px]",children:dS.map((r,a)=>n.jsxs("div",{className:"border border-border bg-surface",children:[n.jsx("div",{className:"bg-bg border-b border-border py-1.5 text-center font-display text-[18px] leading-none text-muted",children:r}),n.jsx("div",{className:"border-l-4 border-border",style:{borderLeftColor:Fs(r)},children:[0,1,2].map((o,i)=>n.jsxs("div",{className:j("flex",i>0&&"border-t border-border"),children:[n.jsx("div",{className:"w-[44px] shrink-0 flex items-center justify-center",children:n.jsx("span",{className:"h-4 w-4 rounded-full bg-surface2 animate-pulse"})}),n.jsx("div",{className:"grid min-w-0 flex-1 grid-cols-1 min-[450px]:grid-cols-2 gap-1 px-1 py-2",children:Array.from({length:uS(a,o)+1}).map((l,c)=>n.jsx(fS,{},c))})]},o))})]},r))});const s={position:"sticky",top:t,zIndex:10};return n.jsxs("div",{className:"border-x border-b border-border bg-bg",children:[n.jsxs("div",{className:"grid",style:{gridTemplateColumns:"48px repeat(7, minmax(0, 1fr))"},children:[n.jsx("div",{className:"border-t border-b border-border bg-bg",style:s}),br.map(r=>n.jsx("div",{className:"border-t border-b border-border bg-bg flex items-center justify-center py-2",style:s,children:n.jsx("span",{className:"h-4 w-4 rounded-full bg-surface2 animate-pulse"})},r))]}),n.jsx("div",{className:"grid",style:{gridTemplateColumns:"48px repeat(7, minmax(0, 1fr))",rowGap:2},children:dS.map((r,a)=>n.jsxs(p.Fragment,{children:[n.jsx("div",{className:"border-l-4 border-border bg-bg flex items-center justify-center font-display text-[20px] leading-none text-muted",style:{borderLeftColor:Fs(r)},children:r}),br.map((o,i)=>n.jsx("div",{className:"bg-surface p-1 flex flex-col gap-1 min-h-[26px]",children:Array.from({length:uS(a,i)}).map((l,c)=>n.jsx(fS,{},c))},o))]},r))})]})}function fS(){return n.jsx("div",{className:"min-h-[28px] rounded-[5px] border-l-4 border-border2 bg-surface2 animate-pulse"})}function eee({setCode:e,byKey:t,filters:s,hideArt:r,stickyTop:a}){const o=qm(s),i=vA(e,t,s),l=f=>o?Ci.some(h=>(t.get(`${f}|${h}`)??[]).some(m=>!Nu(m,s))):!0,c={position:"sticky",top:a,zIndex:10},d=f=>br.some(h=>(t.get(`${h}|${f}`)??[]).length>0),u=Ci.filter(f=>f!=="TBD"||d(f));return n.jsxs("div",{className:"border-x border-b border-border bg-bg",children:[n.jsxs("div",{className:"grid",style:{gridTemplateColumns:"48px repeat(7, minmax(0, 1fr))"},children:[n.jsx("div",{className:"border-t border-b border-border bg-bg",style:c}
505),br.map(f=>n.jsx("div",{title:Mp[f],className:"border-t border-b border-border bg-bg flex items-center justify-center py-2",style:c,children:n.jsx("i",{className:j(df(f),"transition-opacity",!l(f)&&"opacity-20"),style:{fontSize:f==="M"?21:14,filter:l(f)?void 0:"grayscale(1)"},"aria-label":Mp[f]})},f))]}),n.jsx("div",{className:"grid",style:{gridTemplateColumns:"48px repeat(7, minmax(0, 1fr))",rowGap:2},children:u.map(f=>n.jsxs(p.Fragment,{children:[n.jsx(pA,{tier:f,className:"border-l-4 border-border bg-bg flex items-center justify-center font-display text-[20px] leading-none text-text",style:{borderLeftColor:Fs(f)}}),br.map(h=>{const m=t.get(`${h}|${f}`)??[];return n.jsx("div",{className:"bg-surface px-1 py-2 flex flex-col gap-1 min-h-[26px]",children:m.filter(y=>!Nu(y,s)).map(y=>n.jsx(kA,{card:y,mobile:!1,hideArt:r,onOpen:()=>i.open(y.card_id)},y.card_id))},h)})]},f))}),n.jsx(wA,{pager:i})]})}function tee({setCode:e,byKey:t,filters:s,hideArt:r}){const a=qm(s),o=vA(e,t,s),i=Ci.map(l=>({tier:l,colors:br.filter(c=>{const d=t.get(`${c}|${l}`)??[];return d.length===0?!1:a?d.some(u=>!Nu(u,s)):!0})})).filter(l=>l.colors.length>0);return n.jsxs("div",{className:"flex flex-col gap-[5px]",children:[i.map(({tier:l,colors:c})=>n.jsxs("div",{className:"border border-border bg-surface",children:[n.jsx(pA,{tier:l,className:"w-full bg-bg border-b border-border py-1.5 text-center font-display text-[18px] leading-none text-text"}),n.jsx("div",{className:"border-l-4 border-border",style:{borderLeftColor:Fs(l)},children:c.map((d,u)=>n.jsxs("div",{className:j("flex",u>0&&"border-t border-border"),children:[n.jsx("div",{className:"w-[44px] shrink-0 flex items-center justify-center",children:n.jsx("i",{className:df(d),style:{fontSize:d==="M"?24:16},"aria-label":Mp[d]})}),n.jsx("div",{className:"grid min-w-0 flex-1 grid-cols-1 min-[450px]:grid-cols-2 gap-1 px-1 py-2",children:(t.get(`${d}|${l}`)??[]).filter(f=>!Nu(f,s)).map(f=>n.jsx(kA,{card:f,mobile:!0,hideArt:r,onOpen:()=>o.open(f.card_id)},f.card_id))})]},d))})]},l)),n.jsx(wA,{pager:o})]})}const hS=Object.fromEntries(br.map((e,t)=>[e,t]));function yA(e,t){const s=$p(e.inclusion_type),r=$p(t.inclusion_type);if(s!==r)return s-r;const a=hS[_i(e.color)]??br.length,o=hS[_i(t.color)]??br.length;if(a!==o)return a-o;if(e.expansion!==t.expansion)return e.expansion.localeCompare(t.expansion);const i=pS(e.collector_number),l=pS(t.collector_number);return i.altRank!==l.altRank?i.altRank-l.altRank:i.base!==l.base?i.base-l.base:i.suffix.localeCompare(l.suffix)}function pS(e){if(!e)return{base:0,suffix:"",altRank:0};const t=e.match(/^([A-Za-z]+)-(\d+)$/);if(t)return{base:parseInt(t[2],10),suffix:"",altRank:1};const s=e.match(/^(\d+)([A-Za-z]*)$/);return{base:parseInt((s==null?void 0:s[1])??"0",10),suffix:((s==null?void 0:s[2])??"").toUpperCase(),altRank:0}}function vA(e,t,s){const{card:r}=cn(),a=ln(),o=Rt(),i=p.useMemo(()=>{const f=[];for(const h of t.values())for(const m of h)Nu(m,s)||f.push(m);return f.sort(yA)},[t,s]),l=r?i.findIndex(f=>Cu(f.name)===r):-1,c=`/tier-list/${e}`,d=Ju(c),u=f=>`${c}/${Cu(f.name)}${o.search}`;return{visibleCards:i,selectedIndex:l,selectedCard:l===-1?null:i[l],open:f=>{const h=i.find(m=>m.card_id===f);h&&a(u(h),{state:gi})},close:d,stepTo:f=>a(u(i[f]),{replace:!0,state:o.state})}}function wA({pager:e}){const{selectedCard:t,selectedIndex:s,visibleCards:r,close:a,stepTo:o}=e;return t?It.createPortal(n.jsx(Kv,{card:t,linkReview:!0,onClose:a,onPrev:s>0?()=>o(s-1):void 0,onNext:s<r.length-1?()=>o(s+1):void 0,position:`${s+1} / ${r.length}`,neighborUrls:Vv(r,s)}),document.body):null}const Ud=260,see=1.4,Mh=12,nee=60,uc="#161b26",jA="#232c3d";function uf(e,t=Ud*see+nee){const s=e.getBoundingClientRect(),r=s.top+s.height/2,a=Math.min(Math.max(r-t/2,8),Math.max(window.innerHeight-t-8,8)),o=s.right+Mh+Ud<=window.innerWidth-8;return{left:o?s.right+Mh:s.left-Mh-Ud,top:a,onRight:o,centerY:r}}function Ym({anchor:e,children:t}){const s=Mh,r=p.useRef(null),[a,o]=p.useState(0);p.useLayoutEffect(()=>{var u;o(((u=r.current)==null?void 0:u.offsetHeight)??0)},[e,t]);const i=e.centerY-e.top,l=a>0&&i>=14&&i<=a-14,c=e.onRight?`M${s} 0 L0 11 L${s} 22 Z`:`M0 0 L${s} 11 L0 22 Z`,d=e.onRight?`M${s} 1.4 L1.6 11 L${s} 20.6 Z`:`M0 1.4 L${s-1.6} 11 L0 20.6 Z`;return n.jsxs("div",{className:"pointer-events-none fixed z-[100]",style:{left:e.left,top:e.top,width:Ud},children:[l&&n.jsxs("svg",{width:s,height:"22",viewBox:`0 0 ${s}
505 22`,className:"absolute z-10",style:{top:i-11,...e.onRight?{left:-11}:{right:-11}},children:[n.jsx("path",{d:c,fill:"#fff",fillOpacity:"0.6"}),n.jsx("path",{d,fill:uc})]}),n.jsx("div",{ref:r,className:"relative flex flex-col rounded-xl border border-white/60 p-[6px] shadow-2xl",style:{backgroundColor:uc},children:t})]})}function kA({card:e,mobile:t,hideArt:s=!1,onOpen:r}){const a=p.useRef(null),o=p.useRef(!1),[i,l]=p.useState(null),[c,d]=p.useState(!1),u=cS[e.rarity]??cS.C,f=e.url.replace("/large/","/art_crop/"),h=`${e.comment?"💬":""}${iA(e).map(x=>x.glyph).join("")}`,m=e.trend?`${dX[e.trend]}${e.trend_from?` (${e.trend_from} → ${e.tier})`:""}`:"",y=p.useContext(bA)?null:e.trend,b=()=>{o.current=!0,dc(e.url,()=>{const x=a.current;o.current&&x&&l(uf(x))})},w=()=>{o.current=!1,l(null)};return n.jsxs("div",{ref:a,onMouseEnter:t?void 0:b,onMouseLeave:t?void 0:w,onClick:()=>{l(null),r==null||r()},className:"relative min-[450px]:max-w-[300px] cursor-pointer rounded-[5px] border-l-4",style:{borderLeftColor:u},children:[n.jsxs("div",{className:"relative min-h-[28px] overflow-hidden rounded-r-[5px] bg-surface2",children:[!s&&n.jsxs(n.Fragment,{children:[n.jsx("img",{src:f,alt:"",loading:"lazy",decoding:"async",onLoad:()=>d(!0),className:j("absolute inset-0 h-full w-full object-cover transition-opacity duration-300",c?"opacity-100":"opacity-0"),style:{objectPosition:"center 22%"}}),n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-black/85 via-black/55 to-black/30"})]}),n.jsxs("div",{className:"relative flex min-h-[28px] items-center justify-between gap-1 px-2 py-0.5",children:[n.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1",children:[y&&n.jsx("span",{className:j("flex shrink-0 flex-col items-center",Sn),style:{color:El[y]},title:m,"aria-label":m,children:Hv(e).map((x,g,v)=>n.jsx("span",{className:j("relative text-[13px] leading-none",g>0&&"-mt-[6px]"),style:{zIndex:v.length-g},children:x},g))}),n.jsx("span",{className:j("min-w-0 line-clamp-2 text-[13px] font-medium leading-tight text-white",Sn),children:e.name})]}),h&&n.jsx("span",{className:"shrink-0 text-[14px] leading-none",children:h})]})]}),i&&It.createPortal(n.jsx(CA,{card:e,anchor:i}),document.body)]})}function SA({card:e,dataGrade:t,dataGradeHidden:s=!1,compact:r=!1}){const a=p.useContext(gA),o=(e.graders??[]).filter(l=>l.tier!=="TBD"),i=t?n.jsx(nh,{caption:"17LANDS",tier:t,collapsed:s,compact:r}):null;return a&&o.length>0?n.jsxs("div",{className:"flex items-stretch px-3 py-2.5",children:[o.map(l=>n.jsx(nh,{caption:l.name,tier:l.tier,compact:r},l.name)),i]}):n.jsxs("div",{className:"flex items-stretch px-3 py-2.5",children:[n.jsx(nh,{caption:"Set review",tier:e.trend_from??e.tier,compact:r}),e.trend?n.jsx(nh,{caption:"Updated",tier:e.tier,trendCard:e,compact:r}):o.length>0&&n.jsx("span",{className:"grid flex-1 grid-cols-[auto_auto] content-center items-center justify-center gap-x-4 gap-y-1.5",children:o.map(l=>n.jsxs(p.Fragment,{children:[n.jsx("span",{className:j("text-[13px] font-semibold leading-none text-white",Sn),children:l.name}),n.jsx("span",{className:j("justify-self-start font-display text-[17px] leading-none",Sn),style:{color:Fs(l.tier)},children:l.tier})]},l.name))}),i]})}function nh({caption:e,tier:t,trendCard:s,collapsed:r=!1,compact:a=!1}){const o=s!=null&&s.trend?Hv(s):[];return n.jsxs("span",{className:j("flex basis-0 flex-col items-center gap-2 overflow-hidden","transition-[flex-grow,opacity] duration-300 ease-out",r?"grow-0 opacity-0":"grow opacity-100"),children:[n.jsx("span",{className:j("whitespace-nowrap text-[12px] font-semibold uppercase leading-none text-white",a?"tracking-[0.03em]":"tracking-[0.1em]",Sn),children:e}),n.jsxs("span",{className:"relative flex items-center",children:[n.jsx("span",{className:j("font-display text-[26px] leading-none",Sn),style:{color:Fs(t)},children:t}),(s==null?void 0:s.trend)&&n.jsx("span",{className:j("absolute left-full top-1/2 ml-1.5 flex -translate-y-1/2 flex-col items-center",Sn),style:{color:El[s.trend]},children:o.map((i,l,c)=>n.jsx("span",{className:j("text-[11px] leading-none",l>0&&"-mt-[5px]"),style:{zIndex:c.length-l},children:i},l))})]})]})}function NA({card:e}){const t=iA(e);return t.length===0?null:n.jsx("div",{className:"absolute -top-[9px] left-1/2 flex -translate-x-1/2 gap-1.5",children:t.map(s=>n.jsxs("span",{className:"flex items-center gap-1.5 whitespace-nowrap rounded-full border border-white/60 py-[3px] pl-2 pr-2.5 text-[10px] font-bold uppercase leading-none tracking-[0.08em] text-white",style:{backgroundColor:jA},children:[n.jsx("span",{className:"text-[11px] leading-none tracking-normal",children:s.glyph}),s.label]},s.key))})}function CA({card:e,anchor:t}){var r,a;const s=(a=(r=cf(e.expansion))==null?void 0:r.gradesFor(e.name))==null?void 0:a.all;return n.jsxs(Ym,{anchor:t,children:[n.jsx(NA,{card:e}),n.jsx(SA,{card:e,dataGrade:s,compact:!0}),n.jsx(TA,{src:e.url,alt:""}),e.comment&&n.jsx("p",{className:"whitespace-pre-line px-3 py-2.5 text-center text-[14px] leading-snug text-text",children:e.comment})]})}function Vv(e,t){const s=[];for(const r of[e[t-1],e[t+1]])r&&(s.push(r.url),r.url_back&&s.push(r.url_back));return s}function Kv({card:e,linkReview:t=!1,onClose:s,onPrev:r,onNext:a,position:o,neighborUrls:i=[]}){var st;const[l,c]=p.useState(!1),[d,u]=p.useState(e),[f,h]=oee(t),[m,y]=p.useState(f),b=p.useRef(!1);p.useEffect(()=>{b.current=!0},[]);const w=!ut(1024),x=!!e.url_back,{setIndexed:g,mention:v}=IZ(e.expansion,e.name),k=cf(e.expansion),S=k==null?void 0:k.statsFor(e.name),N=k==null?void 0:k.gradesFor(e.name),C=!!(S&&S.gihGames>0),_=!!(k!=null&&k.hasStats);p.useEffect(()=>{c(!1),e.url_back&&u(e)},[e.card_id]);const T=i.join("|");p.useEffect(()=>{for(const ie of T?T.split("|"):[])dc(ie)},[T]),p.useEffect(()=>{const ie=Se=>{var Ie;(Se.key==="ArrowLeft"||Se.key==="ArrowRight")&&((Ie=document.activeElement)==null||Ie.blur()),Se.key==="ArrowLeft"?r==null||r():Se.key==="ArrowRight"?a==null||a():Se.ke
505y==="Escape"&&s()};return document.addEventListener("keydown",ie),()=>document.removeEventListener("keydown",ie)},[r,a,s]);const E=lee(f),A=ie=>{const Se=w?aee(f,ie):{...G1,[ie]:E!==ie};h(Se),P(Se)},P=ie=>y(Se=>({transcript:Se.transcript||ie.transcript,video:Se.video||ie.video,data:Se.data||ie.data})),M=ie=>y(Se=>({...Se,[ie]:!1})),U=!!v,F=p.useRef(v);v&&(F.current=v);const I=F.current,q=ie=>ie==="data"?C:U,O=ie=>q(ie)&&(w?f[ie]:E===ie),H=(ie,Se,Ie,_e)=>({pressed:O(ie),disabled:!q(ie),tooltip:q(ie)?O(ie)?Ie:Se:_e,onClick:()=>A(ie)}),B="Card not found in the Set Review",D=H("transcript","Read about this card","Hide the transcript",B),L=H("video","Jump to this card in the video","Hide the video",B),$=H("data","Show 17Lands data","Hide 17Lands data","No 17Lands data yet"),V=g&&U&&(f.transcript||f.video),z=C&&f.data,K=w&&(V||z),W=!w&&(V||z);p.useEffect(()=>{K&&P(f)},[K]);const[J,Z]=iee(),Y=w&&V&&!z,ae=f.data||!K&&m.data,pe=Y&&J,ye="calc(var(--panel-w) + 16px)",De={"--card-w":pe?"min(calc((90dvh - 150px) / 1.4), 34vw)":"320px","--panel-w":ree(pe,ae&&w)},Fe=m.transcript,tt=j(pe&&Fe&&"mx-auto w-full max-w-[calc(55dvh*16/9)]");return n.jsx("div",{className:j("fixed inset-0 z-[200] flex items-start justify-center overflow-y-auto bg-black/70","transition-[padding] duration-300 ease-out",W&&"p-3",!W&&(pe?"p-6 pt-[5dvh]":"p-6 pt-[max(24px,calc((100dvh-620px)/2))]")),style:De,onClick:ie=>{ie.stopPropagation(),s()},children:n.jsxs("div",{className:j("flex w-full shrink-0 flex-col items-center transition-[transform,max-width] duration-300 ease-out",W&&"h-full max-w-[480px]",!W&&(w?"max-w-[var(--card-w)]":"max-w-[320px]")),style:{transform:K?`translateX(calc(${ye} / -2))`:void 0},children:[n.jsxs("div",{className:j("relative w-full shrink-0 rounded-xl border border-white/15 p-[6px] shadow-2xl sm:border-white/60",!w&&"max-w-[320px]"),style:{backgroundColor:uc},onClick:ie=>ie.stopPropagation(),children:[n.jsx(NA,{card:d}),n.jsx(SA,{card:d,dataGrade:(st=k==null?void 0:k.gradesFor(d.name))==null?void 0:st.all,dataGradeHidden:z}),x?n.jsx(dee,{front:e.url,back:e.url_back,name:e.name,flipped:l}):n.jsx(TA,{src:e.url,alt:e.name,onShown:()=>u(e)}),n.jsxs("div",{className:j("flex items-center justify-between px-3 py-3.5",!d.comment&&"-mb-[6px]",W&&"hidden"),children:[n.jsx(za,{dir:"prev",srLabel:"Previous card",onClick:r}),o&&n.jsx("span",{className:"font-num text-[12px] tracking-[0.1em] text-white/70",children:o}),n.jsx(za,{dir:"next",srLabel:"Next card",onClick:a})]}),d.comment&&n.jsx("p",{className:"-mx-[6px] -mb-[6px] whitespace-pre-line border-t border-white/15 px-3 py-3.5 text-center text-[14px] leading-snug text-text sm:border-white/60",children:d.comment}),w&&n.jsx("div",{className:j("absolute left-full top-full flex justify-end overflow-hidden pt-4",Y?"transition-[width] duration-300 ease-out":"invisible"),style:{width:Y?ye:0},children:n.jsxs(Nr,{tooltip:J?"Use compact size":"Use the full screen",onClick:()=>Z(!J),children:[J?n.jsx(eQ,{size:15}):n.jsx(XY,{size:15}),J?"Collapse":"Expand"]})}),w&&n.jsxs("div",{className:j("absolute -top-px left-full flex justify-end overflow-hidden",!ae&&"max-h-[calc(100%+2px)]","transition-[width] duration-300 ease-out"),style:{width:K?ye:0},onTransitionEnd:ie=>{ie.target===ie.currentTarget&&!K&&y(G1)},children:[ae&&S&&n.jsx("div",{className:"flex w-[var(--panel-w)] shrink-0 flex-col",children:n.jsx(hg,{className:"min-h-0 p-0",children:n.jsx(aS,{setCode:e.expansion,stats:S,grades:N,docked:!0},e.name)})}),g&&I&&!ae&&n.jsxs("div",{className:"flex w-[var(--panel-w)] shrink-0 flex-col transition-[width] duration-300 ease-out",children:[m.video&&n.jsx(fg,{open:f.video,animateIn:b.current,onClosed:()=>M("video"),className:"shrink-0",children:n.jsx("div",{className:"pb-3",children:n.jsx(hg,{className:tt,children:n.jsx(_A,{mention:I})})})}),Fe&&n.jsx(fg,{open:f.transcript,animateIn:b.current,onClosed:()=>M("transcript"),className:"min-h-0",children:n.jsx(hg,{className:"min-h-0",children:n.jsx(gS,{view:"transcript",mention:I,cardName:e.name})})})]})]})]}),(x||g||_)&&!W&&n.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-center gap-2",children:[x&&n.jsxs(Nr,{onClick:()=>c(ie=>!ie),children:[n.jsx($1,{size:15}),"Turn Over"]}),g&&n.jsxs(n.Fragment,{children:[n.jsxs(Nr,{...L,children:[n.jsx(lc,{size:15}),"Video"]}),n.jsxs(Nr,{...D,children:[n.jsx(cc,{size:15}),"Transcript"]})]}),_&&n.jsxs(Nr,{...$,children:[n.jsx(Lk,{size:15}),"Data"]})]}),W&&n.jsx(fg,{open:!0,animateIn:b.current,className:j("w-full",E!=="video"&&"min-h-0 flex-1"),children:n.jsxs("div",{className:j("mt-3 flex min-h-0 w-full flex-col overflow-hidden rounded-lg border border-white/15 shadow-2xl",E!=="video"&&"flex-1"),style:{backgroundColor:uc},onClick:ie=>ie.stopPropagation(),children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-white/15 p-2",children:[n.jsx(za,{dir:"prev",srLabel:"Previous card",onClick:r}),n.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-center gap-2",children:[g&&n.jsxs(n.Fragment,{children:[n.jsxs(Nr,{compact:!0,grow:!0,...L,children:[n.jsx(lc,{size:15}),"Video"]}),n.jsxs(Nr,{compact:!0,grow:!0,...D,children:[n.jsx(cc,{size:15}),"Transcript"]})]}),_&&n.jsxs(Nr,{compact:!0,grow:g,...$,children:[n.jsx(Lk,{size:15}),"Data"]}),x&&n.jsx(Nr,{compact:!0,onClick:()=>c(ie=>!ie),children:n.jsx($1,{size:15})})]}),n.jsx(za,{dir:"next",srLabel:"Next card",onClick:a})]}),n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col p-3",children:[E==="data"&&S&&n.jsx(aS,{setCode:e.expansion,stats:S,grades:N,docked:!1},e.name),E&&E!=="data"&&v&&n.jsx(gS,{view:E,mention:v,cardName:e.n
505ame})]})]})})]})})}const G1={transcript:!1,video:!1,data:!1};function ree(e,t){return e?"calc(90vw - var(--card-w) - 16px)":t?"min(590px, calc(100vw - var(--card-w) - 96px))":"min(520px, calc(50vw - 200px))"}function aee(e,t){return t==="data"?{...G1,data:!e.data}:{...e,[t]:!e[t],data:!1}}function oee(e){const t="tierCardReviewPanel",[s,r]=Rn(),a=s.get("review"),[o,i]=p.useState(()=>(e&&a!==null?xS(a):null)??xS(window.localStorage.getItem(t)??"")),l=mS(o);return p.useEffect(()=>{if(!e||(a??"")===l)return;const d=new URLSearchParams(s);l?d.set("review",l):d.delete("review"),r(d,{replace:!0})},[e,a,l]),[o,d=>{i(d),window.localStorage.setItem(t,mS(d))}]}function iee(){const e="tierCardReviewFullScreen",[t,s]=p.useState(()=>window.localStorage.getItem(e)==="1");return[t,a=>{s(a),window.localStorage.setItem(e,a?"1":"0")}]}function lee(e){return e.data?"data":e.transcript?"transcript":e.video?"video":null}function mS(e){return e.data?"data":e.transcript&&e.video?"both":e.transcript?"transcript":e.video?"video":""}function xS(e){return{transcript:e==="transcript"||e==="both",video:e==="video"||e==="both",data:e==="data"}}function fg({open:e,animateIn:t,onClosed:s,className:r,children:a}){const[o,i]=p.useState(e&&!t);return p.useEffect(()=>{const l=window.requestAnimationFrame(()=>i(e));return()=>window.cancelAnimationFrame(l)},[e]),n.jsx("div",{className:j("grid transition-[grid-template-rows] duration-300 ease-out",r),style:{gridTemplateRows:o?"minmax(0, 1fr)":"minmax(0, 0fr)"},onTransitionEnd:l=>{l.target===l.currentTarget&&!e&&(s==null||s())},children:n.jsx("div",{className:"flex min-h-0 flex-col overflow-hidden",children:a})})}function hg({className:e,children:t}){return n.jsx("div",{className:j("flex flex-col overflow-hidden rounded-xl border border-white/15 p-3 shadow-2xl sm:border-white/60",e),style:{backgroundColor:uc},children:t})}function Nr({onClick:e,pressed:t,compact:s,grow:r,disabled:a=!1,tooltip:o,children:i}){const l=t!==void 0,c=n.jsx("button",{type:"button","aria-pressed":t,"aria-disabled":a,onClick:d=>{d.stopPropagation(),a||e()},className:j("flex items-center gap-2 rounded-lg border text-[13px] font-medium text-text shadow-lg",s?"px-3 py-1.5":"px-4 py-2",r&&"flex-1 justify-center","transition-colors",!l&&"border-white/40 hover:bg-white/10",l&&!a&&"hover:border-green hover:text-green",a&&"cursor-not-allowed opacity-40",l&&(t?"border-white/80":"border-white/40")),style:{backgroundColor:t?jA:uc},children:i});return o?n.jsx(Ne,{label:o,side:"top",className:"z-[250]",children:c}):c}function gS({view:e,mention:t,cardName:s}){return e==="video"?n.jsx(_A,{mention:t}):n.jsx(cee,{mention:t,cardName:s},s)}function _A({mention:e}){const t=p.useRef(null),[s]=p.useState(e),r=p.useRef(e),a=p.useRef(!1),o=(l,c=[])=>{var d,u;return(u=(d=t.current)==null?void 0:d.contentWindow)==null?void 0:u.postMessage(JSON.stringify({event:"command",func:l,args:c}),"https://www.youtube.com")};p.useEffect(()=>{const l=()=>{var u,f;return(f=(u=t.current)==null?void 0:u.contentWindow)==null?void 0:f.postMessage(JSON.stringify({event:"listening",id:1,channel:"widget"}),"https://www.youtube.com")},c=[500,1200,2500].map(u=>window.setTimeout(l,u)),d=u=>{var f,h;if(!(u.origin!=="https://www.youtube.com"||u.source!==((f=t.current)==null?void 0:f.contentWindow)))try{const m=JSON.parse(u.data);m.event==="infoDelivery"&&typeof((h=m.info)==null?void 0:h.playerState)=="number"&&(a.current=m.info.playerState===1||m.info.playerState===3)}catch{return}};return window.addEventListener("message",d),()=>{c.forEach(window.clearTimeout),window.removeEventListener("message",d)}},[s]),p.useEffect(()=>{const l=r.current;if(r.current=e,l.youtubeId===e.youtubeId&&l.t===e.t)return;const c={videoId:e.youtubeId,startSeconds:e.t};a.current?l.youtubeId===e.youtubeId?o("seekTo",[e.t,!0]):o("loadVideoById",[c]):o("cueVideoById",[c])},[e]);const i=`start=${s.t}&autoplay=1&playsinline=1&rel=0&cc_load_policy=0&enablejsapi=1`;return n.jsx("div",{className:"relative aspect-video w-full shrink-0 overflow-hidden rounded-lg bg-black",children:n.jsx("iframe",{ref:t,src:`https://www.youtube.com/embed/${s.youtubeId}?${i}`,title:s.title,className:"absolute inset-0 h-full w-full",allow:"autoplay; encrypted-media; picture-in-picture; fullscreen",allowFullScreen:!0})})}function cee({mention:e,cardName:t}){const{transcript:s}=PR(e.youtubeId);if(!s)return n.jsx("div",{className:"h-24 shrink-0 animate-pulse rounded bg-white/5"});const r=ZV(s,e.segmentIndex,t),a=qX(s.slice(0,e.segmentIndex),r);return n.jsx("div",{className:"min-h-0 space-y-3 overflow-y-auto pr-1 text-[14px] leading-snug text-text",children:a.map((o,i)=>n.jsx("div",{className:j("space-y-2 border-l-2 pl-3",wd[o.lane].border),children:o.paragraphs.map((l,c)=>n.jsx("p",{children:l},c))},i))})}function dee({front:e,back:t,name:s,flipped:r}){const{loaded:a,instant:o,onLoad:i}=xA(e);return n.jsx("div",{className:"w-full [perspective:1200px]",children:n.jsxs("div",{className:"relative w-full transition-transform duration-700 [transform-style:preserve-3d] [-webkit-transform-style:preserve-3d]",style:{aspectRatio:"28 / 39",transform:r?"rotateY(180deg)":void 0},children:[!a&&n.jsx("div",{className:j("absolute inset-0 animate-pulse bg-surface2 [backface-visibility:hidden]",$h)}),n.jsx("img",{src:e,alt:s,decoding:"async",onLoad:i,onError:i,className:j("absolute inset-0 h-full w-full object-cover [backface-visibility:hidden] [-webkit-backface-visibility:hidden]",!o&&"transition-opacity duration-300",$h,V1,a?"opacity-100":"opacity-0")}),n.jsx("img",{src:t,alt:"",decoding:"async",className:j("absolute inset-0 h-full w-full object-cover [backface-visibility:hidden] [-webkit-backface-visibility:hidden] [transform:rotateY(180deg)]",$h,V1)})]})})}const $h="rounded-[4.5%/3.2%]",V1="outline outline-1 -outline-offset-1 outline-white/10";function TA({src:e,alt:t,onShown:s}){const[r,a]=p.useState(()=>[{key:0,src:e}]),o=p.useRef(0);p.useEffect(()=>{a(l=>l[l.length-1].src===e?l:(o.current+=1,[...l,{key:o.current,src:e}]))},[e]);const i=(l,c)=>{a(d=>{const u=d.findIndex(f=>f.key===l);return u<=0?d:d.slice(u)}),c===e&&(s==null||s())};return n.jsx("div",{className:j("relative w-full overflow-hidden",$h,V1),style:{aspectRatio:"488 / 680"},children:r.map((l,c)=>
505n.jsx(uee,{src:l.src,alt:t,base:c===0,onSettled:()=>i(l.key,l.src)},l.key))})}function uee({src:e,alt:t,base:s,onSettled:r}){const a=p.useRef(null),o=p.useRef(r);o.current=r;const[i,l]=p.useState(!1),[c,d]=p.useState(!1);p.useLayoutEffect(()=>{const f=GX(e);if(l(f),d(f),f){const h=a.current,m=()=>o.current();h?h.decode().then(m,m):m()}},[e,s]);const u=()=>{VX(e),l(!0)};return n.jsxs(n.Fragment,{children:[s&&!i&&n.jsx("div",{className:"absolute inset-0 animate-pulse bg-surface2"}),n.jsx("img",{ref:a,src:e,alt:t,decoding:"async",onLoad:u,onError:u,onAnimationEnd:()=>o.current(),className:j("absolute inset-0 h-full w-full object-cover",!i&&"opacity-0",i&&c&&"opacity-100",i&&!c&&"animate-fadeIn")})]})}const Ws={Premier:"#2ee85c",Trad:"#5c8aff",Quick:"#ffc63a",Sealed:"#ff5d8c",Direct:"#ff5d8c",LCQ:"#ff7700","LCQ Draft 1":"#ff7700","LCQ Draft 2":"#ff7700",Pod:"#a86bff",MTGO:"#e8503a",MTGA:"#e8503a",Paper:"#a9744f"},Ti="#5c8aff",fee={PremierDraft:"PREMIER",ContenderDraft:"CONTENDER",TradDraft:"TRAD",QuickDraft:"QUICK",Sealed:"SEALED",TradSealed:"TRAD SEALED",ArenaDirect_Sealed:"DIRECT",QualifierPlayInSealed:"PLAY-IN",QualifierPlayInTradSealed:"PLAY-IN BO3",Qualifier_D1_Sealed:"QUAL DAY 1",Qualifier_D2_Sealed:"QUAL DAY 2",PickTwoDraft:"PICK 2",Emblem_QuickDraft:"QUICK",LimitedChampionshipQualifier_Draft1:"LCQ D1",LimitedChampionshipQualifier_Draft2:"LCQ D2","LCQ Draft 1":"LCQ D1","LCQ Draft 2":"LCQ D2",Premier:"PREMIER",Trad:"TRAD",Quick:"QUICK",LCQ:"LCQ",Pod:"POD",PodDraft:"POD","Trad Sealed":"TRAD SEALED","Arena Direct":"ARENA DIR"};function ca(e){return fee[e]??e.replace(/_/g," ").toUpperCase()}const Ss=e=>{if(e.value==="ALL")return n.jsx("span",{children:e.label});const t=Ws[e.value]??Ti;return n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"h-2 w-2 shrink-0",style:{background:t}}),n.jsx("span",{children:e.label})]})},hr=e=>e.value==="ALL"?n.jsx("span",{children:e.label}):e.value===it?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(ia,{size:12,"aria-hidden":"true"}),n.jsx("span",{children:e.label})]}):e.value===kt?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(uo,{size:11,"aria-hidden":"true"}),n.jsx("span",{children:e.label})]}):n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Be,{colors:e.value,size:12}),n.jsx("span",{children:e.label})]});function hee(){var a;const{data:e}=un(),t=((a=e==null?void 0:e.find(o=>o.isActive))==null?void 0:a.code)??_s,{data:s,isLoading:r}=UZ();return n.jsx($c,{subtitle:"HOME",fill:!0,sponsorVariant:"color",children:n.jsxs("div",{className:j("p-4 lg:p-5 grid gap-4 grid-cols-1 lg:h-full","lg:grid-cols-[minmax(300px,360px)_minmax(0,1fr)_clamp(300px,22vw,340px)] lg:[grid-template-rows:minmax(0,1fr)]"),children:[n.jsxs("div",{className:"contents lg:flex lg:flex-col lg:gap-4 lg:min-h-0 lg:h-full",children:[n.jsx(pee,{}),n.jsx(xee,{})]}),n.jsx(vee,{episodes:(s==null?void 0:s.filter(o=>!o.isShort).slice(0,4))??[],loading:r,thumbnailsPending:!1}),n.jsxs("div",{className:"contents lg:flex lg:flex-col lg:gap-4 lg:min-h-0 lg:h-full",children:[n.jsx(jee,{setCode:t}),n.jsx(Ree,{setCode:t})]})]})})}function Qm({title:e,to:t,corner:s,headerCenter:r,action:a,actionBorder:o=!1,headerBorder:i=!1,linkBody:l=!1,dense:c=!1,className:d,bodyClassName:u,children:f}){return n.jsxs("section",{className:j("group bg-surface border border-border rounded-xl flex flex-col min-h-0",c?"p-3":"p-4",l&&"relative",d),children:[l?n.jsx(te,{to:t,"aria-label":a??e,className:"peer/cta absolute inset-0 z-0 rounded-xl transition-colors hover:bg-green/[0.03]"}):null,n.jsxs("div",{className:j("flex items-center gap-3 shrink-0",i?"-mx-4 px-4 pb-3 border-b border-border":c?"mb-2":"mb-3"),children:[n.jsx(te,{to:t,className:"font-display text-text text-[20px] tracking-[0.05em] no-underline hover:text-green transition-colors shrink-0 whitespace-nowrap",children:e}),n.jsx("div",{className:"flex-1 min-w-0 flex justify-center",children:r}),typeof s=="string"?n.jsx("span",{className:"font-mono text-[10px] tracking-[0.16em] text-muted uppercase shrink-0",children:s}):s??null]}),n.jsx("div",{className:j("flex-1 min-h-0 flex flex-col",u),children:f}),a?n.jsxs(te,{to:t,className:j("relative z-0 shrink-0 flex items-center justify-end gap-1.5 rounded-b-xl font-display tracking-[0.08em] text-[15px] text-green no-underline transition-colors hover:bg-green/5 hover:text-green-2",c?"-mx-3 -mb-3 w-[calc(100%+1.5rem)] px-3 py-2":"-mx-4 -mb-4 w-[calc(100%+2rem)] px-4 py-2.5",l&&"peer-hover/cta:bg-green/5 peer-hover/cta:text-green-2",o&&"border-t border-border"),children:[a," ",n.jsx(Jt,{size:15})]}):null]})}function pee(){const e=[{label:"YouTube",tooltip:"Watch on YouTube",url:Zt.youtube,Icon:Gm},{label:"Twitch",tooltip:"Stream on Twitch",url:Zt.twitch,Icon:XR},{label:"Patreon",tooltip:"Support on Patreon",url:Zt.patreon,Icon:Av},{label:"TCGplayer",tooltip:"Sponsored by TCGplayer",url:Zt.tcgplayer,logo:"/sponsors/tcgplayer-horizontal.png",sponsored:!0}],t=["Weekly episodes","Set review tier lists","Strategy discussion","Community events"],[s,r]=p.useState(mee),a=()=>{r(o=>{const i=!o;return window.localStorage.setItem(EA,i?"1":"0"),i})};return n.jsxs("section",{className:"order-1 lg:order-none bg-surface border border-border rounded-xl p-4 flex flex-col gap-3 shrink-0",children:[n.jsx("h2",{className:"font-display text-text text-[20px] tracking-[0.05em]",children:n.jsxs("button",{type:"button",onClick:a,"aria-expanded":s,"aria-label":s?"Collapse about the community":"Expand about the community",className:"flex w-full items-center justify-between gap-3 text-left",children:["About the Community",n.jsx(Et,{size:22,className:j("shrink-0 text-muted transition-transform",!s&&"-rotate-90")})]})}),n.jsxs("div",{className:j("flex flex-col gap-3",!s&&"hidden"),children:[n.jsxs("p",{className:"text-subtle text-[13px] leading-[1.5] text-center",children:["Everything you need to get better at ",n.jsx("span",{className:"text-green",children:"Limited Magic"})]}),n.jsx("ul",{className:"grid grid-cols-[auto_auto] gap-x-6 gap-y-1.5 
505self-center",children:t.map(o=>n.jsxs("li",{className:"flex items-center gap-2.5 text-subtle text-[13px] leading-tight",children:[n.jsx("span",{className:"w-[5px] h-[5px] shrink-0 bg-green rotate-45"}),o]},o))}),n.jsxs("p",{className:"text-subtle text-[13px] leading-[1.5] text-center",children:["Join the ",n.jsx("span",{className:"text-green",children:"Discord"})," to connect with other Limited players, draft with us and climb the leaderboard!"]}),n.jsx(Iv,{label:"JOIN THE DISCHORD",href:Zt.discord,target:"_blank",grow:!0,className:"self-center mt-0.5",icon:n.jsx("span",{className:"inline-flex items-center justify-center w-[22px] h-[22px] rounded-full bg-bg text-white shrink-0",children:n.jsx(la,{size:14})})}),n.jsxs("p",{className:"font-mono text-[12px] tracking-[0.04em] text-subtle text-center",children:["Hosted by ",og.name," ",n.jsxs("a",{href:`https://x.com/${og.handle}`,target:"_blank",rel:"noreferrer",className:"text-subtle italic no-underline hover:text-green transition-colors",children:["@",og.handle]})]}),n.jsx("div",{className:"grid grid-cols-2 gap-2",children:e.map(({label:o,tooltip:i,url:l,Icon:c,logo:d,sponsored:u})=>n.jsx(Ne,{label:n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[i,n.jsx(en,{size:12})]}),side:"bottom",children:n.jsx("a",{href:l,target:"_blank",rel:u?"sponsored noreferrer":"noreferrer","aria-label":i,className:"font-display uppercase text-[15px] tracking-[0.1em] flex items-center justify-center gap-2 bg-surface2 py-2 text-subtle no-underline hover:bg-border hover:text-green transition-colors",style:{clipPath:Uc},children:d?n.jsx(M6,{className:"h-[15px]"}):n.jsxs(n.Fragment,{children:[c?n.jsx(c,{className:"text-[15px]"}):null,o]})})},o))})]})]})}const EA="llu:community-about-open";function mee(){return typeof window>"u"?!0:window.localStorage.getItem(EA)!=="0"}const bS=5;function xee(){var v;const{data:e}=un(),t=p.useMemo(()=>oA(e),[e]),[s,r]=p.useState(),a=s??((v=t[0])==null?void 0:v.code)??_s,o=t.find(k=>k.code===a),{graders:i,effectiveUid:l}=Fv(a),{data:c}=Zm(l,i),d=p.useMemo(()=>$ee(c==null?void 0:c.filter(k=>k.inclusion_type==="Main Set")),[c]),u=p.useMemo(()=>d.flatMap(k=>k.cards).sort(yA),[d]),[f,h]=p.useState(null),[m,y]=p.useState(null),b=u.findIndex(k=>k.card_id===m),w=b>=0?u[b]:null,x=(k,S)=>{h({card:S,anchor:uf(k)})},g=n.jsx(ku,{sets:t,activeCode:a,glyphCode:o?Qt(o):a,label:a,isMobile:!1,compact:!0,triggerClassName:"w-[92px]",openOnHover:!0,loading:!e,onChange:r});return n.jsxs(Qm,{title:"SET REVIEW",to:`/tier-list/${a}`,corner:g,action:"Full Tier List Review",dense:!0,className:"order-3 lg:order-none flex-1",children:[d.length?n.jsx("div",{className:"-mx-3 flex-1 min-h-0 flex flex-col border-y border-border",children:d.map(k=>n.jsx(bee,{row:k,onPreview:x,onLeave:()=>h(null),onSelect:S=>{h(null),y(S.card_id)}},k.letter))}):n.jsx(Zv,{lines:4}),f?It.createPortal(n.jsx(CA,{card:f.card,anchor:f.anchor}),document.body):null,w?It.createPortal(n.jsx(Kv,{card:w,onClose:()=>y(null),onPrev:b>0?()=>y(u[b-1].card_id):void 0,onNext:b<u.length-1?()=>y(u[b+1].card_id):void 0,position:`${b+1} / ${u.length}`,neighborUrls:Vv(u,b)}),document.body):null]})}const gee="745 / 1040";function bee({row:e,onPreview:t,onLeave:s,onSelect:r}){const a=p.useRef(null),[o,i]=p.useState({left:!1,right:!1}),l=()=>{const d=a.current;if(!d)return;const u=d.scrollWidth-d.clientWidth;i({left:d.scrollLeft>1,right:d.scrollLeft<u-1})};p.useEffect(()=>{const d=a.current;if(!d)return;l();const u=new ResizeObserver(l);return u.observe(d),()=>u.disconnect()},[e.cards.length]);const c=d=>{const u=a.current;if(!u)return;const f=u.querySelector("[data-card]"),h=f?f.offsetWidth:u.clientWidth/bS;u.scrollBy({left:h*bS*d,behavior:"smooth"})};return n.jsxs("div",{className:"group/row relative h-[84px] lg:h-auto lg:flex-1 min-h-0 flex items-stretch border-t border-border first:border-t-0",children:[n.jsx("span",{className:"font-display w-10 shrink-0 flex items-center justify-center text-[17px] text-text bg-[#0e1218] border-r border-border",style:{borderLeft:`5px solid ${e.color}`},children:e.letter}),n.jsx("div",{ref:a,onScroll:l,className:"flex-1 min-h-0 overflow-x-auto no-scrollbar flex items-center scroll-smooth py-0.5",children:n.jsx("div",{className:"flex h-full items-center w-max shrink-0",children:e.cards.map(d=>n.jsx("div",{"data-card":!0,className:"h-full shrink-0 pr-1.5 flex items-center",children:n.jsx(yee,{card:d,rootRef:a,onPreview:t,onLeave:s,onSelect:r})},d.card_id))})}),n.jsx(yS,{direction:-1,show:o.left,onClick:()=>c(-1)}),n.jsx(yS,{direction:1,show:o.right,onClick:()=>c(1)})]})}function yS({direction:e,show:t,onClick:s}){const r=e===1?co:lo;return n.jsx("button",{type:"button",onClick:s,"aria-label":e===1?"Show later cards":"Show earlier cards",className:j("absolute inset-y-0 z-10 flex w-12 items-center px-1.5 transition-opacity",e===1?"right-0 justify-end bg-gradient-to-l"
505:"left-10 justify-start bg-gradient-to-r","from-bg/90 to-transparent",t?"opacity-100":"pointer-events-none opacity-0"),children:n.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full border border-border2 bg-surface2/90 text-text transition-colors hover:border-green hover:text-green",children:n.jsx(r,{size:14})})})}function yee({card:e,rootRef:t,onPreview:s,onLeave:r,onSelect:a}){const o=p.useRef(null),[i,l]=p.useState(!1);return p.useEffect(()=>{if(i)return;const c=o.current;if(!c)return;const d=new IntersectionObserver(u=>{u.some(f=>f.isIntersecting)&&(l(!0),d.disconnect())},{root:t.current,rootMargin:"0px 300px"});return d.observe(c),()=>d.disconnect()},[i,t]),n.jsx("img",{ref:o,src:i?e.url:void 0,alt:e.name,decoding:"async",onMouseEnter:c=>s(c.currentTarget,e),onMouseLeave:r,onClick:()=>a(e),className:"h-full w-auto rounded-[2px] border border-black bg-surface2 cursor-pointer",style:{aspectRatio:gee}})}function vee({episodes:e,loading:t,thumbnailsPending:s}){return n.jsx(Qm,{title:"LATEST CONTENT",to:"/episodes",corner:n.jsxs(te,{to:"/episodes",className:"shrink-0 flex items-center gap-1.5 font-display tracking-[0.08em] text-[15px] text-green no-underline transition-colors hover:text-green-2",children:["View All Episodes ",n.jsx(Jt,{size:15})]}),className:"order-2 lg:order-none lg:h-full",children:t?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"lg:hidden flex flex-col gap-4",children:[n.jsx("div",{className:"aspect-video bg-surface2 border border-border rounded-lg animate-pulse"}),n.jsx("div",{className:"grid grid-cols-2 gap-4",children:Array.from({length:2}).map((r,a)=>n.jsx("div",{className:"aspect-video bg-surface2 border border-border rounded-lg animate-pulse"},a))})]}),n.jsx("div",{className:"hidden lg:grid grid-cols-1 xl:grid-cols-2 gap-4 flex-1 min-h-0",children:Array.from({length:4}).map((r,a)=>n.jsx("div",{className:j("bg-surface2 border border-border rounded-lg animate-pulse",a>=2&&"hidden xl:block")},a))})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"lg:hidden flex flex-col gap-4",children:[e[0]?n.jsx(pg,{episode:e[0],thumbnailPending:s}):null,e.length>1?n.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.slice(1,3).map(r=>n.jsx(pg,{episode:r,compact:!0,thumbnailPending:s},r.id))}):null]}),n.jsx("div",{className:"hidden lg:grid grid-cols-1 xl:grid-cols-2 gap-4 flex-1 min-h-0",children:e.map((r,a)=>n.jsx(pg,{episode:r,thumbnailPending:s,className:a>=2?"hidden xl:flex":void 0},r.id))})]})})}const vS=e=>e.split("|")[0].trim();function pg({episode:e,className:t,compact:s=!1,thumbnailPending:r=!1}){const{canPlayAudio:a}=z6(e),o=e.slug?`/episodes/${En(e.category)}/${e.slug}`:null,i=n.jsxs(n.Fragment,{children:[n.jsx(ki,{src:e.image,pending:r,className:"transition-transform duration-300 group-hover/ep:scale-[1.07]"}),s?null:n.jsx("span",{className:"absolute bottom-2 left-2 text-[10px] font-medium text-white bg-black/60 rounded px-1.5 py-0.5",children:Y7(e.pubDate)}),!s&&e.durationLabel?n.jsx("span",{className:"absolute bottom-2 right-2 text-[10px] font-medium text-white bg-black/60 rounded px-1.5 py-0.5",children:e.durationLabel}):null,n.jsx("span",{className:"absolute inset-0 flex items-center justify-center bg-bg/30 opacity-0 transition-opacity group-hover/ep:opacity-100",children:n.jsx($v,{children:a?n.jsx(r6,{size:28}):n.jsx(lc,{size:32})})})]});return n.jsxs("div",{className:j("group/ep flex flex-col min-h-0 border border-border rounded-lg overflow-hidden bg-surface2 transition-[border-color,box-shadow] duration-150 hover:border-green hover:shadow-[0_0_8px_1px_rgba(46,232,92,0.32)]",t),children:[n.jsx("div",{className:"relative z-10 aspect-video lg:aspect-auto lg:flex-1 lg:min-h-0 overflow-hidden bg-surface",children:o?n.jsx(te,{to:o,"aria-label":e.title,className:"absolute inset-0 block w-full",children:i}):n.jsx("a",{href:e.link,target:"_blank",rel:"noreferrer",className:"absolute inset-0 block w-full",children:i})}),s?n.jsxs("div",{className:"shrink-0 flex items-center justify-between gap-1.5 pl-2",children:[n.jsxs("span",{className:"flex flex-1 min-w-0 gap-x-2 text-[10px] font-medium text-white truncate",children:[n.jsx("span",{children:Q7(e.pubDate)}),e.durationSeconds?n.jsx("span",{children:qV(e.durationSeconds)}):null]}),n.jsx(eo,{episode:e,glyphSize:14,className:"gap-1"})]}):o?n.jsxs(te,{to:o,className:"p-3 shrink-0 flex items-start justify-between gap-2 no-underline group-hover/ep:text-green",children:[n.jsx("h3",{className:"flex-1 min-w-0 font-body text-text text-[16px] font-medium leading-snug line-clamp-2 transition-colors group-hover/ep:text-green",children:vS(e.title)}),n.jsx(eo,{episode:e,className:"mt-0.5"})]}):n.jsxs("a",{href:e.link,target:"_blank",rel:"noreferrer",className:"p-3 shrink-0 flex items-start justify-between gap-2 no-underline group-hover/ep:text-green",children:[n.jsx("h3",{className:"flex-1 min-w-0 font-body text-text text-[16px] font-medium leading-snug line-clamp-2 transition-colors group-hover/ep:text-green",children:vS(e.title)}),n.jsx(eo,{episode:e,className:"mt-0.5"})]})]})}const qv=28,wee=5e3;function jee({setCode:e}){const{data:t}=un(),s=p.useMemo(()=>Eee(t),[t]),[r,a]=p.useState(),o=r??e,i=s.find(I=>I.code===o),{data:l}=Wm(o),c=p.useMemo(()=>Tee(l),[l]),[d,u]=p.useState(0),[f,h]=p.useState(null),m=p.useRef(!1),y=p.useRef(!1);p.useEffect(()=>{if(c.length<=1)return;const I=setInterval(()=>{!m.current&&!y.current&&u(q=>q+1)},wee);return()=>clearInterval(I)},[c.length]),p.useEffect(()=>{h(null),y.current=!1,u(0)},[o]);const b=I=>{y.current=!0,h(I)},w=f??c[d%c.length]??"ALL",x=w==="ALL",g=Tv(x?o:void 0),v=LR(x?void 0:o,x?void 0:w),k=x?g.data:v.data,S=p.useRef(null),[N,C]=p.useState(7);p.useLayoutEffect(()=>{const I=S.current;if(!I)return;const q=()=>C(Math.max(3,Math.floor(I.clientHeight/qv))),O=new ResizeObserver(q);return O.observe(I),q(),()=>O.disconnect()},[]);const _=`${o}-${w}
505`,T=(k==null?void 0:k.slice(0,N))??[],E=Su(w),A=x?kn(o):`${kn(o)}?format=${encodeURIComponent(w)}`,[P,M]=p.useState(()=>({front:{key:_,setCode:o,mode:E,rows:T},back:null})),U=p.useRef(_);p.useEffect(()=>{if(T.length===0)return;const I={key:_,setCode:o,mode:E,rows:T},q=U.current!==_;if(U.current=_,M(O=>({front:I,back:q?O.front:O.back})),q){const O=setTimeout(()=>M(H=>({...H,back:null})),240);return()=>clearTimeout(O)}},[_,k,N]);const F=n.jsx(ku,{sets:s,activeCode:o,glyphCode:i?Qt(i):o,label:o,isMobile:!1,compact:!0,align:"right",triggerClassName:"w-[92px]",loading:!t,onChange:a});return n.jsx(Qm,{title:"LEADERBOARD",to:A,corner:n.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[F,n.jsx(See,{formats:c,current:w,onPick:b})]}),action:"View Full leaderboard",actionBorder:!0,headerBorder:!0,className:"order-4 lg:order-none flex-1",children:n.jsx("div",{ref:S,className:"relative -mx-4 min-h-0 overflow-hidden h-[224px] lg:h-auto lg:flex-1",onMouseEnter:()=>m.current=!0,onMouseLeave:()=>m.current=!1,children:P.front.rows.length===0&&!P.back?n.jsx(Zv,{lines:5}):n.jsxs(n.Fragment,{children:[P.back?n.jsxs("div",{className:"absolute inset-0 flex h-full flex-col animate-fadeOut",children:[P.back.rows.map(I=>n.jsx(wS,{row:I,setCode:P.back.setCode,mode:P.back.mode},I.slug)),jS(N-P.back.rows.length).map(I=>n.jsx(kS,{},I))]},P.back.key):null,n.jsxs("div",{className:"absolute inset-0 flex h-full flex-col animate-fadeIn",children:[P.front.rows.map(I=>n.jsx(wS,{row:I,setCode:P.front.setCode,mode:P.front.mode},I.slug)),jS(N-P.front.rows.length).map(I=>n.jsx(kS,{},I))]},P.front.key)]})})})}const kee=e=>Ws[e]??"#5c8aff";function See({formats:e,current:t,onPick:s}){const[r,a]=p.useState(!1),o=p.useRef(null);return p.useEffect(()=>{if(!r)return;const i=c=>{var d;(d=o.current)!=null&&d.contains(c.target)||a(!1)},l=c=>{c.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",i),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",l)}},[r]),n.jsxs("div",{ref:o,className:"relative",children:[n.jsxs("button",{type:"button",onClick:()=>a(i=>!i),"aria-expanded":r,className:j("relative flex h-7 w-[92px] items-center justify-center border px-2 font-display tracking-[0.06em] text-[18px] leading-none transition-colors",r?"border-green text-green":"border-border2 text-text hover:border-green hover:text-green"),children:[n.jsx("span",{className:"animate-fadeIn truncate",children:ca(t)},t),n.jsx(Et,{size:14,strokeWidth:2.5,className:j("absolute right-1.5 transition-transform",r&&"rotate-180")})]}),r?n.jsx("div",{className:"absolute right-0 top-[calc(100%+6px)] z-30 w-max overflow-hidden border border-border2 bg-surface shadow-xl",children:e.map(i=>n.jsxs("button",{type:"button",onClick:()=>{s(i),a(!1)},className:j("flex w-full items-center gap-2.5 border-l-2 px-3.5 py-2 text-left font-display tracking-[0.06em] text-[15px] uppercase transition-colors",i===t?"border-green bg-surface2 text-green":"border-transparent text-subtle hover:bg-surface2"),children:[i!=="ALL"&&n.jsx("span",{className:"h-2 w-2 shrink-0",style:{background:kee(i)}}),_ee(i)]},i))}):null]})}function wS({row:e,setCode:t,mode:s}){return n.jsxs(te,{to:Gt(e.slug,t),className:"group/row flex flex-1 items-center gap-2.5 px-4 border-t border-border no-underline text-text transition-colors first:border-t-0 hover:bg-surface2",style:{minHeight:qv},children:[n.jsx("span",{className:"font-num w-5 shrink-0 text-center text-[12px] text-muted",children:e.rank}),n.jsx(as,{displayName:e.displayName,avatarUrl:e.avatarUrl,size:22}),n.jsx("span",{className:"truncate font-display text-[15px] leading-none tracking-[0.04em] transition-colors group-hover/row:text-green",children:e.displayName.toUpperCase()}),n.jsx(Nee,{row:e,mode:s})]})}function Nee({row:e,mode:t}){if(t==="direct"){const s=e.boxes??0;return n.jsxs("span",{className:"ml-auto flex items-center gap-1 font-display text-[15px] leading-none tracking-[0.02em] tabular-nums",children:[n.jsx("span",{className:"text-[11px]","aria-hidden":"true",children:"📦"}),n.jsx("span",{className:s===0?"text-dim":"text-text",children:s})]})}if(t==="lcq"){const s=e.earnings??0;return n.jsx("span",{className:"ml-auto font-display text-[15px] leading-none tracking-[0.02em] tabular-nums text-green",children:s>0?`$${s/1e3}K`:"—"})}return n.jsx("span",{className:"ml-auto font-display text-[15px] leading-none tracking-[0.02em] tabular-nums text-green",children:Number.isFinite(e.score)?ea(e.score):"—"})}function jS(e){return Array.from({length:Math.max(0,e)},(t,s)=>`empty-${s}`)}function kS(){return n.jsx("div",{className:"flex flex-1 items-center border-t border-border first:border-t-0",style:{minHeight:qv},"aria-hidden":!0})}const Cee=new Map(Tn.map(e=>[e.value,e.label]));function _ee(e){return Cee.get(e)??ca(e)}function Tee(e){const t=new Set(e??[]),s=Tn.map(a=>a.value).filter(a=>a==="ALL"||t.has(a)),r=(e??[]).filter(a=>!s.includes(a));return[...s,...r]}function Eee(e){return[...e??[]].sort((t,s)=>s.startDate.localeCompare(t.startDate))}function Ree({setCode:e}){const{data:t}=un(),s=t==null?void 0:t.find(i=>i.code===e),{data:r}=af(e),a=p.useMemo(()=>Oee(r),[r]),o=n.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[n.jsx(Ae,{code:s?Qt(s):e,size:18}),n.jsx("span",{className:"truncate font-display tracking-[0.06em] text-[17px] text-text",children:e})]});return n.jsx(Qm,{title:"POD DRAFTS",to:"/pods",corner:o,action:"Check Draft Replays",actionBorder:!0,headerBorder:!0,className:"order-5 lg:order-none",children:a.length?n.jsx("div",{className:"flex flex-col -mx-4",children:a.map(i=>n.jsx(Aee,{entry:i},i.event.slug))}):n.jsx(Zv,{lines:3})})}function Aee({entry:e}){var f;const{event:t,upcoming:s}=e,r=(f=t.championDisplayName)==null?void 0:f.replace(/#.*$/,""),a=km(t.name,t.setCode),{month:o,day:i}=Pee(t);let l;s?l=n.jsx("span",{className:"truncate",children:Iee(t)}):r?l=n.jsxs(n.Fragment,{children:[n.jsx(a6,{size:13,strokeWidth:2,className:"text-gold"}),n.jsx("span",{className:"truncate text-[12px] font-bold text-text",children:r}),t.championRecord?n.jsx("span",{className:"shrink-0",children:t.championRecord}):null,t.championDeckColors?n.jsx(Be,{colors:t.championDeckColors,size:11}):null]}):l=n.jsxs("span",{className:"truncate",children:[t.participantCount," drafters"]});const c="group/pod flex items-center gap-2.5 px-4 py-2 border-t border-border first:border-t-0 no-underline transition-colors hover:bg-green/5",d=n.jsxs(n.Fragment,{children:[n.jsx("span",{className:j("flex h-[40px] w-[48px] shrink-0 flex-col items-center justify-center rounded font-display leading-none",s?"border border-green/30 bg-green/10 text-green text-[11px] tracking-[0.12em]":"border border-border bg-surface2"),children:s?"NEXT":n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-[9px] tracking-[0.12em] text-muted",children:o}),n.jsx("span",{className:"mt-0.5 text-[17px] tabular-nums text-text",children:i})]})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-[13px] font-medium text-text truncate",children:Si(a)}),n.jsx("div",{className:"font-mono text-[12px] text-muted flex items-center gap-1.5 min-w-0",children:l})]}),s?n.jsx(Lee,{target:Uh(t)}):n.jsx(Hm,{size:18,className:"shrink-0 text-muted transition-colors group-hover/po
505d:text-green"})]});if(s){const h=Zt.discord;return n.jsx(Ne,{label:"View event on Discord",side:"left",children:n.jsx("a",{href:h,target:"_blank",rel:"noreferrer",className:c,children:d})})}const u=t.championDisplayName?`?player=${encodeURIComponent(t.championDisplayName)}`:"";return n.jsx(Ne,{label:"View seats, logs & replays",side:"left",children:n.jsx(te,{to:`/pods/${t.slug}${u}`,className:c,children:d})})}function Pee(e){const t=e.eventTime||e.eventDate,s=new Date(t.length<=10?`${t}T12:00:00`:t);return{month:s.toLocaleString("en-US",{month:"short"}).toUpperCase(),day:s.getDate()}}function Zv({lines:e}){return n.jsx("div",{className:"flex-1 flex flex-col gap-2",children:Array.from({length:e}).map((t,s)=>n.jsx("div",{className:"h-5 bg-surface2 rounded animate-pulse"},s))})}function Oee(e){if(!(e!=null&&e.length))return[];const t=Date.now(),s=e.filter(o=>!o.isFinalized&&Uh(o)>=t).sort((o,i)=>Uh(o)-Uh(i)),r=e.filter(o=>!s.includes(o)),a=[];s[0]&&a.push({event:s[0],upcoming:!0});for(const o of r){if(a.length>=3)break;a.push({event:o,upcoming:!1})}return a}function Lee({target:e}){const[t,s]=p.useState(()=>Date.now());p.useEffect(()=>{const a=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(a)},[]);const r=e-t;return n.jsx("span",{className:"font-mono shrink-0 rounded border border-border bg-surface2 px-2 py-1 text-[11px] tracking-[0.08em] tabular-nums text-subtle",children:r<=0?"LIVE":Dee(r)})}function Dee(e){const t=Math.floor(e/1e3),s=Math.floor(t/86400),r=o=>String(o).padStart(2,"0"),a=`${r(Math.floor(t%86400/3600))}:${r(Math.floor(t%3600/60))}:${r(t%60)}`;return s>0?`${s}d ${a}`:a}function Uh(e){const t=e.eventTime||e.eventDate;return new Date(t.length<=10?`${t}T12:00:00`:t).getTime()}function Iee(e){const t=e.eventTime||e.eventDate,s=new Date(t.length<=10?`${t}T12:00:00`:t);if(Number.isNaN(s.getTime()))return e.eventDate;const r=!!e.eventTime;return s.toLocaleString("en-US",{month:"short",day:"numeric",...r?{hour:"numeric",minute:"2-digit"}:{}})}const Mee=["A","B","C","D"];function $ee(e){if(!(e!=null&&e.length))return[];const t=new Map(Ci.map((r,a)=>[r,a])),s=[];for(const r of Mee){const a=e.filter(o=>{var i;return((i=o.tier)==null?void 0:i[0])===r&&t.has(o.tier)});a.sort((o,i)=>{const l=(t.get(o.tier)??99)-(t.get(i.tier)??99);return l!==0?l:(o.sort_key??9999)-(i.sort_key??9999)}),a.length&&s.push({letter:r,color:Fs(r),cards:a})}return s}function Uee(e,t=!1){return!t&&e.videoUrl?e.videoUrl:e.link}function zee(e,t=!1){return!t&&e.videoUrl?"Watch on YouTube":"Listen on Libsyn"}function Bee({episode:e,audioMode:t=!1,children:s}){return ut()?n.jsx(n.Fragment,{children:s}):n.jsx(Ne,{label:zee(e,t),side:"top",align:"center",children:s})}function Fee({episode:e,thumbnailPending:t=!1,audioMode:s=!1,detailBase:r="/episodes"}){const a=e.slug?`${r}/${e.slug}`:null,o=Uee(e,s);return n.jsxs("div",{className:"group flex flex-col",children:[n.jsx(U6,{episode:e,thumbnailPending:t,aspect:"aspect-video",audioMode:s,linkTo:a??void 0}),a?n.jsx(te,{to:a,className:"block shrink-0 mt-3 no-underline",children:n.jsx(SS,{episode:e})}):n.jsx(Bee,{episode:e,audioMode:s,children:n.jsx("a",{href:o,target:"_blank",rel:"noreferrer",className:"block shrink-0 mt-3 no-underline",children:n.jsx(SS,{episode:e})})})]})}function RA({episode:e}){return n.jsxs("span",{className:"flex gap-x-3 font-num text-[11px] tracking-[0.06em] text-muted",children:[n.jsx("span",{children:e.publishedLabel.toUpperCase()}),e.number?n.jsxs("span",{children:["EP ",e.number]}):null]})}function SS({episode:e}){return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx(RA,{episode:e}),n.jsx(eo,{episode:e})]}),n.jsx("span",{className:"block font-body text-text text-[15px] md:text-[16px] font-medium leading-snug mt-1.5 line-clamp-2 transition-colors group-hover:text-green sm:min-h-[2.75rem]",children:e.title})]})}function AA({on:e,className:t}){return n.jsx("span",{className:j("relative h-[18px] w-8 shrink-0 rounded-full transition-colors",e?"bg-green":"bg-border2",t),children:n.jsx("span",{className:j("absolute top-[3px] h-3.5 w-3.5 rounded-full bg-white transition-all",e?"left-[15px]":"left-[1px]")})})}function Wee({episode:e,thumbnailPending:t=!1}){return n.jsxs("div",{className:"group flex flex-col",children:[n.jsx(U6,{episode:e,thumbnailPending:t,aspect:"aspect-[9/16]",portrait:!0}),n.jsx("a",{href:e.videoUrl??e.link,target:"_blank",rel:"noreferrer",className:"font-body text-text text-[14px] font-medium leading-snug mt-2 line-clamp-2 no-underline transition-colors group-hover:text-green",children:e.title})]})}function zc({onClick:e,threshold:t=600,compact:s=!1,dimmed:r=!1,bottomClass:a="bottom-4 md:bottom-6",className:o}){const[i,l]=p.useState(!1);return p.useEffect(()=>{const c=()=>l(window.scrollY>t);return c(),window.addEventListener("scroll",c,{passive:!0}),()=>window.removeEventListener("scroll",c)},[t]),n.jsxs("button",{type:"button",onClick:e,"aria-label":"Go to top",className:j("fixed z-30 left-1/2 -translate-x-1/2 inline-flex items-center gap-2 bg-surface border border-border2 text-text font-display tracking-[0.18em] shadow-lg cursor-pointer transition-opacity hover:bg-surface2",a,s?"px-3 py-2 text-[11px]":"px-4 py-2.5 text-[12px]",i?r?"opacity-60 hover:opacity-100":"opacity-100":"opacity-0 pointer-events-none",o),children:[n.jsx(ZY,{size:14}),"TOP"]})}const Hee=32,NS=10,CS=240;function Gee(e,t,s,r){p.useEffect(()=>{const a=()=>window.matchMedia("(max-width: 1023px)").matches;let o=0,i=0,l=!1,c=!1,d=CS,u=0,f=null;const h=()=>{u=0,f!==null&&s(f)},m=g=>{f=g,u||(u=requestAnimationFrame(h))},y=g=>{const v=e?d+g:g;return Math.max(0,Math.min(1,v/d))},b=g=>{c=!1,l=!1,!(!a()||g.touches.length!==1)&&(o=g.touches[0].clientX,i=g.touches[0].clientY,l=e||o<=Hee)},w=g=>{var S;if(!l)return;const v=g.touches[0].clientX-o,k=g.touches[0].clientY-i;if(!c){if(Math.abs(v)<NS&&Math.abs(k)<NS)return;if(Math.abs(k)>=Math.abs(v)){l=!1;return}c=!0,d=((S=r.current)==null?void 0:S.offsetWidth)||CS}g.preventDefault(),m(y(v))},x=g=>{if(u&&(cancelAnimationFrame(u),u=0),!l||!c){l=!1;return}l=!1;const v=y(g.changedTouches[0].clientX-o);s(null),t(v>.5)};return window.addEventListener("touchstart",b,{passive:!0}),window.addEventListener("touchmove",w,{passive:!1}),window.addEventListener("touchend",x,{passive:!0}),()=>{window.removeEventListener("touchstart",b),window.removeEventListener("touchmove",w),window.removeEventListener("touchend",x),u&&cancelAnimationFrame(u)}},[e,t,s,r])}function Vee({open:e,onOpenChange:t,closeLabel:s,className:r,children:a}){const[o,i]=p.useState(null),l=p.useRef(null);return Gee(e,t,i,l),n.jsxs("div",{className:j("lg:hidden fixed inset-0 z-30",e||o!==null?"":"pointer-events-none"),children:[n.jsx("button",{type:"button","aria-label":s,onClick:()=>t(!1),style:o!==null?{opacity:o}:void 0,className:j("absolute inset-0 w-full bg-bg/70 transition-opacity duration-300",o!==null&&"transition-none",e?"opacity-100":"opacity-0 pointer-events-none")}),n.jsx("div",{ref:l,style:o!==null?{transform:`translateX(${(o-1)*100}
505%)`}:void 0,className:j("absolute inset-y-0 left-0 w-[240px] max-w-[72vw] overflow-y-auto bg-surface border-r border-border","transition-transform duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]",o!==null&&"transition-none",e?"translate-x-0":"-translate-x-full",r),children:a})]})}function PA({icon:e,label:t,iconSize:s=22}){return n.jsxs("div",{className:"flex h-[60px] items-center gap-2.5 border-b border-border px-4",children:[n.jsx(e,{size:s,className:"shrink-0 text-green"}),n.jsx("span",{className:"font-display text-[25px] leading-none tracking-[0.12em] text-text",children:t})]})}function $o({label:e,icon:t,active:s,count:r,collapsed:a=!1,href:o,onClick:i}){const l=j("group relative flex w-full items-center text-left no-underline transition-colors",a?"justify-center py-3.5":"gap-3 px-4 py-3.5",s?"bg-surface2":"hover:bg-bg/40"),c=n.jsxs(n.Fragment,{children:[n.jsx("span",{className:j("absolute left-0 top-0 h-full w-[3px] origin-center bg-green transition-all duration-200",s?"opacity-100":"opacity-0 scale-y-50 group-hover:opacity-100 group-hover:scale-y-100")}),n.jsx(t,{size:18,strokeWidth:2,className:j("shrink-0 transition-colors",s?"text-green":"text-muted group-hover:text-green")}),a?null:n.jsxs(n.Fragment,{children:[n.jsx("span",{className:j("flex-1 font-display uppercase tracking-[0.08em] text-[16px] transition-colors",s?"text-green":"text-text group-hover:text-green"),children:e}),r===void 0?null:n.jsx("span",{className:j("font-num text-[13px] tabular-nums transition-colors",s?"text-green":"text-muted group-hover:text-green"),children:r||"–"})]})]}),d=o?n.jsx("a",{href:o,onClick:i,"aria-label":a?e:void 0,className:l,children:c}):n.jsx("button",{type:"button",onClick:i,"aria-label":a?e:void 0,className:l,children:c});if(a){const u=r===void 0?e:`${e} (${r||"–"})`;return n.jsx(Ne,{label:u,side:"right",children:d})}return d}const Kee=220;function OA({transitionKey:e,children:t}){const[s,r]=p.useState({key:e,content:t}),[a,o]=p.useState(null),i=p.useRef();return p.useEffect(()=>{if(e===s.key){r({key:e,content:t});return}clearTimeout(i.current),o(s),r({key:e,content:t}),i.current=setTimeout(()=>o(null),Kee)},[e,t,s.key]),p.useEffect(()=>()=>clearTimeout(i.current),[]),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"animate-fadeIn",children:s.content},s.key),a?n.jsx("div",{className:"animate-fadeOut absolute inset-x-0 top-0 pointer-events-none",children:a.content},a.key):null]})}const _S="".split(",").map(e=>e.trim()).filter(Boolean),qee={Noya:"237762740532412416",GatoDelFuego:"178987550780817408",ChordOCalls:"507301384979349526"},Zee=Object.values(qee),Yee=_S.length>0?_S:Zee;function LA(e){return!!e&&Yee.includes(e)}const TS="".split(",").map(e=>e.trim()).filter(Boolean),Qee={Noya:"237762740532412416",ChordOCalls:"507301384979349526"},Jee=Object.values(Qee),Xee=TS.length>0?TS:Jee;function ete(e){return!!e&&Xee.includes(e)}const mg={};async function tte(e,t){var i;const s=((mg==null?void 0:mg.VITE_DATA_MODE)??"prod").toLowerCase(),r={"Content-Type":"application/json"};let a;if(s==="local"||lJ)a=nv.replace(/\/$/,"");else{if(a=vE.replace(/\/$/,""),!$t)throw new Error("Not authenticated");const{data:l}=await $t.auth.getSession(),c=(i=l.session)==null?void 0:i.access_token;if(!c)throw new Error("Not authenticated");r.Authorization=`Bearer ${c}`}const o=await fetch(`${a}${e}`,{method:"POST",headers:r,body:JSON.stringify(t)});if(!o.ok)throw new Error(await nte(o));return o.json()}async function ste(e,t){return(await tte(`/episodes/${encodeURIComponent(e)}/transcript`,t)).segments??t}async function nte(e){if(e.status===401||e.status===403)return"Not Authorized";if(e.status===404)return"Transcript Not Found";try{const t=await e.json();if(t!=null&&t.error)return t.error.charAt(0).toUpperCase()+t.error.slice(1)}catch{}return`Save Failed (${e.status})`}function zp(e){return e.endsWith("-basic")?"youtube":"done"}const zh={done:{label:"Done",dot:"bg-green",text:"text-green"},youtube:{label:"YouTube",dot:"bg-red",text:"text-red"}},K1={label:"None",dot:"bg-zinc-600",text:"text-zinc-500"},rte={done:2,youtube:1};function ES({status:e}){const t=e?zh[zp(e.source)]:K1;return n.jsx("span",{className:j("font-display text-[13px] uppercase tracking-[0.12em]",t.text),children:t.label})}const ate="grid-cols-[80px_1fr] sm:grid-cols-[80px_1fr_96px_96px_96px_80px] md:grid-cols-[80px_1fr_56px_144px_96px_96px_96px_80px]",ote="grid-cols-[80px_1fr] sm:grid-cols-[80px_1fr_96px_80px] md:grid-cols-[80px_1fr_56px_144px_96px_80px]",Yv=e=>e?ate:ote;function DA({sort:e,onSort:t,showStatus:s=!1}){const r=(a,o,i)=>n.jsx(Ni,{label:o,align:i,fill:!0,active:e.key===a,dir:e.dir,onClick:()=>t(a)});return n.jsxs("div",{className:j("hidden items-center gap-x-3 border-b border-border pt-3 pb-2.5 font-display text-[11px] tracking-[0.2em] text-muted sm:grid",Yv(s)),children:[n.jsx("span",{}),n.jsx("div",{className:"min-w-0",children:r("title","EPISODE","left")}),n.jsx("div",{className:"hidden md:block",children:r("set","SET","center")}),n.jsx("div",{className:"hidden md:block",children:r("category","CATEGORY","left")}),s?n.jsx("div",{children:r("status","STATUS","left")}
505):null,s?n.jsx("div",{children:r("structure","SECTIONS","center")}):null,n.jsx("div",{children:r("date","DATE","left")}),n.jsx("div",{children:r("words","WORDS","center")})]})}function ite({showStatus:e=!1,rows:t=8}){return n.jsxs("div",{children:[n.jsx(DA,{sort:{key:"date",dir:"desc"},onSort:()=>{},showStatus:e}),n.jsx("div",{className:"divide-y divide-border",children:Array.from({length:t}).map((s,r)=>n.jsx(lte,{showStatus:e,widthSeed:r},r))})]})}function lte({showStatus:e,widthSeed:t}){const s=`${72-t%4*11}%`;return n.jsxs("div",{className:j("grid items-center gap-x-3 py-2.5",Yv(e)),children:[n.jsx("div",{className:"aspect-video animate-pulse rounded bg-surface"}),n.jsx("div",{className:"min-w-0",children:n.jsx("div",{className:"h-3.5 animate-pulse rounded bg-surface",style:{width:s}})}),n.jsx("div",{className:"hidden justify-center md:flex",children:n.jsx("div",{className:"h-5 w-5 animate-pulse rounded-full bg-surface"})}),n.jsx("div",{className:"hidden md:block",children:n.jsx("div",{className:"h-5 w-20 animate-pulse rounded bg-surface"})}),e?n.jsx("div",{className:"hidden sm:block",children:n.jsx("div",{className:"h-3 w-14 animate-pulse rounded bg-surface"})}):null,e?n.jsx("div",{className:"hidden sm:block",children:n.jsx("div",{className:"mx-auto h-3 w-10 animate-pulse rounded bg-surface"})}):null,n.jsx("div",{className:"hidden sm:block",children:n.jsx("div",{className:"h-3 w-16 animate-pulse rounded bg-surface"})}),n.jsx("div",{className:"hidden sm:block",children:n.jsx("div",{className:"mx-auto h-3 w-10 animate-pulse rounded bg-surface"})})]})}function cte({episode:e,detailBase:t,status:s,showStatus:r=!1}){const a=(s||r)&&e.slug?`${t}/${e.slug}`:null,o=!s,i=s!=null&&s.wordCount?s.wordCount.toLocaleString():"—",l=e.publishedLabel.toUpperCase(),c=n.jsxs("div",{className:j("group grid items-center gap-x-3 py-2.5",Yv(r)),children:[n.jsx("div",{className:"relative aspect-video overflow-hidden rounded bg-black/30",children:e.image?n.jsx("img",{src:e.image,alt:"",loading:"lazy",className:"h-full w-full object-cover"}):null}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("span",{className:j("block font-body text-[14px] font-medium leading-snug line-clamp-1 transition-colors",o?"text-muted":"text-text group-hover:text-green"),children:e.title}),n.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-2.5 gap-y-1 font-num text-[11px] tracking-[0.04em] text-muted sm:hidden",children:[e.setCode?n.jsx(Ae,{code:e.setCode,size:15}):null,n.jsx(F1,{category:e.category,className:"!px-1.5 !py-0.5 !text-[10px]"}),n.jsx("span",{children:l}),n.jsxs("span",{children:[i," words"]}),r?n.jsx(ES,{status:s}):null]})]}),n.jsx("div",{className:"hidden justify-center md:flex",children:e.setCode?n.jsx(Ae,{code:e.setCode,size:22}):null}),n.jsx("div",{className:"hidden md:block",children:n.jsx(F1,{category:e.category})}),r?n.jsx("span",{className:"hidden sm:block",children:n.jsx(ES,{status:s})}):null,r?n.jsx("span",{className:j("hidden text-center font-num text-[12px] tabular-nums sm:block",s&&s.sections===0&&s.subsections===0?"text-red":"text-muted"),children:s?`${s.sections} / ${s.subsections}`:"—"}):null,n.jsx("span",{className:"hidden font-num text-[11px] tracking-[0.06em] text-muted sm:block",children:l}),n.jsx("span",{className:"hidden text-center font-num text-[12px] tabular-nums text-muted sm:block",children:i})]});return a?n.jsx(te,{to:a,className:"block no-underline",children:c}):n.jsx(Ne,{label:"Transcript Pending",side:"top",children:n.jsx("div",{children:c})})}function IA(e){const t=e.indexOf("//");return(t===-1?e:e.slice(0,t)).trim()}function Wn(e,t){return`${(e??"").toLowerCase()}|${IA(t).toLowerCase()}`}function RS(e,t){const s=t?`&set=${t.toLowerCase()}`:"";return`https://api.scryfall.com/cards/named?exact=${encodeURIComponent(IA(e))}${s}&format=image&version=normal`}function q1(e){const t=new Map;for(const s of e){if(!s.name||!s.set)continue;const r=Wn(s.set,s.name);t.has(r)||t.set(r,{name:s.name,set:s.set})}return[...t.values()]}async function dte(e){if(e.length===0)return{};const t=await fetch("/api/card-images",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({identifiers:e})});return t.ok?await t.json():{}}const MA="cardimg:v3",to=new Map;let AS=!1;function $A(){if(!AS){AS=!0;try{const e=localStorage.getItem(MA);if(e)for(const[t,s]of Object.entries(JSON.parse(e)))to.set(t,s)}catch{return}}}function ute(){try{localStorage.setItem(MA,JSON.stringify(Object.fromEntries(to)))}catch{return}}function Mi(e){$A();const t=p.useMemo(()=>q1(e),[e]),s=p.useMemo(()=>t.filter(o=>!to.has(Wn(o.set,o.name))),[t]),r=p.useMemo(()=>s.map(o=>Wn(o.set,o.name)).sort().join(","),[s]),{isFetching:a}=je({queryKey:["card-images",r],queryFn:()=>Z1(s),enabled:s.length>0,staleTime:1/0,gcTime:1/0});return p.useMemo(()=>({images:new Map(to),ready:s.length===0||!a}),[s.length,a])}function fte(e,t){$A();const s=p.useMemo(()=>q1(e),[e]),r=p.useMemo(()=>s.map(h=>Wn(h.set,h.name)).sort().join(","),[s]),a=s.some(h=>!to.has(Wn(h.set,h.name))),o=q1(t),i=o.filter(h=>!to.has(Wn(h.set,h.name))),l=i.map(h=>Wn(h.set,h.name)).sort().join(","),c=je({queryKey:["card-images",l],queryFn:()=>Z1(i),enabled:i.length>0,staleTime:1/0,gcTime:1/0}),d=je({queryKey:["card-images-board",r],queryFn:()=>Z1(s),enabled:a,staleTime:1/0,gcTime:1/0}),u=!a||d.status!=="pending",f=c.fetchStatus!=="fetching";return p.useMemo(()=>{const h=new Set;if(f)for(const m of o)h.add(Wn(m.set,m.name));return{images:new Map(to),ready:u,settled:u?void 0:h}},[u,f,l,c.dataUpdatedAt])}async function Z1(e){const t=await dte(e);for(const[s,r]of Object.entries(t))to.set(s,r);return ute(),t}function hte(e,t){const s=new Map;for(const r of t)r.image&&s.set(Wn(e,r.name),r.image);return{images:s,ready:!0}}function vr(e,t,s){if(!e)return[];const r=s==null?void 0:s.images.get(Wn(t,e)),a=[t?RS(e,t):null,RS(e)].filter(l=>l!=null);if(r)return[r,...a];const o=s==null?void 0:s.settled;return(o?o.has(Wn(t,e)):(s==null?void 0:s.ready)??!0)?a:[]}function Bh(e,t,s){return vr(e,t,s).map(r=>r.includes("cards.scryfall.io/")?r.replace("/normal/","/art_crop/"):r.replace("version=normal","version=art_crop"))}function UA({src:e,alt:t,onError:s,onClose:r}){return p.useEffect(()=>{const a=o=>{o.key==="Escape"&&r()};return document.addEventListener("keydown",a),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",a),document.body.style.overflow=""}},[r]),It.createPortal(n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-6 backdrop-blur-sm animate-fadeIn",onClick:r,role:"dialog","aria-modal":"true",children:n.jsx("img",{src:e,alt:t,onError:s,className:"max-h-[85vh] w-auto rounded-2xl shadow-2xl",style:{aspectRatio:"488 / 680"}})}),document.body)}const pte=680/488,mte=12,xte=Ud*pte+mte;function gte({name:e,set:t,cardImages:s}){const r=ut(),a=p.useRef(null),o=p.useRef(!1),[i,l]=p.useState(null),[c,d]=p.useState(!1),u=p.useCallback(()=>d(!1),[]),[f,h]=p.useState(0),m=vr(e,t,s),y=m[Math.min(f,m.length-1)],b=()=>h(g=>g<m.length-1?g+1:g);p.useEffect(()=>{if(r||!y||!a.current)return;const g=a.current,v=new IntersectionObserver(k=>{k.some(S=>S.isIntersecting)&&(dc(y),v.disconnect())},{rootMargin:"300px"});return v.observe(g),()=>v.disconnect()},[y,r]);const w=()=>{o.current=!0,y&&dc(y,()=>{o.current&&a.current&&l(uf(a.current,xte))})},x=()=>{o.current=!1,l(null)};return n.jsxs(n.Fragment,{children:[n.jsx("button",{ref:a,type:"button",className:"text-green underline decoration-green/40 underline-offset-2 transition-colors hover:decoration-green",onMouseEnter:r?void 0:w,onMouseLeave:r?void 0:x,onClick:r?()=>d(!0):void 0,children:e}),!r&&i&&y?It.createPortal(n.jsx(Ym,{anchor:i,children:n.jsx("img",{src:y,alt:e,onError:b,className:"w-full rounded-[4.75%]",style:{aspectRatio:"488 / 680"}})}),document.body):null,c&&y&&n.jsx(UA,{src:y,alt:e,onError:b,onClose:u})]})}const oi="border-green bg-green/10 text-green",Rl="border-border2 bg-transparent text-muted hover:bg-surface";function Qv(e){p.useEffect(()=>{const t=document.documentElement;return t.style.scrollPaddingTop=e?`${e+12}px`:"",()=>{t.style.scrollPaddingTop=""}},[e])}const bte=[{value:"newest",label:"Newest",icon:IU},{value:"oldest",label:"Oldest",icon:$U}],zA=({size:e=18})=>n.jsx("span",{className:"flex shrink-0 items-center justify-center",style:{width:e,height:e},children:n.jsx(uo,{size:Math.round(e*.62)})}),yte=e=>e.value?n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 truncate text-green",children:[n.jsx(Ae,{code:e.value,size:18,className:"text-green"}),e.value]}):n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 truncate text-subtle",children:[n.jsx(zA,{}),"ALL SETS"]}),vte=e=>n.jsx(Am,{...e,className:j("translate-y-[1px]",e.className)}),zd={"Set Review":vte,Metagame:Ky,Draft:zT,Sealed:GT,Rankings:FT,Coaching:Qy,Guest:Xy,Evergreen:BT},wte={Apple:s6,Spotify:e6,YouTube:Gm,RSS:t6},Oo=12,rh=e=>e.setCode??null,jte=e=>e.setName??e.setCode??"",Fh=e=>`/episodes/${e.toLowerCase()}`;function xg(){const{data:e,isPending:t,isError:s,thumbnailsPending:r,setsReady:a}=OR(),{data:o}=MZ(),{user:i}=Qn(),l=LA(i==null?void 0:i.discordId),{categorySlug:c,episodeSlug:d}=cn(),u=ln(),f=Rt(),[h]=Rn(),[m,y]=p.useState(()=>h.get("q")??""),[b,w]=p.useState("newest"),[x,g]=p.useState(Oo),[v,k]=p.useState(!1),[S,N]=p.useState(!1),[C,_]=p.useState(Nte),[T,E]=p.useState(Cte),[A,P]=p.useState({key:"date",dir:"desc"});p.useEffect(()=>{window.localStorage.setItem(VA,C)},[C]),p.useEffect(()=>{window.localStorage.setItem(KA,T)},[T]);const M=ut(),U=p.useRef(null),F=p.useRef(null),I=p.useRef(null),q=p.useRef(null),[O,H]=p.useState(0);p.useLayoutEffect(()=>{const G=()=>{const oe=I.current,Ce=q.current;if(!oe||!Ce||window.innerWidth<1024){H(0);return}const Mt=Ce.getBoundingClientRect().left+parseFloat(getComputedStyle(Ce).paddingLeft);H(Math.max(0,Math.round(oe.getBoundingClientRect().left-Mt)))};return G(),window.addEventListener("resize",G),()=>window.removeEventListener("resize",G)},[S]);const B=e??[],D=p.useMemo(()=>{const G=new Map;for(const oe of e??[])oe.setCode&&G.set(oe.setCode.toLowerCase(),oe.setCode);return G},[e]),L=(c==null?void 0:c.toLowerCase())??null,$=L==="shorts",V=L==="audio",z=L==="transcripts",K=$||V||z,W=c?HE(c):null,J=L&&!K&&!W?D.get(L)??null:null,Z=J??h.get("set"),Y=!!L&&!K&&!W&&!a,ae=p.useMemo(()=>e?d?vd(e,d.toLowerCase()):L&&!K&&!W&&!D.has(L)?vd(e,L):null:null,[e,d,L,K,W,D]),pe=!!d||!!(L&&!K&&!W&&!D.has(L)&&(L.includes("-")||L.length>4)),ye=z&&!!(ae||pe&&t);p.useEffect(()=>{window.scrollTo(0,0)},[]);const De=ae==null?void 0:ae.id;p.useEffect(()=>{De&&window.scrollTo({top:0})},[De]),p.useEffect(()=>{const G=h.get("category"),oe=h.get("type")==="shorts";if(G||oe){const fa=new URLSearchParams(h);fa.delete("category"),fa.delete("type");const wf=yi.find(vL=>vL===G),yL=oe?"/episodes/shorts":wf?`/episodes/${En(wf)}`:"/episodes";u({pathname:yL,search:fa.toString()},{replace:!0});return}if(!e)return;const Ce=h.get("set");if(!c&&Ce&&D.has(Ce.toLowerCase())){const fa=new URLSearchParams(h);fa.delete("set"),u({pathname:Fh(Ce),search:fa.toString()},{replace:!0});return}if(d&&!vd(e,d.toLowerCase())){u({pathname:`/episodes/${c??""}`.replace(/\/$/,""),search:h.toString()},{replace:!0});return}a&&L&&!K&&!W&&!D.has(L)&&!d&&!vd(e,L)&&u({pathname:"/episodes",search:h.toString()},{replace:!0})},[h,c,L,d,u,e,D,K,W,a]);const Fe=$?"/episodes/shorts":V?"/episodes/audio":z?"/episodes/transcripts":W?`/episodes/${En(W)}`:null,tt=Fe??(J?Fh(J):"/episodes"),st=()=>{const G=F.current;return G?G.getBoundingClientRect().top+window.scrollY:0},ie=G=>{const oe=new URLSearchParams(h);return oe.delete("set"),G&&oe.set("set",G),oe.toString()},Se=(G,oe)=>{const Ce=ie(oe);return Ce?`${G}?${Ce}`:G},Ie=(G,oe)=>{u({pathname:G,search:ie(oe)}),g(Oo);const Ce=st();window.scrollY>Ce&&window.scrollTo({top:Ce})},_e=(G,oe)=>({href:Se(G,oe),onClick:Ce=>{No(Ce)&&(Ce.preventDefault(),Ie(G,oe),k(!1))}}),We=G=>{y(G),g(Oo);const oe=new URLSearchParams(h);G.trim()?oe.set("q",G):oe.delete("q"),u({pathname:f.pathname,search:oe.toString()},{replace:!0})},we=G=>G?Fe?[Fe,G]:[Fh(G),null]:[Fe??"/episodes",null],He=G=>
505Ie(...we(G)),ee=G=>Se(...we(G)),Q=G=>G.youtubeId??G.id,re=G=>o==null?void 0:o.get(Q(G)),fe=p.useMemo(()=>B.filter(G=>!G.isShort),[B]),Ee=p.useMemo(()=>B.filter(G=>G.isShort),[B]),qe=p.useMemo(()=>fe.filter(G=>!!G.audioUrl),[fe]),Qe=p.useMemo(()=>l?fe:fe.filter(G=>o==null?void 0:o.has(Q(G))),[fe,o,l]),X=$?Ee:V?qe:z?Qe:fe,ke=p.useMemo(()=>Z?fe.filter(G=>rh(G)===Z):fe,[fe,Z]),$e=p.useMemo(()=>Z?Ee.filter(G=>rh(G)===Z):Ee,[Ee,Z]),Me=p.useMemo(()=>Z?qe.filter(G=>rh(G)===Z):qe,[qe,Z]),Ue=p.useMemo(()=>Z?Qe.filter(G=>rh(G)===Z):Qe,[Qe,Z]),Ve=m.trim().toLowerCase(),ft=p.useMemo(()=>ke.filter(G=>oh(G,Ve)),[ke,Ve]),Rs=p.useMemo(()=>$e.filter(G=>oh(G,Ve)),[$e,Ve]),zi=p.useMemo(()=>Me.filter(G=>oh(G,Ve)),[Me,Ve]),vs=p.useMemo(()=>Ue.filter(G=>oh(G,Ve)),[Ue,Ve]),Gc=p.useMemo(()=>{const G=new Map;for(const oe of vs)G.set(oe.category,(G.get(oe.category)??0)+1);return G},[vs]),Vc=p.useMemo(()=>{let G=vs;return C&&(G=G.filter(oe=>oe.category===C)),l&&T&&(G=G.filter(oe=>{const Ce=o==null?void 0:o.get(oe.youtubeId??oe.id);return T==="none"?!Ce:Ce?zp(Ce.source)===T:!1})),G},[vs,C,T,l,o]),gf=p.useMemo(()=>{const G=new Map;for(const oe of ft)G.set(oe.category,(G.get(oe.category)??0)+1);return G},[ft]),Kc=p.useMemo(()=>{const G=new Map;for(const oe of X){const Ce=oe.setCode;if(!Ce)continue;const Mt=G.get(Ce);Mt?(Mt.count+=1,Mt.released=Mt.released??oe.setReleasedAt??null):G.set(Ce,{name:jte(oe),count:1,released:oe.setReleasedAt??null})}return G},[X]),da=p.useMemo(()=>{const G=[...Kc.entries()].sort((oe,Ce)=>Hte(oe[1].released,Ce[1].released));return[{value:"",label:"All sets"},...G.map(([oe,Ce])=>({value:oe,label:Ce.name}))]},[Kc]),ua=G=>{var Ce;const oe=G.value?(Ce=Kc.get(G.value))==null?void 0:Ce.count:X.length;return n.jsxs("span",{className:"flex w-full min-w-0 items-center gap-2.5",children:[G.value?n.jsx(Ae,{code:G.value,size:20}):n.jsx(zA,{size:20}),n.jsx("span",{className:"flex-1 truncate",children:G.label}),oe!=null&&n.jsx("span",{className:"font-num text-[12px] tabular-nums text-muted shrink-0",children:oe})]})},To=n.jsx(yt,{value:Z??"",options:da,onChange:G=>He(G||null),hrefFor:G=>ee(G||null),renderValue:yte,renderOption:ua,searchPlaceholder:"Search sets or codes…",triggerClassName:"!min-w-[108px] md:!min-w-[132px] !h-10 !py-0 hover:!bg-surface2",mobileCentered:!0}),qc=p.useMemo(()=>{const G=[{value:"",label:"All categories"}];for(const oe of yi)Gc.get(oe)&&G.push({value:oe,label:oe});return G},[Gc]),mx=G=>{const oe=G.value,Ce=oe?zd[oe]:b1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-2 truncate",children:[n.jsx(Ce,{size:15,strokeWidth:2,className:j("shrink-0",oe?B1[oe]:"text-muted")}),n.jsx("span",{className:"truncate",children:oe?G.label:"CATEGORY"})]})},xx=G=>{const oe=G.value,Ce=oe?zd[oe]:null,Mt=oe?Gc.get(oe):vs.length;return n.jsxs("span",{className:"flex w-full min-w-0 items-center gap-2.5",children:[Ce?n.jsx(Ce,{size:16,strokeWidth:2,className:j("shrink-0",B1[oe])}):n.jsx("span",{className:"w-4 shrink-0"}),n.jsx("span",{className:"flex-1 truncate",children:G.label}),Mt!=null&&n.jsx("span",{className:"font-num text-[12px] tabular-nums text-muted shrink-0",children:Mt})]})},gx=p.useMemo(()=>{const G=C?vs.filter(Ce=>Ce.category===C):vs,oe={all:G.length,done:0,youtube:0,none:0};for(const Ce of G){const Mt=o==null?void 0:o.get(Ce.youtubeId??Ce.id);Mt?oe[zp(Mt.source)]+=1:oe.none+=1}return oe},[vs,C,o]),bf=[{value:"",label:"All"},{value:"done",label:zh.done.label},{value:"youtube",label:zh.youtube.label},{value:"none",label:K1.label}],Zc=G=>G?G==="none"?K1.dot:zh[G].dot:null,le=G=>G.value?n.jsxs("span",{className:"flex min-w-0 items-center gap-2 truncate",children:[n.jsx("span",{className:j("h-2 w-2 shrink-0 rounded-full",Zc(G.value))}),G.label]}):n.jsx("span",{className:"truncate text-subtle",children:"STATUS"}),Pe=G=>{const oe=Zc(G.value),Ce=G.value||"all",Mt=gx[Ce];return n.jsxs("span",{className:"flex w-full min-w-0 items-center gap-2.5",children:[oe?n.jsx("span",{className:j("h-2 w-2 shrink-0 rounded-full",oe)}):n.jsx("span",{className:"w-2 shrink-0"}),n.jsx("span",{className:"flex-1 truncate",children:G.label}),n.jsx("span",{className:"font-num text-[12px] tabular-nums text-muted shrink-0",children:Mt>0?Mt:"-"})]})},gt=n.jsx(yt,{value:C,options:qc,onChange:G=>{_(G),g(Oo)},renderValue:mx,renderOption:xx,searchable:!1,triggerClassName:"!min-w-[150px] !h-10 !py-0 hover:!bg-surface2",mobileCentered:!0}
505),Jn=n.jsx(yt,{value:T,options:bf,onChange:G=>{E(G),g(Oo)},renderValue:le,renderOption:Pe,searchable:!1,triggerClassName:"!min-w-[120px] !h-10 !py-0 hover:!bg-surface2",mobileCentered:!0}),Bi=z?n.jsxs("div",{className:"hidden shrink-0 items-center gap-2 lg:flex",children:[gt,l?Jn:null]}):null,Yc=n.jsxs(n.Fragment,{children:[n.jsx(ac,{size:15,strokeWidth:2,className:j("pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 transition-colors",m.trim()?"text-green":"text-dim")}),n.jsx("input",{value:m,onChange:G=>We(G.target.value),placeholder:"Search",className:j("w-full h-10 bg-bg border pl-9 pr-3.5 text-[14px] text-text placeholder:text-dim outline-none transition-colors focus:border-green",m.trim()?"border-green":"border-border2")})]}),yf=G=>{P(oe=>oe.key===G?{key:G,dir:oe.dir==="asc"?"desc":"asc"}:{key:G,dir:G==="date"||G==="words"||G==="status"?"desc":"asc"}),g(Oo)},Hs=p.useMemo(()=>{const G=$?Rs:V?zi:z?Vc:ft,oe=!K&&W?G.filter(Ce=>Ce.category===W):G;return z?Vte(oe,A,o):Gte(oe,b)},[$,V,z,K,Rs,zi,Vc,ft,W,b,A,o]);p.useEffect(()=>{if(x>=Hs.length)return;const G=U.current;if(!G)return;let oe=!1;const Ce=()=>{oe=!1,G.getBoundingClientRect().top<window.innerHeight+600&&g(wf=>Math.min(wf+Oo,Hs.length))},Mt=()=>{oe||(oe=!0,requestAnimationFrame(Ce))};Ce();const fa=setTimeout(Ce,300);return window.addEventListener("scroll",Mt,{passive:!0}),window.addEventListener("resize",Mt),()=>{clearTimeout(fa),window.removeEventListener("scroll",Mt),window.removeEventListener("resize",Mt)}},[x,Hs.length,De]);const vf=$?{label:"Shorts",icon:ZT}:V?{label:"Audio",icon:Ac}:z?{label:"Transcripts",icon:IT}:W?{label:W,icon:zd[W]}:null,Uw={allCount:ft.length,shortsCount:Rs.length,shortsExist:t||Ee.length>0,audioCount:zi.length,audioExist:t||qe.length>0,transcriptsCount:vs.filter(G=>o==null?void 0:o.has(Q(G))).length,transcriptsExist:t||Qe.length>0,counts:gf,activeCategory:W,activeSet:Z,shortsView:$,audioView:V,transcriptsView:z,link:_e};return n.jsxs($c,{subtitle:"EPISODES",children:[n.jsxs("div",{ref:F,className:"flex min-h-full flex-1",children:[n.jsx("aside",{className:j("hidden lg:block shrink-0 self-stretch","border-r border-border bg-surface","transition-[width] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]",S?"w-[57px]":"w-[clamp(196px,18vw,244px)]"),children:n.jsx("div",{className:"sticky top-0 max-h-screen overflow-y-auto overflow-x-hidden",children:n.jsx(US,{...Uw,collapsed:S,onCollapse:()=>N(!0),onExpand:()=>N(!1)})})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[ae||pe&&t?null:n.jsxs("div",{className:"sticky top-0 z-10 border-b border-border bg-surface",children:[n.jsxs("div",{className:"flex h-[60px] items-center gap-2.5 px-4 md:px-6",children:[n.jsx("button",{type:"button",onClick:()=>k(!0),className:j("lg:hidden shrink-0 flex h-10 items-center gap-2 border px-3 py-0 font-display text-[13px] tracking-[0.12em] transition-colors",vf?oi:"border-border2 text-text hover:bg-surface2"),children:vf?n.jsxs(n.Fragment,{children:[n.jsx(vf.icon,{size:14,strokeWidth:2,className:"shrink-0"}),n.jsx("span",{className:"uppercase",children:vf.label})]}):n.jsxs(n.Fragment,{children:[n.jsx(b1,{size:14,strokeWidth:2,className:"shrink-0"}),n.jsx("span",{children:"CATEGORIES"})]})}),M?n.jsx("span",{className:"shrink-0",children:To}):n.jsx(Ne,{label:"Filter by set",side:"top",children:n.jsx("span",{className:"shrink-0",children:To})}),z?n.jsx("div",{className:"min-w-0 flex-1 lg:hidden",children:gt}):null,Bi,n.jsx("div",{ref:I,className:j("relative min-w-0 flex-1",z&&"hidden lg:block"),children:Yc}),n.jsx(Wte,{value:b,onChange:w,className:"hidden sm:flex shrink-0"}),n.jsx("div",{className:"ml-1 hidden xl:flex items-center gap-2.5",children:jR.map(({label:G,url:oe})=>{const Ce=wte[G];return n.jsx(Ne,{label:G,side:"bottom",children:n.jsx("a",{href:oe,target:"_blank",rel:"noreferrer","aria-label":G,className:"inline-flex h-10 w-10 items-center justify-center bg-surface2 text-subtle no-underline transition-colors hover:bg-border hover:text-green",style:{clipPath:Uc},children:Ce?n.jsx(Ce,{className:"text-[15px]",size:15}):G})},G)})})]}),z?n.jsxs("div",{className:"flex items-center gap-2.5 px-4 pb-3 md:px-6 lg:hidden",children:[n.jsx("div",{className:"relative min-w-0 flex-1",children:Yc}),l?Jn:null]}):null]}),n.jsx("div",{ref:q,className:j("pb-4 pr-4 md:pr-6",ae||ye?"pl-2":"pl-4 md:pl-6",ye?"pt-0":"pt-6"),children:ae&&z?n.jsx(Ete,{episode:ae}):ae?n.jsx(_te,{episode:ae,audioMode:V,thumbnailPending:r,siblings:e}):pe&&t?z?n.jsx(Rte,{}):n.jsx(Ate,{}):Y||t&&Hs.length===0?z?n.jsx("div",{className:"relative -top-6 -mr-4 md:-mr-6",children:n.jsx(ite,{showStatus:l})}):n.jsx(zS,{children:Array.from({length:12}).map((G,oe)=>n.jsx("div",{className:"aspect-video bg-surface border border-border animate-pulse"},oe))}):s?n.jsx("p",{className:"text-muted text-[14px] py-8",children:"Could not load episodes. Refresh to try again."}):Hs.length?n.jsxs(n.Fragment,{children:[n.jsx(OA,{transitionKey:`${c??"all"}:${Z??""}`,children:$?n.jsx(Fte,{children:Hs.slice(0,x).map(G=>n.jsx(Wee,{episode:G,thumbnailPending:r},G.id))}):z?n.jsxs("div",{className:"relative -top-6 -mr-4 md:-mr-6",children:[n.jsx(DA,{sort:A,onSort:yf,showStatus:l}),n.jsx("div",{className:"divide-y divide-border",children:Hs.slice(0,x).map(G=>n.jsx(cte,{episode:G,detailBase:tt,status:re(G),showStatus:l},G.id))})]}):n.jsx(zS,{children:Hs.slice(0,x).map(G=>n.jsx(Fee,{episode:G,thumbnailPending:r,audioMode:V,detailBase:tt},G.id))})}),x<Hs.length?n.jsx("div",{ref:U,className:"h-10 flex items-center justify-center mt-10",children:n.jsx("span",{className:"font-mono text-[11px] tracking-[0.16em] text-dim uppercase animate-pulse",children:"Loading…"})}):null]}):n.jsx(Bte,{query:Ve?m.trim():"",noun:$?"shorts":V?"audio episodes":z?"transcripts":"episodes",category:W,set:Z,indent:O,onClear:()=>We("")})})]})]}),n.jsx(Vee,{open:v,onOpenChange:k,closeLabel:"Close categories",children:n.jsx(US,{...Uw})}),n.jsx(zc,{onClick:()=>window.scrollTo({top:st(),behavior:"smooth"}),dimmed:!!ae,className:ae?"lg:hidden":void 0})]})}const BA="llu:episode-video-h",Y1=200,PS=452,OS=14;function FA(){if(typeof window>"u")return PS;const e=Number(window.localStorage.getItem(BA));return e>=Y1?e:PS}const WA="llu:episode-transcript-wide";function kte(){return typeof window>"u"?!1:window.localStorage.getItem(WA)==="1"}const HA="llu:episode-hide-transcript";function Ste(){return typeof window>"u"?!1:window.localStorage.getItem(HA)==="1"}const GA="llu:transcript-article-wide";function Jv(){return typeof window>"u"?!0:window.localStorage.getItem(GA)!=="0"}const VA="llu:transcript-category",KA="llu:transcript-tier";function Nte(){const e=typeof window>"u"?null:window.localStorage.getItem(VA);return e&&yi.includes(e)?e:""}function Cte(){const e=typeof window>"u"?null:window.localStorage.getItem(KA);return e==="done"||e==="youtube"||e==="none"?e:""}const Xv="llu:transcript-reading";function qA(){const e={highlight:!0,autoScroll:!1,textPx:15};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Xv);return t?{...e,...JSON.parse(t)}:e}catch{return e}}function _te({episode:e,audioMode:t,thumbnailPending:s,siblings:r}){const{transcript:a,settled:o}=AR(e),i=QA(e.youtubeId??e.id,a??[]),l=p.useRef(null),c=p.useRef(null),d=p.useRef(null),u=p.useRef(null),[f,h]=p.useState(0),[m,y]=p.useState(0),[b,w]=p.useState(0),x=b>1200,[g,v]=p.useState(FA),[k,S]=p.useState(kte),N=k&&x,C=Q=>{S(Q),window.localStorage.setItem(WA,Q?"1":"0")},_=ut(),[T,E]=p.useState(()=>qA()),A=Q=>{E(Q),window.localStorage.setItem(Xv,JSON.stringify(Q))},[P,M]=p.useState(Ste),U=()=>{M(Q=>{const re=!Q;return window.localStorage.setItem(HA,re?"1":"0"),re})},[F,I]=p.useState(!1),[q,O]=p.useState(!1),[H,B]=p.useState(!1),D=p.useRef(null),L=p.useRef(null),$=H||F||!q,V=()=>{D.current&&(window.clearTimeout(D.current),D.current=null),B(!0)},z=()=>{D.current=window.setTimeout(()=>B(!1),3e3)};p.useEffect(()=>()=>window.clearTimeout(D.current??void 0),[]),p.useLayoutEffect(()=>{const Q=d.current;if(!Q)return;const re=()=>y(Q.getBoundingClientRect().height);re();const fe=new ResizeObserver(re);return fe.observe(Q),()=>fe.disconnect()},[]),Qv(m),p.useLayoutEffect(()=>{var Ee;const Q=(Ee=u.current)==null?void 0:Ee.parentElement;if(!Q)return;const re=()=>{const qe=getComputedStyle(Q),Qe=parseFloat(qe.paddingLeft)+parseFloat(qe.paddingRight);w(Q.clientWidth-Qe)};re();const fe=new ResizeObserver(re);return fe.observe(Q),()=>fe.disconnect()},[]);const K=t||!e.youtubeId,W=p.useMemo(()=>(a??[]).filter(Q=>Q.heading).map(Q=>({t:Q.t,heading:Q.heading})),[a]),J=e.hasTranscript||!!(a&&a.length>0),Z=J&&!P,Y=!K&&(W.length>0||Z&&!o),ae=Y?316:0,pe=N?b||1440:Math.min(b||1440,1440),ye=Math.max(Y1,Math.floor((pe-ae)*.5625)),De=Q=>{const re=Math.round(Math.min(ye,Math.max(Y1,Q)));v(re),window.localStorage.setItem(BA,String(re))},[Fe,tt]=p.useState(()=>new Set),st=Q=>tt(re=>{const fe=new Set(re);return fe.has(Q)?fe.delete(Q):fe.add(Q),fe}),ie=K?!!e.audioUrl:!!e.youtubeId,Se=Q=>{var fe;if(K){(fe=c.current)==null||fe.seek(Q+OS);return}const re=(Ee,qe)=>{var Qe,X;return(X=(Qe=l.current)==null?void 0:Qe.contentWindow)==null?void 0:X.postMessage(JSON.stringify({event:"command",func:Ee,args:qe}),"https://www.youtube.com")};re("seekTo",[Q,!0]),re("playVideo",[])};p.useEffect(()=>{if(K)return;const Q=()=>{var Ee,qe;const fe=JSON.stringify({event:"command",func:"setOption",args:["captions","track",{}]});
505(qe=(Ee=l.current)==null?void 0:Ee.contentWindow)==null||qe.postMessage(fe,"https://www.youtube.com")},re=[800,1600,2800].map(fe=>window.setTimeout(Q,fe));return()=>re.forEach(window.clearTimeout)},[K,e.youtubeId]),p.useEffect(()=>{if(K)return;const Q=()=>{var Ee,qe;return(qe=(Ee=l.current)==null?void 0:Ee.contentWindow)==null?void 0:qe.postMessage(JSON.stringify({event:"listening",id:1,channel:"widget"}),"https://www.youtube.com")},re=[500,1200,2500].map(Ee=>window.setTimeout(Q,Ee)),fe=Ee=>{var qe,Qe;if(Ee.origin==="https://www.youtube.com")try{const X=JSON.parse(Ee.data);X.event==="infoDelivery"&&typeof((qe=X.info)==null?void 0:qe.currentTime)=="number"&&h(X.info.currentTime),X.event==="infoDelivery"&&typeof((Qe=X.info)==null?void 0:Qe.playerState)=="number"&&O(X.info.playerState===1||X.info.playerState===3)}catch{return}};return window.addEventListener("message",fe),()=>{re.forEach(window.clearTimeout),window.removeEventListener("message",fe)}},[K,e.youtubeId]);const Ie=!!(a&&a.length>0)&&!P,_e=J&&!K,We=Z&&K,we=p.useMemo(()=>{const Q=(r??[]).filter(Ee=>Ee.id!==e.id&&!Ee.isShort),re=Q.filter(Ee=>Ee.category===e.category),fe=Q.filter(Ee=>Ee.category!==e.category);return[...re,...fe].slice(0,12)},[r,e.id,e.category]),He=p.useMemo(()=>{let Q=-1;for(const re of W)if(re.t<=f+.5)Q=re.t;else break;return Q},[W,f]),ee=Q=>{var qe;tt(Qe=>{if(!Qe.has(Q))return Qe;const X=new Set(Qe);return X.delete(Q),X});const re=W.find(Qe=>Qe.t===Q);re&&window.history.replaceState(null,"",`#${Bp(re.heading)}`),ie&&Se(Q);const fe=document.getElementById(`ch-${Q}`);if(!fe)return;const Ee=(((qe=d.current)==null?void 0:qe.offsetHeight)??0)+12;eP(fe.getBoundingClientRect().top+window.scrollY-Ee)};return n.jsxs("div",{ref:u,className:j("mx-auto w-full max-w-[1440px] lg:min-h-0",Z&&k&&x&&"lg:max-w-none lg:px-6",o?"":"min-h-[calc(100vh-9rem)]"),children:[n.jsxs("div",{ref:d,className:j("z-30 -mx-4 -mt-6 bg-bg md:-mx-6 md:mt-0 md:px-6 md:py-2 lg:-mx-5 lg:-mt-6 lg:px-5 lg:pb-0 lg:pt-6","sticky top-0"),children:[n.jsxs("div",{className:j("lg:flex lg:items-start lg:gap-4",(N||_e)&&"lg:justify-center"),style:_e?{"--epv":`${g}px`,"--epvmax":`${ye}px`}:void 0,onPointerEnter:_e?V:void 0,onPointerLeave:_e?z:void 0,children:[n.jsx("div",{className:j("relative",_e?"lg:shrink-0":"lg:mx-auto lg:w-full lg:max-w-[1120px]"),children:K?n.jsx(Mv,{ref:c,src:e.audioUrl,title:e.title,image:e.image,pending:s,onTime:Q=>h(Math.max(0,Q-OS))}):n.jsxs("div",{className:j("relative aspect-video w-full overflow-hidden border-b border-border bg-surface md:mx-auto md:h-[36vh] md:w-auto md:rounded-lg md:border lg:mx-0 lg:rounded-none lg:border-0",_e?"lg:h-[var(--epv)] lg:max-h-[var(--epvmax)] lg:w-auto":"lg:h-auto lg:w-full"),children:[n.jsx(B6,{episode:e,thumbnailPending:s,audioMode:t,iframeRef:l,enableJsApi:!K,audioControlsRef:c}),n.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 hidden border-border lg:block lg:border"}),_e?n.jsx(Ne,{label:"Drag to resize",side:"top",children:n.jsxs("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize video",onPointerDown:Q=>{Q.preventDefault(),I(!0),L.current={y:Q.clientY,h:Math.min(g,ye)};try{Q.currentTarget.setPointerCapture(Q.pointerId)}catch{}},onPointerMove:Q=>{if(!L.current)return;const re=Q.clientY-L.current.y;De(L.current.h+re)},onPointerUp:Q=>{L.current=null,I(!1);try{Q.currentTarget.releasePointerCapture(Q.pointerId)}catch{}},onPointerCancel:()=>{L.current=null,I(!1)},className:j("absolute bottom-2.5 left-1/2 z-20 hidden -translate-x-1/2 cursor-row-resize touch-none items-center justify-center gap-1.5 rounded-full border border-white/15 bg-black/55 px-3 py-1 text-white/85 backdrop-blur-sm transition-opacity duration-150 lg:flex",$?"opacity-100":"pointer-events-none opacity-0",F?"border-green/70 text-green":"hover:border-green/70 hover:text-green"),children:[n.jsx("span",{className:"h-px w-4 bg-current opacity-60"}),n.jsx(JU,{size:13,strokeWidth:2.25,className:"shrink-0"}),n.jsx("span",{className:"h-px w-4 bg-current opacity-60"})]})}):null]})}),Y?n.jsxs("aside",{className:"relative hidden lg:flex lg:flex-col lg:w-[300px] lg:shrink-0 lg:h-[var(--epv)] lg:max-h-[min(var(--epvmax),calc(100vh-1.5rem))]",children:[W.length>0||!o?n.jsx(_u,{className:"lg:min-h-0 lg:shrink",chapters:W,activeT:He,onJump:ee,loading:W.length===0}):null,n.jsxs("div",{className:"mt-auto flex items-center justify-between pt-2",children:[n.jsxs("div",{className:j("flex items-center gap-2 transition-opacity duration-200",$?"opacity-100":"opacity-0"),children:[n.jsx(jd,{settings:T,onChange:A,wide:k,onWideChange:C,isMobile:_,canGoWide:x,showTranscript:!P,onTranscriptToggle:U,panelUp:!0,panelLeft:!0,floating:!0}),n.jsx(LS,{episode:e,target:"audio",floating:!0})]}),n.jsx(Q1,{edit:i,floating:!0})]})]}):null]}),n.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-full hidden h-3 bg-gradient-to-b from-bg to-transparent lg:block"})]}),n.jsxs("div",{className:j("mx-auto w-full",!(k&&x)&&"lg:max-w-[1120px]",We&&"lg:flex lg:items-start lg:gap-6"),children:[n.jsxs("div",{className:j("min-w-0",We&&"lg:flex-1"),children:[n.jsxs("div",{className:"mt-3 flex items-center justify-between gap-3 lg:mt-6",children:[n.jsx("h1",{className:"min-w-0 font-body text-text text-[16px] md:text-[20px] font-medium leading-snug",children:e.title}),n.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[J&&!Z&&!Y?n.jsx(jd,{settings:T,onChange:A,wide:k,onWideChange:C,isMobile:_,canGoWide:x,showTranscript:!P,onTranscriptToggle:U}):null,n.jsx(eo,{episode:e,className:Z?"hidden md:flex":void 0})]}),Z?null:n.jsxs("div",{className:"flex items-center gap-2 font-num text-[12px] tabular-nums text-muted",children:[n.jsx("span",{children:e.publishedLabel}),e.number?n.jsxs(n.Fragment,{children:[n.jsx("span",{"aria-hidden":!0,
505className:"h-3 w-px bg-border2"}),n.jsxs("span",{children:["EP ",e.number]})]}):null]})]})]}),Ie?n.jsx(XA,{segments:a,setCode:e.setCode,onSeek:ie?Se:void 0,currentTime:f,collapsedChapters:Fe,onToggleChapter:st,features:T,topInset:m,edit:i,headerAction:_?n.jsx(jd,{settings:T,onChange:A,wide:k,onWideChange:C,isMobile:_,canGoWide:x,showTranscript:!P,onTranscriptToggle:U}):void 0}):!o&&Z?n.jsx(YA,{}):o&&we.length>0?n.jsx(Pte,{episodes:we}):null]}),We&&(W.length>0||!o)?n.jsxs("aside",{className:"hidden lg:mt-6 lg:flex lg:flex-col lg:sticky lg:self-start lg:w-[300px] lg:shrink-0",style:{top:m+24,maxHeight:`calc(100vh - ${m+48}px)`},children:[n.jsx(_u,{className:"lg:min-h-0 lg:shrink",chapters:W,activeT:He,onJump:ee,loading:W.length===0}),n.jsxs("div",{className:"flex items-center justify-between pt-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(jd,{settings:T,onChange:A,wide:k,onWideChange:C,isMobile:_,canGoWide:x,showTranscript:!P,onTranscriptToggle:U,panelUp:!0,panelLeft:!0}),n.jsx(LS,{episode:e,target:"video"})]}),n.jsx(Q1,{edit:i})]})]}):null]}),n.jsx(JA,{edit:i})]})}function jd({settings:e,onChange:t,wide:s,onWideChange:r,isMobile:a,canGoWide:o,panelUp:i=!1,panelLeft:l=!1,floating:c=!1,articleMode:d=!1,block:u=!1,showTranscript:f=!0,onTranscriptToggle:h}){const[m,y]=p.useState(!1),b=n.jsxs("div",{className:"flex flex-col",children:[h?n.jsx(ah,{label:"Show Transcript",on:f,onToggle:h}):null,f?n.jsxs(n.Fragment,{children:[h?n.jsx("div",{className:"my-1 h-px bg-border"}):null,n.jsx(Tte,{label:"Text Size",children:n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"font-display text-[11px] leading-none text-muted",children:"A"}),n.jsx("input",{type:"range",min:13,max:17,step:1,value:e.textPx,onChange:w=>t({...e,textPx:Number(w.target.value)}),"aria-label":"Text size",className:"h-1 w-16 cursor-pointer accent-green hover:accent-green-2"}),n.jsx("span",{className:"font-display text-[15px] leading-none text-muted",children:"A"})]})}),d?null:n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"my-1 h-px bg-border"}),n.jsx(ah,{label:"Read Along",on:e.highlight,onToggle:()=>t({...e,highlight:!e.highlight})}),n.jsx(ah,{label:"Auto-Scroll",on:e.autoScroll,onToggle:()=>t({...e,autoScroll:!e.autoScroll})})]})]}):null,o?n.jsx(ah,{label:"Full Width",on:s,onToggle:()=>r(!s)}):null]});return n.jsxs("div",{className:j("relative",u&&"w-full"),children:[n.jsxs("button",{type:"button",onClick:()=>y(w=>!w),"aria-expanded":m,"aria-label":"Reading options",className:j("flex h-8 cursor-pointer items-center border leading-none transition-colors",a?"w-8 justify-center":u?"w-full justify-center gap-1.5 px-2 font-display text-[13px] tracking-[0.02em]":"gap-1.5 px-2.5 font-display text-[14px] tracking-[0.04em]",m?"relative z-50":"",c&&!m&&"bg-surface/95 text-subtle shadow-[0_6px_18px_rgba(0,0,0,0.45)] backdrop-blur-sm",m?"border-green bg-surface text-green":j("border-border2 hover:border-green hover:text-green",c?"":"bg-transparent text-subtle")),children:[n.jsx(eB,{size:a?16:14,strokeWidth:2,className:"shrink-0"}),a?null:n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"whitespace-nowrap",children:u?"Options":"Reading options"}),n.jsx(fs,{size:14,strokeWidth:2.25,className:j("shrink-0 transition-transform",m?"rotate-180":"")})]})]}),m?n.jsxs(n.Fragment,{children:[n.jsx("button",{"aria-hidden":!0,tabIndex:-1,onClick:()=>y(!1),className:"fixed inset-0 z-40 cursor-default"}),n.jsxs("div",{className:j("z-50 border border-border2 bg-surface shadow-[0_12px_34px_rgba(0,0,0,0.6)]",a?"fixed inset-x-0 bottom-0 border-x-0 border-b-0 px-4 pb-6 pt-4":j("absolute w-52 px-3 py-2",i?"bottom-full mb-2":"top-full mt-2",l?"left-0":"right-0")),children:[a?n.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[n.jsx("span",{className:"font-display text-[16px] tracking-[0.02em] text-text",children:"Reading options"}),n.jsx("button",{type:"button",onClick:()=>y(!1),"aria-label":"Close",className:"text-muted hover:text-green",children:n.jsx(rn,{size:18})})]}):null,b]})]}):null]})}function Tte({label:e,children:t}){return n.jsxs("div",{className:"-mx-1 flex items-center justify-between gap-4 roun
505ded px-1 py-1.5 transition-colors hover:bg-white/[0.04]",children:[n.jsx("span",{className:"font-num text-[12px] tracking-[0.01em] text-subtle",children:e}),t]})}function ah({label:e,on:t,onToggle:s}){return n.jsxs("button",{type:"button",role:"switch","aria-checked":t,"aria-label":e,onClick:s,className:"-mx-1 flex w-full cursor-pointer items-center justify-between gap-4 rounded px-1 py-1.5 text-left transition-colors hover:bg-white/[0.04]",children:[n.jsx("span",{className:"font-num text-[12px] tracking-[0.01em] text-subtle",children:e}),n.jsx(AA,{on:t})]})}function _u({chapters:e,activeT:t,onJump:s,loading:r,className:a,style:o,hideTime:i=!1,compact:l=!1}){return n.jsx("nav",{className:j("flex flex-col overflow-y-auto border border-border bg-surface/40",l?"items-stretch px-0 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"px-3",a),style:o,children:r?Array.from({length:9}).map((c,d)=>n.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-border/40 py-2.5 first:border-t-0",children:[n.jsx("div",{className:"h-3 flex-1 animate-pulse bg-border",style:{maxWidth:`${70-d%3*14}%`}}),n.jsx("div",{className:"h-3 w-8 animate-pulse bg-border"})]},d)):e.map(c=>{const d=c.t===t,u=Bp(c.heading),f=h=>{No(h)&&(h.preventDefault(),s(c.t),window.history.replaceState(null,"",`#${u}`))};return l?n.jsx("a",{href:`#${u}`,onClick:f,title:c.heading,className:"group flex cursor-pointer items-center justify-center border-t border-border/40 py-2.5 leading-snug first:border-t-0",children:n.jsx("span",{className:j("font-display text-[15px] uppercase leading-snug transition-colors group-hover:text-green",d?"text-green":"text-subtle"),children:c.heading.trim().charAt(0)})},c.t):n.jsxs("a",{href:`#${u}`,onClick:f,className:"group flex cursor-pointer items-baseline justify-between gap-3 border-t border-border/40 py-2.5 text-left first:border-t-0",children:[n.jsx("span",{className:j("font-display text-[15px] uppercase tracking-[0.02em] leading-snug transition-colors group-hover:text-green",d?"text-green":"text-subtle"),children:c.heading}),i?null:n.jsx("span",{className:"font-num shrink-0 text-[12px] text-green",children:kd(c.t)})]},c.t)})})}function LS({episode:e,target:t,floating:s=!1}){if(!e.slug||t==="audio"&&!e.audioUrl||t==="video"&&!e.youtubeId)return null;const r=t==="audio"?`/episodes/audio/${e.slug}`:`/episodes/${En(e.category)}/${e.slug}`,a=t==="audio"?"Audio version":"Video version",o=t==="audio"?Ac:HT,i=s?"bg-surface/95 shadow-[0_6px_18px_rgba(0,0,0,0.45)] backdrop-blur-sm":"bg-transparent";return n.jsx(Ne,{label:a,side:"top",children:n.jsx(te,{to:r,"aria-label":a,className:j("flex h-8 w-8 items-center justify-center border border-border2 text-subtle transition-colors hover:border-green hover:text-green",i),children:n.jsx(o,{className:"h-4 w-4",strokeWidth:1.75})})})}function DS({episode:e}){const t=!!e.audioUrl,s=!!e.youtubeId;if(!t&&!s||!e.slug)return null;const r="h-[17px] w-[17px] shrink-0 text-muted transition-colors group-hover:text-green";return n.jsxs("span",{className:"hidden items-center gap-2.5 sm:flex",children:[s?n.jsx(Ne,{label:"Video version",side:"bottom",children:n.jsx(te,{to:`/episodes/${En(e.category)}/${e.slug}`,"aria-label":"Video version",className:"group",children:n.jsx(HT,{className:r,strokeWidth:1.75})})}):null,t?n.jsx(Ne,{label:"Audio version",side:"bottom",children:n.jsx(te,{to:`/episodes/audio/${e.slug}`,"aria-label":"Audio version",className:"group",children:n.jsx(Ac,{className:r,strokeWidth:1.75})})}):null]})}function Ete({episode:e}){const{transcript:t,settled:s}=AR(e),r=QA(e.youtubeId??e.id,t??[]),[a,o]=p.useState(()=>new Set),[i,l]=p.useState(qA),c=E=>{l(E),window.localStorage.setItem(Xv,JSON.stringify(E))},[d,u]=p.useState(Jv),f=E=>{u(E),window.localStorage.setItem(GA,E?"1":"0")},[h,m]=p.useState(0),y=p.useRef(null),b=p.useCallback(E=>{var P;if((P=y.current)==null||P.disconnect(),!E)return;const A=()=>m(E.getBoundingClientRect().height);A(),y.current=new ResizeObserver(A),y.current.observe(E)},[]);Qv(h);const w=p.useMemo(()=>(t??[]).filter(E=>E.heading).map(E=>({t:E.t,heading:E.heading})),[t]),x=E=>o(A=>{const P=new Set(A);return P.has(E)?P.delete(E):P.add(E),P}),g=E=>{o(P=>{if(!P.has(E))return P;const M=new Set(P);return M.delete(E),M});const A=document.getElementById(`ch-${E}`);A&&eP(A.getBoundingClientRect().top+window.scrollY-h-12)},v=p.useMemo(()=>t?ZX(e.title,t):"",[t,e.title]),k=!!(t&&t.length>0),S=w.length>0,N=()=>YX(`${e.slug??"transcript"}.txt`,v),[C,_]=p.useState(-1);p.useEffect(()=>{if(!S)return;let E=!1;const A=()=>{E=!1;const M=h+28;let U=-1;for(const F of w){const I=document.getElementById(`ch-${F.t}`);if(I&&I.getBoundingClientRect().top<=M)U=F.t;else break}_(U)},P=()=>{E||(E=!0,requestAnimationFrame(A))};return A(),window.addEventListener("scroll",P,{passive:!0}),()=>window.removeEventListener("scroll",P)},[S,w,h]);const T=(E,A=!1)=>n.jsx(jd,{settings:i,onChange:c,wide:d,onWideChange:f,isMobile:E,canGoWide:!E,articleMode:!0,block:A,panelUp:!1,panelLeft:!1});return n.jsxs("div",{className:j("mx-auto w-full max-w-[1120px]",d&&"lg:max-w-none lg:px-6"),children:[k?n.jsxs("div",{className:j("lg:flex lg:items-start lg:gap-10",d&&"lg:gap-6"),children:[n.jsxs("div",{className:j("min-w-0 flex-1",d?"lg:max-w-none":"lg:max-w-3xl"),children:[n.jsx("div",{ref:b,className:"sticky top-0 z-20 bg-bg pt-3 pb-4 lg:pt-6 lg:pb-6",children:n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("h1",{className:"min-w-0 font-body text-text text-[16px] md:text-[20px] font-medium leading-snug",children:e.title}),n.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[n.jsx(DS,{episode:e}),n.jsx("span",{className:"hidden font-num text-[12px] tracking-[0.06em] text-muted sm:inline",children:e.publishedLabel.toUpperCase()}),n.jsx(eo,{episode:e})]})]})}),n.jsx("div",{className:"border-t border-border",children:n.jsx(XA,{segments:t,setCode:e.setCode,currentTime:0,collapsedChapters:a,onToggleChapter:x,features:{articleMode:!0,textPx:i.textPx},edit:r,headerAction:n.jsxs("div",{className:"flex items-center gap-2 lg:hidden",children:[T(!0),n.jsx("button",{type:"button",onClick:N,"aria-label":"Download transcript",className:"flex h-8 w-8 items-center justify-center border border-border2 text-subtle transition-colors hover:border-green hover:text-green",children:n.jsx(Oj,{size:16,strokeWidth:2})})]})})})]}),S?n.jsxs("aside",{className:"hidden lg:mt-6 lg:flex lg:flex-col lg:sticky lg:self-start lg:w-[300px] lg:shrink-0",style:{to
505p:24,maxHeight:"calc(100vh - 48px)"},children:[n.jsx(_u,{className:"lg:min-h-0 lg:shrink",chapters:w,activeT:C,onJump:g,loading:!1,hideTime:!0}),n.jsxs("div",{className:j("mt-3 grid gap-2",r.canEdit?"grid-cols-3":"grid-cols-2"),children:[n.jsx(Q1,{edit:r,block:!0}),n.jsxs("button",{type:"button",onClick:N,className:"flex h-8 w-full items-center justify-center gap-1.5 border border-border2 px-2 font-display text-[13px] leading-none tracking-[0.02em] text-subtle transition-colors hover:border-green hover:text-green",children:[n.jsx(Oj,{size:14,strokeWidth:2,className:"shrink-0"}),n.jsx("span",{className:"leading-none",children:"Download"})]}),T(!1,!0)]})]}):null]}):s?n.jsxs("div",{className:"mx-auto max-w-3xl pt-6 lg:pt-10",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("h1",{className:"min-w-0 font-body text-text text-[16px] md:text-[20px] font-medium leading-snug",children:e.title}),n.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[n.jsx(DS,{episode:e}),n.jsx("span",{className:"hidden font-num text-[12px] tracking-[0.06em] text-muted sm:inline",children:e.publishedLabel.toUpperCase()}),n.jsx(eo,{episode:e})]})]}),n.jsx("p",{className:"mt-6 text-[14px] text-muted",children:"No transcript available"}),(e.youtubeId||e.audioUrl)&&e.slug?n.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-x-5 gap-y-2",children:[e.youtubeId?n.jsxs(te,{to:`/episodes/${En(e.category)}/${e.slug}`,className:"inline-flex items-center gap-1.5 text-[14px] text-subtle transition-colors hover:text-green",children:[n.jsx(Gm,{size:15,className:"shrink-0"}),"Watch this episode"]}):null,e.audioUrl?n.jsxs(te,{to:`/episodes/audio/${e.slug}`,className:"inline-flex items-center gap-1.5 text-[14px] text-subtle transition-colors hover:text-green",children:[n.jsx(Ac,{size:15,strokeWidth:2,className:"shrink-0"}),"Listen to this episode"]}):null]}):null]}):n.jsx(ZA,{}),n.jsx(JA,{edit:r})]})}function ZA(){const e=Jv();return n.jsxs("div",{className:j("lg:flex lg:items-start lg:gap-10",e&&"lg:gap-6"),children:[n.jsxs("div",{className:j("min-w-0 flex-1",e?"lg:max-w-none":"lg:max-w-3xl"),children:[n.jsxs("div",{className:"flex items-center justify-between gap-3 pt-3 pb-4 lg:pt-6 lg:pb-6",children:[n.jsx("div",{className:"h-6 w-2/3 max-w-xl animate-pulse rounded bg-surface md:h-7"}),n.jsx("div",{className:"h-5 w-20 shrink-0 animate-pulse rounded bg-surface"})]}),n.jsx("div",{className:"border-t border-border pt-2 lg:pt-4",children:Array.from({length:3}).map((t,s)=>n.jsxs("div",{className:s===0?"":"mt-8",children:[n.jsx("div",{className:"mb-3 h-5 w-1/3 animate-pulse bg-surface"}),n.jsx("div",{className:"space-y-2.5",children:Array.from({length:4}).map((r,a)=>n.jsx("div",{className:"h-4 animate-pulse bg-surface",style:{width:`${96-a%4*9}%`}},a))})]},s))})]}),n.jsxs("aside",{className:"hidden lg:mt-6 lg:block lg:w-[300px] lg:shrink-0",children:[n.jsx(_u,{className:"lg:max-h-[70vh]",chapters:[],activeT:-1,onJump:()=>{},loading:!0,hideTime:!0}),n.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[n.jsx("div",{className:"h-8 animate-pulse bg-surface"}),n.jsx("div",{className:"h-8 animate-pulse bg-surface"})]})]})]})}function Rte(){const e=Jv();return n.jsx("div",{className:j("mx-auto w-full max-w-[1120px]",e&&"lg:max-w-none lg:px-6"),children:n.jsx(ZA,{})})}function Ate(){return n.jsxs("div",{className:"mx-auto w-full max-w-[1120px]",children:[n.jsxs("div",{className:"-mx-4 -mt-6 md:-mx-6 md:mt-0 md:px-6 lg:-mx-5 lg:px-5 lg:flex lg:items-start lg:gap-4",style:{"--epv":`${FA()}vh`},children:[n.jsx("div",{className:"relative aspect-video w-full animate-pulse border-b border-border bg-surface md:mx-auto md:h-[36vh] md:w-auto md:rounded-lg md:border lg:mx-0 lg:h-[var(--epv)] lg:max-h-[calc((min(100vw,1120px)_-_316px)*0.5625)] lg:w-auto lg:shrink-0 lg:rounded-none lg:border-0"}),n.jsx(_u,{className:"hidden lg:flex lg:w-[300px] lg:shrink-0 lg:max-h-[var(--epv,40vh)]",chapters:[],activeT:-1,onJump:()=>{},loading:!0})]}),n.jsx("div",{className:"mt-3 h-6 w-3/4 animate-pulse bg-surface md:h-7 lg:mt-6"}),n.jsx(YA,{})]})}
505function YA(){return n.jsx("div",{className:"mt-4 border-t border-border pt-4 lg:mt-6",children:Array.from({length:3}).map((e,t)=>n.jsxs("div",{className:t===0?"":"mt-8",children:[n.jsx("div",{className:"mb-3 h-5 w-1/3 animate-pulse bg-surface"}),n.jsx("div",{className:"space-y-2.5",children:Array.from({length:4}).map((s,r)=>n.jsx("div",{className:"h-4 animate-pulse bg-surface",style:{width:`${96-r%4*9}%`}},r))})]},t))})}function Pte({episodes:e}){return n.jsxs("div",{className:"mt-8 border-t border-border pt-6",children:[n.jsx("h2",{className:"mb-4 font-display text-text text-[16px] tracking-[0.02em]",children:"More episodes"}),n.jsx("div",{className:"flex flex-col gap-3",children:e.map(t=>n.jsx(Ote,{episode:t},t.id))})]})}function Ote({episode:e}){const t=e.slug?`/episodes/${En(e.category)}/${e.slug}`:null,s=n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"relative aspect-video w-36 shrink-0 overflow-hidden rounded-md border border-border bg-surface sm:w-44",children:n.jsx(ki,{src:e.image,className:"transition-transform duration-300 group-hover/row:scale-[1.06]"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-start justify-between gap-2",children:[n.jsx(RA,{episode:e}),n.jsx(eo,{episode:e,className:"mt-0.5"})]}),n.jsx("span",{className:"mt-1 block font-body text-text text-[14px] md:text-[15px] font-medium leading-snug line-clamp-2 transition-colors group-hover/row:text-green",children:e.title})]})]});return t?n.jsx(te,{to:t,className:"group/row flex gap-3 no-underline",children:s}):n.jsx("a",{href:e.link,target:"_blank",rel:"noreferrer",className:"group/row flex gap-3 no-underline",children:s})}const IS=["Alex","Marc","Abram"];function Lte(e){const t=[],s=new Set,r=d=>{d.speaker&&!s.has(d.speaker)&&(s.add(d.speaker),t.push(d.speaker))};for(const d of e)d.kind==="para"?r(d):d.kind==="section"&&d.paras.forEach(r);const a=IS.filter(d=>s.has(d)),o=t.filter(d=>!IS.includes(d)),i=new Map;[...a,...o].forEach((d,u)=>i.set(d,u));let l;const c=d=>{d.speaker&&(d.lane=i.get(d.speaker),d.speaker!==l&&(d.showName=!0),l=d.speaker)};for(const d of e)d.kind==="chapter"?l=void 0:d.kind==="para"?c(d):d.kind==="section"&&d.paras.forEach(c)}function Dte(e){const t=[];return e.forEach((s,r)=>{const a=t[t.length-1];s.speaker&&a&&a.speaker===s.speaker?a.paras.push({para:s,paraIndex:r}):t.push({speaker:s.speaker,lane:s.lane,showName:s.showName,paras:[{para:s,paraIndex:r}]})}),t}function Ite(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Bp=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),Mte="https://www.patreon.com/limitedlevelups",MS=/patreon(?:\.com|\s+dot\s+com)?\s*(?:\/|\s+slash\s+)\s*limited[-\s]*level[-\s]*ups/gi,$S=/\b(?:https?:\/\/)?(?:www\.)?(17lands\.com|limitedlevelups\.com)(\/[^\s)]*)?/gi;function QA(e,t){const{user:s}=Qn(),r=dn(),a=!!e&&ete(s==null?void 0:s.discordId),[o,i]=p.useState(!1),[l,c]=p.useState(t),[d,u]=p.useState("idle"),[f,h]=p.useState(null),m=d==="saving",y=()=>{c(structuredClone(t)),u("idle"),h(null),i(!0)},b=()=>{i(!1),u("idle"),h(null)},w=(S,N,C)=>{c(_=>{const T=_.slice(),E={...T[S]};if(N==="text")E.text=C;else{const A=C.trim();A?E[N]=A:delete E[N]}return T[S]=E,T})},x=S=>{c(N=>{const C=N.slice(),_={...C[S]};return delete _.subheading,C[S]=_,C})},g=!m;return{canEdit:a,editing:o,working:l,saving:m,status:d,message:f,canSave:g,enterEdit:y,discard:b,save:async()=>{if(!(!e||!g)){u("saving"),h(null);try{const S=await ste(e,l);r.setQueryData(["episode-transcript",e],S),i(!1),u("saved"),window.setTimeout(()=>u(N=>N==="saved"?"idle":N),2500)}catch(S){u("error"),h(S instanceof Error?S.message:"Save failed"),window.setTimeout(()=>u(N=>N==="error"?"idle":N),6e3)}}},dismiss:()=>{u("idle"),h(null)},editBlock:w,dropSubheading:x}}function Q1({edit:e,floating:t=!1,block:s=!1}){const r=ut();if(!e.canEdit||r)return null;const a="flex h-8 items-center justify-center gap-1.5 border px-2.5 font-display text-[13px] leading-none tracking-[0.02em] transition-colors",o=t?"bg-surface/95 shadow-[0_6px_18px_rgba(0,0,0,0.45)] backdrop-blur-sm":"";if(!e.editing)return n.jsxs("button",{type:"button",onClick:e.enterEdit,className:j(a,o,s&&"w-full","border-border2 text-subtle hover:border-green hover:text-green"),children:[n.jsx(VT,{size:14,strokeWidth:2,className:"shrink-0"}),n.jsx("span",{className:"leading-none",children:"Edit"})]});const i=n.jsx("button",{type:"button",onClick:e.discard,"aria-label":"Discard",className:j("flex h-8 w-8 shrink-0 items-center justify-center border transition-colors",o,"border-border2 text-subtle hover:border-text hover:text-text"),children:n.jsx(rn,{size:16,strokeWidth:2})}),l=n.jsx("button",{type:"button",onClick:e.save,disabled:!e.canSave,className:j(a,o,s&&"flex-1 px-1.5","border-green text-green hover:bg-green/10","disabled:cursor-not-allowed disabled:border-border2 disabled:text-dim disabled:hover:bg-transparent"),children:e.saving?n.jsxs(n.Fragment,{children:[n.jsx(Jy,{size:14,strokeWidth:2,className:"shrink-0 animate-spin"}),n.jsx("span",{className:"leading-none",children:"Saving"})]}):"Save"});return s?n.jsxs("div",{className:"flex gap-1.5",children:[i,l]}):n.jsxs("div",{className:"flex items-center gap-2",children:[i,l]})}function JA({edit:e}){if(!ut()||!e.canEdit)return null;const s="flex h-12 w-12 items-center justify-center rounded-full border shadow-[0_6px_18px_rgba(0,0,0,0.45)] bg-surface/95 backdrop-blur-sm transition-colors",r=e.editing?n.jsx("div",{className:"flex flex-col items-end gap-2",children:n.jsxs("div",{className:"flex gap-3",children:[n.jsx("button",{type:"button",onClick:e.discard,"aria-label":"Cancel",className:j(s,"border-border2 text-subtle"),children:n.jsx(rn,{size:20,strokeWidth:2})}),n.jsx("button",{type:"button",onClick:e.save,disabled:!e.canSave,"aria-label":"Save",className:j(s,"border-green text-green disabled:border-border2 disabled:text-dim"),children:e.saving?n.jsx(Jy,{size:20,strokeWidth:2,className:"animate-spin"}):n.jsx(qy,{size:20,strokeWidth:2})})]})}):n.jsx("button",{type:"button",onClick:e.enterEdit,"aria-label":"Edit transcript",className:j(s,"border-border2 text-subtle active:border-green active:text-green"),children:n.jsx(VT,{size:20,strokeWidth:2})});return It.createPortal(n.jsx("div",{className:"fixed bottom-5 right-5 z-50",children:r}),document.body)}function XA({segments:e,setCode:t,onSeek:s,currentTime:r,collapsedChapters:a,onToggleChapter:o,features:i,topInset:l=0,headerAction:c,edit:d}){const u=(i==null?void 0:i.articleMode)??!1,f=((i==null?void 0:i.highlight)??!0)&&!u,h=((i==null?void 0:i.autoScroll)??!1)&&!u,m=(i==null?void 0:i.textPx)??15,y=p.useRef(null),b=p.useMemo(()=>{const D=new Set;for(const L of e)for(const $ of L.cards??[])D.add($.name);return[...D].sort((L,$)=>$.length-L.length)},[e]),w=p.useMemo(()=>new Set(b),[b]),x=p.useMemo(()=>t?b.map(D=>({name:D,set:t})):[],[b,t]),g=Mi(x),v=p.useMemo(()=>{const D=[];let L=null;return e.forEach(($,V)=>{const z=Gv($.text);if(!z.trim())return;const K=$.speaker,W={t:$.t,text:z,segment:V,speaker:K},J=()=>({...W,kind:"para",pieces:[{text:z,segment:V}]});if($.heading)L=null,D.push({kind:"chapter",t:$.t,heading:$.heading,segment:V}),D.push(J());else if($.subheading)L={kind:"section",t:$.t,title:$.subheading,segment:V,paras:[W]},D.push(L);else if(L)L.paras.push(W);else{const Z=D[D.length-1];K&&Z&&Z.kind==="para"&&Z.speaker===K?(Z.text=`${Z.text}
506
507${z}`,Z.pieces.push({text:z,segment:V})):D.push(J())}}),Lte(D),D}
507,[e]),k=v.findIndex(D=>D.kind==="chapter"),S=Rt(),N=p.useRef(""),C=p.useRef(!1);p.useEffect(()=>{const D=decodeURIComponent(S.hash.replace(/^#/,"")).trim();if(!D||v.length===0||N.current===D)return;let L=null;const $=D.match(/^ch-(\d+)$/i);if($)L=Number($[1]);else{const z=D.toLowerCase();for(const K of v)if(K.kind==="chapter"&&Bp(K.heading)===z){L=K.t;break}}if(L===null)return;N.current=D,a.has(L)&&o(L);const V=L;window.setTimeout(()=>{var z;(z=document.getElementById(`ch-${V}`))==null||z.scrollIntoView({behavior:C.current?"smooth":"auto",block:"start"}),C.current=!0},80)},[S.hash,v,a,o]);const _=p.useMemo(()=>{if(!(r>0))return-1;let D=-1;const L=$=>{$<=r+.5&&$>D&&(D=$)};for(const $ of v)$.kind==="para"?L($.t):$.kind==="section"&&$.paras.forEach(V=>L(V.t));return D},[v,r]),T=p.useMemo(()=>{if(!(d!=null&&d.editing)||!f||!(r>0))return-1;let D=-1,L=-1;return d.working.forEach(($,V)=>{$.t<=r+.5&&$.t>L&&(D=V,L=$.t)}),D},[d==null?void 0:d.editing,d==null?void 0:d.working,f,r]),E=p.useRef(null),[A,P]=p.useState(null),M=(D,L)=>{if(d!=null&&d.canEdit)return $=>{const V=$.currentTarget.getBoundingClientRect();P({segment:D,field:L,top:V.top,dx:$.clientX-V.left,dy:$.clientY-V.top}),d.enterEdit()}};p.useLayoutEffect(()=>{var V;if(!(d!=null&&d.editing)||!A)return;P(null);const D=`[data-idx="${A.segment}"][data-field="${A.field}"]`,L=(V=E.current)==null?void 0:V.querySelector(D);if(!L)return;window.scrollBy({top:L.getBoundingClientRect().top-A.top,behavior:"instant"}),L.focus();const $=L.getBoundingClientRect();Ute(L,$.left+A.dx,$.top+A.dy)},[d==null?void 0:d.editing,A]),p.useEffect(()=>{var K;if(!h||!f)return;const D=(K=y.current)==null?void 0:K.querySelector('[data-active="true"]');if(!D)return;const L=D.getBoundingClientRect(),$=l+16,V=window.innerHeight-16;let z=0;L.top<$?z=L.top-$:L.bottom>V&&(z=L.bottom-V),z!==0&&window.scrollBy({top:z,behavior:"smooth"})},[_,h,f,l]);const U=p.useMemo(()=>{const D=new Map;let L=new Set;const $=V=>{const z=new Set;for(const K of b)!L.has(K)&&V.includes(K)&&(z.add(K),L.add(K));return z};return v.forEach((V,z)=>{V.kind==="chapter"?L=new Set:V.kind==="section"?(L=new Set,V.paras.forEach((K,W)=>D.set(`${z}:${W}`,$(K.text)))):D.set(`${z}:0`,$(V.text))}),D},[v,b]),F=(D,L,$)=>{if(b.length===0)return D;const V=new RegExp(`(${b.map(Ite).join("|")})`,"g");return D.split(V).map((z,K)=>w.has(z)?L!=null&&L.has(z)&&!$.has(z)?($.add(z),n.jsx(gte,{name:z,set:t??void 0,cardImages:g},K)):n.jsx("em",{className:"text-subtle/90 italic",children:z},K):z)},I=(D,L)=>{const $=new Set,V="text-green underline transition-colors hover:text-green/70",z=[];MS.lastIndex=0;for(let Z;(Z=MS.exec(D))!==null;)z.push({start:Z.index,end:Z.index+Z[0].length,node:n.jsx("a",{href:Mte,target:"_blank",rel:"noreferrer",className:V,children:"patreon.com/limitedlevelups"})});$S.lastIndex=0;for(let Z;(Z=$S.exec(D))!==null;){const Y=Z[0],ae=`https://${Z[1]}${Z[2]??""}`;z.push({start:Z.index,end:Z.index+Y.length,node:n.jsx("a",{href:ae,target:"_blank",rel:"noreferrer",className:V,children:Y})})}if(z.length===0)return F(D,L,$);z.sort((Z,Y)=>Z.start-Y.start);const K=[];let W=0,J=0;for(const Z of z)Z.start<W||(Z.start>W&&K.push(n.jsx(p.Fragment,{children:F(D.slice(W,Z.start),L,$)},J++)),K.push(n.jsx(p.Fragment,{children:Z.node},J++)),W=Z.end);return W<D.length&&K.push(n.jsx(p.Fragment,{children:F(D.slice(W),L,$)},J++)),K},[q,O]=p.useState(()=>new Set),H=D=>O(L=>{const $=new Set(L);return $.has(D)?$.delete(D):$.add(D),$}),B=p.useMemo(()=>{const D=new Map;let L=-1;return v.forEach(($,V)=>{$.kind==="chapter"?L=$.t:D.set(V,L)}),D},[v]);return n.jsxs("div",{className:j(u?"pt-2 lg:pt-4":"mt-4 border-t border-border pt-4 lg:mt-6"),children:[d&&d.status!=="idle"?n.jsxs("button",{type:"button",onClick:d.dismiss,"aria-label":"Dismiss",className:j("fixed bottom-6 left-1/2 z-50 flex -translate-x-1/2 cursor-pointer items-center gap-2 rounded-md border px-3 py-2","bg-surface/95 text-[13px] shadow-lg shadow-black/50 backdrop-blur-sm transition-colors hover:bg-surface",d.status==="error"?"border-red-400/60 text-red-400":d.status==="saved"?"border-green/60 text-green":"border-border2 text-subtle"),children:[d.status==="saving"?n.jsx(Jy,{size:14,className:"shrink-0 animate-spin"}):null,d.status==="saved"?n.jsx(qy,{size:14,className:"shrink-0"}):null,d.status==="error"?n.jsx(rn,{size:14,className:"shrink-0"}):null,n.jsx("span",{children:d.status==="saving"?"Saving…":d.status==="saved"?"Saved":d.message})]}):null,d!=null&&d.editing?n.jsx("div",{ref:E,className:"w-full",style:{"--tsize":`${m}px`},children:d.working.map((D,L)=>n.jsx($te,{index:L,segment:D,active:L===T,onEdit:d.editBlock,onDropSubheading:d.dropSubheading},L))}):n.jsx("div",{ref:y,className:"w-full",style:{"--tsize":`${m}px`},children:v.map((D,L)=>{if(D.kind!=="chapter"){const V=B.get(L);if(V!==void 0&&V>=0&&a.has(V))return null}if(D.kind==="chapter"){const V=a.has(D.t),z=Bp(D.heading);return n.jsxs("div",{id:`ch-${D.t}`,className:j("mb-1.5 flex items-center gap-2 scroll-mt-[calc(56vw+1rem)] lg:scroll-mt-4",L===k?"mt-0":"mt-8"),children:[n.jsxs("a",{href:`#${z}`,onClick:K=>{No(K)&&(K.preventDefault(),N.current=z,window.history.replaceState(null,"",`#${z}`),o(D.t))},"aria-expanded":!V,className:"group flex items-center gap-2 text-left",children:[n.jsx(rc,{size:18,strokeWidth:2.5,className:j("shrink-0 text-green transition-transform",V?"":"rotate-90")}),n.jsx("h3",{onDoubleClick:M(D.segment,"heading"),className:"font-display text-text text-[19px] tracking-[0.02em] leading-none transition-colors group-hover:text-green",children:D.heading})]}),u?null:s?n.jsx("button",{type:"button",onClick:()=>s(D.t),className:"font-num shrink-0 text-[14px] leading-none text-green transition-colors hover:text-green/70",children:kd(D.t)}):n.jsx("span",{className:"font-num shrink-0 text-[14px] leading-none text-dim",children:kd(D.t)}),c&&L===k?n.jsx("div",{className:"ml-auto",children:c}):null]},L)}if(D.kind==="section"){const V=q.has(L);return n.jsxs("div",{className:"pt-4 first:pt-0",children:[n.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[n.jsxs("button",{type:"button",onClick:()=>H(L),"aria-expanded":!V,className:"group flex items-center gap-1.5 text-left",children:[n.jsx(rc,{size:15,strokeWidth:2.5,className:j("shrink-0 text-green transition-transform",V?"":"rotate-90")}),n.jsx("span",{onDoubleClick:M(D.segment,"subheading"),className:"font-display text-text/90 text-[17px] tracking-[0.02em] leading-none transition-colors group-hover:text-green",children:D.title})]}),u?null:s?n.jsx("button",{type:"button",onClick:()=>s(D.t),className:"font-num ml-1 shrink-0 text-[14px] leading-none text-green transition-colors hover:text-green/70",children:kd(D.t)}):n.jsx("span",{className:"font-num ml-1 shrink-0 text-[14px] leading-none text-dim",children:kd(D.t)})]}),V?null:Dte(D.paras).map((z,K)=>{if(z.speaker){const Y=wd[(z.lane??0)%wd.length];return n.jsxs("div",{className:"mt-3 first:mt-2",children:[z.showName?n.jsx("span",{className:j("mb-1.5 block font-display text-[14px] tracking-[0.1em] leading-none",Y.name),children:z.speaker}):null,n.jsx("div",{className:j("border-l-2 pl-4",Y.border),children:z.paras.map(({para:ae,paraIndex:pe})=>n.jsx("p",{"data-active":f&&ae.t===_,onDoubleClick:M(ae.segment,"text"),className:"text-[length:var(--tsize,15px)] leading-[1.6] mt-2 first:mt-0 text-subtle",children:I(ae.text,U.get(`${L}:${pe}`))},pe))})]},K)}const{para:W,paraIndex:J}=z.paras[0],Z=f&&W.t===_;return n.jsx("p",{"data-active":Z,onDoubleClick:M(W.segment,"text"),className:j("text-[length:var(--tsize,15px)] leading-[1.6] mt-2 transition-colors",Z?"-ml-4 border-l-2 border-green pl-4 text-text":"text-subtle"),children:I(W.text,U.get(`${L}:${J}`))},K)})]},L)}const $=f&&D.t===_;if(D.speaker){const V=wd[(D.lane??0)%wd.length],z=U.get(`${L}:0`);return n.jsxs("div",{className:"mt-5 first:mt-0",children:[D.showName?n.jsx("span",{className:j("mb-1.5 block font-display text-[14px] tracking-[0.1em] leading-none",V.name),children:D.speaker}):null,n.jsx("div",{className:j("border-l-2 pl-4",V.border),children:D.pieces.map((K,W)=>K.text.split(`
508
509`).map((J,Z)=>n.jsx("p",{"data-active":$&&W===0&&Z===0,onDoubleClick:M(K.segment,"text"),className:"text-[length:var(--tsize,15px)] leading-[1.6] mt-2 first:mt-0 text-subtle",children:I(J,z)},`${W}:${Z}`)))})]},L)}return n.jsx("p",{"data-active":$,onDoubleClick:M(D.segment,"text"),className:j("text-[length:var(--tsize,15px)] leading-[1.6] mt-2 transition-colors",$?"-ml-4 border-l-2 border-green pl-4 text-text":"text-subtle"),children:I(D.text,U.get(`${L}:0`))},L)})})]})}function $te({index:e,segment:t,active:s,onEdit:r,onDropSubheading:a}){const o="-mx-1 min-h-[1.2em] cursor-text rounded-sm px-1 outline-none transition-colors hover:bg-green/5 focus:bg-green/10 focus:ring-1 focus:ring-green/40",i=l=>{l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),l.currentTarget.blur())};return n.jsxs("div",{className:"mt-3 first:mt-0",children:[t.heading!==void 0?n.jsx("div",{id:`ch-${t.t}
509`,contentEditable:!0,suppressContentEditableWarning:!0,"data-idx":e,"data-field":"heading",onKeyDown:i,onBlur:l=>r(e,"heading",l.currentTarget.innerText),className:j("mb-1 scroll-mt-[calc(56vw+1rem)] font-display text-text text-[19px] tracking-[0.02em] lg:scroll-mt-4",o),children:t.heading}):null,t.subheading!==void 0?n.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[n.jsx(Ne,{label:"Remove subtopic",side:"top",children:n.jsx("button",{type:"button",onClick:()=>a(e),"aria-label":"Remove subtopic",className:"shrink-0 -translate-y-[1px] text-dim transition-colors hover:text-green",children:n.jsx(iB,{size:16,strokeWidth:2})})}),n.jsx("div",{contentEditable:!0,suppressContentEditableWarning:!0,"data-idx":e,"data-field":"subheading",onKeyDown:i,onBlur:l=>r(e,"subheading",l.currentTarget.innerText),className:j("flex-1 font-display text-text/90 text-[17px] tracking-[0.02em]",o),children:t.subheading})]}):null,n.jsx("div",{className:j(s&&"-ml-4 border-l-2 border-green pl-4"),children:n.jsx("div",{contentEditable:!0,suppressContentEditableWarning:!0,"data-idx":e,"data-field":"text","data-active":s,onKeyDown:i,onBlur:l=>r(e,"text",l.currentTarget.innerText),className:j("text-[length:var(--tsize,15px)] leading-[1.6]",s?"text-text":"text-subtle",o),children:t.text})})]})}function Ute(e,t,s){const r=window.getSelection();if(!r)return;let a=zte(t,s);(!a||!e.contains(a.startContainer))&&(a=document.createRange(),a.selectNodeContents(e),a.collapse(!1)),r.removeAllRanges(),r.addRange(a)}function zte(e,t){if(document.caretPositionFromPoint){const s=document.caretPositionFromPoint(e,t);if(!s)return null;const r=document.createRange();return r.setStart(s.offsetNode,s.offset),r}return document.caretRangeFromPoint(e,t)}function eP(e,t=240){const s=window.scrollY,r=e-s;if(Math.abs(r)<4){window.scrollTo({top:e});return}const a=performance.now(),o=i=>{const l=Math.min(1,(i-a)/t),c=1-Math.pow(1-l,3);window.scrollTo({top:s+r*c}),l<1&&requestAnimationFrame(o)};requestAnimationFrame(o)}function kd(e){const t=Math.floor(e/3600),s=Math.floor(e%3600/60),r=e%60,a=t?String(s).padStart(2,"0"):String(s);return`${t?`${t}:`:""}${a}:${String(r).padStart(2,"0")}`}function US({allCount:e,shortsCount:t,shortsExist:s,audioCount:r,audioExist:a,transcriptsCount:o,transcriptsExist:i,counts:l,activeCategory:c,activeSet:d,shortsView:u,audioView:f,transcriptsView:h,link:m,collapsed:y=!1,onCollapse:b,onExpand:w}){return n.jsxs("nav",{children:[y?n.jsx(Ne,{label:"View Categories",side:"bottom",children:n.jsx("button",{type:"button",onClick:w,"aria-label":"View Categories",className:"flex h-[60px] w-full items-center justify-center border-b border-border text-muted transition-colors hover:text-green",children:n.jsx(Ph,{size:22,strokeWidth:2})})}):b?n.jsx(Ne,{label:"Collapse Library",side:"bottom",align:"end",children:n.jsxs("button",{type:"button",onClick:b,"aria-label":"Collapse Library",className:"group flex h-[60px] w-full items-center gap-2.5 border-b border-border px-4 text-left transition-colors",children:[n.jsx(Ph,{size:22,strokeWidth:2,className:"shrink-0 text-green"}),n.jsx("span",{className:"font-display text-[25px] leading-none tracking-[0.12em] text-text transition-colors group-hover:text-green",children:"LIBRARY"}),n.jsx(YU,{size:20,strokeWidth:2,className:"ml-auto -mr-1 shrink-0 text-muted transition-colors group-hover:text-green"})]})}):n.jsx(PA,{icon:Ph,label:"LIBRARY"}),n.jsxs("div",{children:[n.jsx($o,{label:"All",icon:Sz,count:e,active:!u&&!f&&!h&&!c,collapsed:y,...m(d?Fh(d):"/episodes",null)}),n.jsxs("div",{children:[n.jsx($o,{label:"Evergreen",icon:zd.Evergreen,count:l.get("Evergreen")??0,active:!u&&c==="Evergreen",collapsed:y,...m(`/episodes/${En("Evergreen")}`,d)}),yi.filter(x=>x!=="Evergreen").map(x=>n.jsx($o,{label:x,icon:zd[x],count:l.get(x)??0,active:!u&&c===x,collapsed:y,...m(`/episodes/${En(x)}`,d)},x))]}),s||a||i?n.jsx("div",{className:"mx-4 my-2 border-t border-border"}):null,s?n.jsx($o,{label:"Shorts",icon:ZT,count:t,active:u,collapsed:y,...m("/episodes/shorts",d)}):null,a?n.jsx($o,{label:"Audio",icon:Ac,count:r,active:f,collapsed:y,...m
509("/episodes/audio",d)}):null,i?n.jsx($o,{label:"Transcripts",icon:IT,count:o,active:h,collapsed:y,...m("/episodes/transcripts",d)}):null]})]})}function Bte({query:e,noun:t,category:s,set:r,indent:a,onClear:o}){const i=e.length>0,l=r?` for ${r}`:"",c=s?`${s} ${t}`:t;return n.jsxs("div",{className:"flex animate-fadeIn flex-col items-center py-12 text-center md:py-16 lg:flex-row lg:items-center lg:gap-6 lg:text-left",style:{marginLeft:a},children:[n.jsxs("div",{className:"relative mb-6 flex h-20 w-20 shrink-0 items-center justify-center border border-border2 bg-surface lg:mb-0",style:{clipPath:Uc},children:[n.jsx(Zz,{size:32,strokeWidth:1.5,className:"text-dim"}),n.jsx("span",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_center,rgba(46,232,92,0.10),transparent_70%)]"})]}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("h3",{className:"font-display text-[22px] leading-none tracking-[0.06em] text-text md:text-[26px]",children:i?"No matches found":`No ${c} yet`}),n.jsx("p",{className:"font-mono mt-3 text-[12px] leading-relaxed text-muted",children:i?n.jsxs(n.Fragment,{children:["Nothing matches ",n.jsxs("span",{className:"text-green",children:["“",e,"”"]}),l,".",n.jsx("br",{}),"Try a different title or set."]}):n.jsxs(n.Fragment,{children:["No ",c,l," have been posted yet."]})})]}),i?n.jsxs("button",{type:"button",onClick:o,className:"mt-7 inline-flex h-10 items-center gap-2 border border-border2 px-4 font-display text-[13px] tracking-[0.12em] text-text transition-colors hover:border-green hover:text-green lg:mt-0 lg:ml-2",children:[n.jsx(rn,{size:14,strokeWidth:2,className:"shrink-0"}),"CLEAR SEARCH"]}):null]})}function zS({children:e}){return n.jsx("div",{className:"grid grid-flow-row-dense grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-x-4 gap-y-7",children:e})}function Fte({children:e}){return n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-x-4 gap-y-8",children:e})}function Wte({value:e,onChange:t,className:s}){return n.jsx("div",{className:j("flex h-10 border border-border divide-x divide-border",s),children:bte.map(r=>{const a=r.value===e,o=r.icon;return n.jsx(Ne,{label:`Sort by ${r.label}`,side:"bottom",children:n.jsxs("button",{type:"button",onClick:()=>t(r.value),className:j("flex items-center gap-1.5 px-3 font-display tracking-[0.06em] text-[14px] transition-colors md:px-3.5",a?oi:Rl),children:[n.jsx(o,{size:15,strokeWidth:2,className:"shrink-0"}),r.label]})},r.value)})})}function oh(e,t){if(!t)return!0;const s=[e.title,e.setName??"",e.setCode??""].join(" ").toLowerCase();return t.split(/\s+/).every(r=>s.includes(r))}function Hte(e,t){return e===t?0:e?t?e<t?1:-1:1:-1}function Gte(e,t){const s=[...e];return s.sort((r,a)=>new Date(a.pubDate).getTime()-new Date(r.pubDate).getTime()),t==="oldest"&&s.reverse(),s}function BS(e){return e?rte[zp(e.source)]:0}function FS(e){return e?e.sections+e.subsections:-1}function Vte(e,t,s){const r=t.dir==="asc"?1:-1,a=i=>s==null?void 0:s.get(i.youtubeId??i.id),o=(i,l)=>{var c,d;switch(t.key){case"title":return i.title.localeCompare(l.title);case"set":return(i.setCode??"").localeCompare(l.setCode??"");case"category":return i.category.localeCompare(l.category);case"words":return(((c=a(i))==null?void 0:c.wordCount)??0)-(((d=a(l))==null?void 0:d.wordCount)??0);case"status":return BS(a(i))-BS(a(l));case"structure":return FS(a(i))-FS(a(l));case"date":default:return new Date(i.pubDate).getTime()-new Date(l.pubDate).getTime()}};return[...e].sort((i,l)=>{const c=o(i,l)*r;return c!==0?c:new Date(l.pubDate).getTime()-new Date(i.pubDate).getTime()})}function Fp({className:e,children:t}){return n.jsx("div",{className:j("mx-auto w-full max-w-[1760px] px-4 sm:px-6 lg:px-10",e),children:t})}function Xe({children:e,size:t=11,letterSpacing:s="0.22em",color:r,className:a,style:o}){return n.jsx("div",{className:j("font-display text-muted",a),style:{fontSize:t,letterSpacing:s,...r?{color:r}:null,...o},children:e})}const Kte="A home for Limited players",qte=[gZ[0],"Whether you're looking to get your first trophy, sharpen your fund
509amentals, or compete at the highest level, you'll find a community of Limited enthusiasts ready to help you level up your game."],Zte=[{Icon:Mz,text:"Discuss the latest formats and upcoming sets"},{Icon:cB,text:"Get help with deckbuilding, picks, and gameplay"},{Icon:qT,text:"Play in community organized events"},{Icon:ev,text:"Connect with dedicated Limited players"}],Yte=["Every set covered from start to finish: first impressions as previews drop, a complete set review, then metagame updates as it develops.","Other episodes range from focused deck breakdowns to evergreen lessons on gameplay and big picture strategy that stay relevant from one format to the next."],Qte="Enjoying the show and want to support it? The Patreon rewards are all about getting you better at Limited, with hands-on help that goes beyond the episodes.",Jte=[{Icon:xB,label:"Deck tech help"},{Icon:nz,label:"Draft log review"},{Icon:pB,label:"Group classes"},{Icon:Qy,label:"1-on-1 coaching"}],Xte=[{category:"Set Review",label:"Set reviews"},{category:"Metagame",label:"Format updates"},{category:"Draft",label:"Draft videos",Icon:I6,iconClassName:"text-red"},{category:"Evergreen",label:"Evergreen episodes"}],ese=[{title:"Community leaderboard",live:!0,steps:["Type /join on Discord to link your 17lands profile","Share your trophies and records across sets and formats","See the drafts and decks members are winning with"],to:"/leaderboard",cta:"View the leaderboard",Icon:BY},{title:"Daily pod drafts",steps:[`Sign up for the next draft in [${yR}](${vR})`,"Draft together using [Draftmancer](draftmancer.com) and play the matches live on MTGA","All seats, logs and replays are saved on the site to revisit anytime"],to:"/pods",cta:"Check past & upcoming events",Icon:Hm}];function tse(){const{data:e}=LZ();return{members:e==null?void 0:e.memberCount,online:e==null?void 0:e.onlineCount}}function sse(e){return`/episodes/${En(e)}`}function nse({children:e}){return n.jsx(Xe,{size:22,letterSpacing:"0.14em",className:"text-text",children:e})}function WS({title:e,watermark:t,children:s,className:r,bodyClassName:a}){return n.jsx(ew,{watermark:t,className:r,children:n.jsxs("div",{className:"relative flex flex-1 flex-col px-6 pt-6 pb-6",children:[n.jsx(use,{title:e}),n.jsx("div",{className:j("relative flex-1 pt-5",a),children:s})]})})}const rse={"Set Review":Am,Metagame:Ky,Draft:zT,Sealed:GT,Rankings:FT,Coaching:Qy,Guest:Xy,Evergreen:BT};function ase({host:e,size:t=88}){return n.jsx(as,{displayName:e.name,avatarUrl:e.photo,size:t,green:!0})}const ose={Twitch:XR,YouTube:Gm};function ise({host:e}){const t=e.links.find(r=>r.label==="Twitter"),s=e.links.filter(r=>r.label!=="Twitter");return n.jsxs("div",{className:"flex gap-4",children:[n.jsx(ase,{host:e}),n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"font-display text-text text-[17px] tracking-[0.04em]",children:[e.name," ",t?n.jsxs("a",{href:t.url,target:"_blank",rel:"noreferrer","aria-label":`${e.handle} on X`,className:"text-muted no-underline transition-colors hover:text-green",children:["@",e.handle]}):n.jsx("span",{className:"text-muted",children:e.handle})]}),n.jsx("div",{className:"flex items-center gap-2.5 shrink-0",children:s.map(r=>{const a=ose[r.label];return n.jsx("a",{href:r.url,target:"_blank",rel:"noreferrer","aria-label":r.label,className:"text-subtle transition-colors hover:text-green",children:a?n.jsx(a,{size:16}):r.label},r.label)})})]}),n.jsx("div",{className:"font-mono text-[11px] tracking-[0.12em] text-green uppercase mt-1",children:e.role}),n.jsx("p",{className:"text-subtle text-[13.5px] leading-[1.6] mt-2",children:e.bio})]})]})}const HS=/(\/[a-z][\w-]*)|\[([^\]]+)\]\(([^)]+)\)/g;function lse(e){const t=[];let s=0,r=0,a;for(HS.lastIndex=0;(a=HS.exec(e))!==null;)a.index>s&&t.push(e.slice(s,a.index)),a[1]?t.push(n.jsx("code",{className:"font-mono text-text bg-surface2 border border-border2 px-1.5 py-px text-[12.5px]",children:a[1]},r++)):t.push(n.jsx("a",{href:cse(a[3]),target:"_blank",rel:"noreferrer",className:"relative z-20 font-medium text-text no-underline transition-colors hover:text-green",children:a[2]},r++)),s=a.index+a[0].length;return s<e.length&&t.push(e.slice(s)),t}function cse(e){return/^https?:\/\//.test(e)||e.startsWith("/")?e:`https://${e}`}function dse({event:e,className:t}){return n.jsxs(ew,{watermark:e.Icon,watermarkClassName:"opacity-30 transition-[opacity,color] duration-300 group-hover:opacity-100 group-hover:text-green/[0.14]",className:j("transition-colors hover:border-green",t),children:[n.jsx(te,{to:e.to,"aria-label":e.cta,className:"absolute inset-0 z-10"}),n.jsxs("div",{className:"relative flex flex-1 flex-col px-6 pt-6 pb-6",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(e.Icon,{size:26,className:"shrink-0 text-subtle transition-colors group-hover:text-green"}),n.jsx("span",{className:"font-display text-text text-[26px] leading-[0.95] tracking-[0.03em] transition-colors group-hover:text-green",children:e.title})]}),n.jsx("ul",{className:"mt-4 flex flex-col gap-3",children:e.steps.map(s=>n.jsxs("li",{className:"flex gap-3 text-subtle text-[13.5px] leading-[1.55]",children:[n.jsx("span",{className:"mt-[7px] h-[5px] w-[5px] shrink-0 rotate-45 bg-green"}),n.jsx("span",{className:"flex-1",children:lse(s)})]},s))}),n.jsxs("span",{className:"mt-auto self-end pt-4 inline-flex items-center gap-1.5 whitespace-nowrap font-display text-[15px] tracking-[0.08em] text-green transition-colors group-hover:text-green-2",children:[e.cta,n.jsx(Jt,{size:15})]})]})]})}
509function ew({watermark:e,watermarkClassName:t,href:s,className:r,children:a}){const o="group relative flex h-full flex-col overflow-hidden rounded-xl border border-border bg-surface",i=n.jsxs(n.Fragment,{children:[e?n.jsx(e,{size:120,className:j("pointer-events-none absolute right-8 top-6 text-border2/40 transition-colors duration-200",t)}):null,a]});return s?n.jsx(te,{to:s,className:j(o,"no-underline transition-colors hover:border-green",r),children:i}):n.jsx("section",{className:j(o,r),children:i})}function use({title:e}){return n.jsx("span",{className:"font-display text-text text-[26px] leading-[0.95] tracking-[0.03em]",children:e})}function fse(){return n.jsxs("div",{className:"flex flex-col gap-4",children:[n.jsxs("div",{className:"flex flex-col items-start gap-4 sm:flex-row sm:items-center sm:justify-between sm:gap-6",children:[n.jsx("p",{className:"text-subtle text-[13.5px] leading-[1.6]",children:Qte}),n.jsx(Iv,{label:"BECOME A PATRON",href:Zt.patreon,target:"_blank",className:"shrink-0 self-center whitespace-nowrap sm:self-auto"})]}),n.jsx(hse,{})]})}function hse(){return n.jsx("div",{className:"grid grid-cols-2 gap-2 sm:flex sm:flex-wrap",children:Jte.map(({Icon:e,label:t})=>n.jsxs("span",{className:"flex items-center justify-center gap-2 rounded-lg bg-surface2 px-3 py-2 sm:inline-flex sm:justify-start",children:[n.jsx(e,{size:18,strokeWidth:2,className:"shrink-0 text-green"}),n.jsx("span",{className:"font-display uppercase tracking-[0.06em] text-[14.5px] text-text",children:t})]},t))})}function pse({topics:e}){const t=e??yi.map(s=>({category:s,label:s}));return n.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(({category:s,label:r,Icon:a,iconClassName:o})=>{const i=a??rse[s];return n.jsxs(te,{to:sse(s),className:"group/chip inline-flex flex-1 items-center justify-center gap-2 rounded-lg bg-surface2 px-3 py-2 no-underline transition-all duration-200 hover:-translate-y-0.5 hover:bg-surface hover:ring-1 hover:ring-green/80 sm:flex-none sm:justify-start",children:[n.jsx(i,{size:a?21:18,strokeWidth:a?void 0:2,className:j("shrink-0 transition-transform duration-200 group-hover/chip:scale-110",o??B1[s])}),n.jsx("span",{className:"whitespace-nowrap font-display uppercase tracking-[0.06em] text-[14.5px] text-text transition-colors group-hover/chip:text-green",children:r})]},s)})})}function mse(){const{members:e,online:t}=tse();return n.jsxs($c,{subtitle:"COMMUNITY",children:[n.jsx("section",{className:"border-b border-border",style:{background:"linear-gradient(180deg, #14181f 0%, #0a0c10 100%)"},children:n.jsx(Fp,{className:"pt-4 pb-10 md:py-10",children:n.jsxs("div",{className:"flex flex-col items-center gap-10 lg:flex-row lg:items-center lg:justify-between lg:gap-12 xl:max-w-[1600px] xl:pr-6",children:[n.jsxs("div",{className:"flex flex-col gap-6 max-w-[600px] mx-auto text-center lg:text-left lg:mx-0",children:[n.jsx("h1",{className:"font-display text-text text-[34px] md:text-[48px] leading-[1.02] tracking-[0.01em]",children:Kte}),n.jsx("div",{className:"flex flex-col gap-4",children:qte.map(s=>n.jsx("p",{className:"text-subtle text-[15px] md:text-[16px] leading-[1.7]",children:xse(s)},s.slice(0,16)))})]}),n.jsxs("div",{className:"flex flex-col items-center gap-8 shrink-0 xl:contents",children:[n.jsxs("div",{className:"flex flex-col items-center gap-4 shrink-0",children:[n.jsx(Iv,{label:"JOIN THE DISCHORD",href:Zt.discord,target:"_blank",size:"lg",grow:!0,className:"whitespace-nowrap",icon:n.jsx("span",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-bg text-white shrink-0",children:n.jsx(la,{size:20})})}),n.jsx(gse,{members:e,online:t})]}),n.jsx("div",{className:"shrink-0 flex justify-center",children:n.jsx("ul",{className:"inline-flex flex-col gap-4",children:Zte.map(s=>n.jsxs("li",{className:"flex items-center gap-3 text-subtle text-[15px] leading-[1.4]",children:[n.jsx(s.Icon,{size:18,strokeWidth:2,className:"shrink-0 text-muted"}),s.text]},s.text))})})]})]})})}),n.jsx(Fp,{className:"pt-10 py-10 md:pt-12",children:n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[ese.map(s=>n.jsx(dse,{event:s},s.to)),n.jsxs(WS,{title:n.jsxs("span",{className:"inline-flex items-center gap-3",children:[n.jsx(Xy,{size:26,className:"shrink-0 text-subtle"}),"The show"]}),className:"order-first lg:order-none",children:[n.jsx("div",{className:"mb-5 flex flex-col gap-3",children:Yte.map(s=>n.jsx("p",{className:"text-subtle text-[13.5px] leading-[1.65]",children:s},s.slice(0,16)))}),n.jsx(pse,{topics:Xte}),n.jsxs("div",{className:"mt-6 pt-6 border-t border-border",children:[n.jsx(nse,{children:n.jsxs("span",{className:"inline-flex items-center gap-2",children:[n.jsx(Av,{size:17,className:"text-subtle"}),"SUPPORT"]})}),n.jsx("div",{className:"mt-4",children:n.jsx(fse,{})})]})]}),n.jsx(WS,{title:"The hosts",bodyClassName:"flex flex-1 flex-col justify-center",children:wR.map((s,r)=>n.jsx("div",{className:r>0?"border-t border-border pt-6 mt-6 lg:pt-10 lg:mt-10":void 0,children:n.jsx(ise,{host:s})},s.handle))})]})})]})}
509function xse(e){return e.split(/(Limited Level-Ups|level up your game)/g).map((t,s)=>t==="Limited Level-Ups"?n.jsx("span",{className:"text-green font-medium",children:t},s):t==="level up your game"?n.jsx("strong",{className:"text-text font-semibold",children:t},s):t)}function gse({members:e,online:t}){return e==null?null:n.jsxs("div",{className:"font-mono text-[12px] tracking-[0.12em] text-muted flex flex-wrap items-center justify-center gap-x-4 gap-y-1",children:[n.jsxs("span",{children:[n.jsx("span",{className:"text-text",children:e.toLocaleString()})," MEMBERS"]}),t!=null?n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-green"}),t.toLocaleString()," ONLINE NOW"]}):null]})}const tw={IPA:"Invasion Block",USG:"Urza Block",MH1:"Modern Horizons",MH2:"Modern Horizons 2"},ii=e=>e.toUpperCase()in tw,tP=e=>tw[e.toUpperCase()]??e.toUpperCase(),bse={IPA:["inv","pls","apc"],USG:["usg","ulg","uds"]},yse={MH1:"2019-06-14",MH2:"2021-06-18",USG:"1999-06-07",IPA:"2001-06-04"};function sP(e){if(!e)return e;const t=new Set(e.map(r=>r.code)),s=Object.keys(tw).filter(r=>!t.has(r)).map(r=>{const a=yse[r]??"";return{code:r,name:tP(r),startDate:a,endDate:a,isActive:!1}});return s.length?[...e,...s]:e}const vse="MTGO FLASHBACKS",wse="9999-99-99",jse="",kse=2;function GS(e){return e.startDate||(e.early?wse:jse)}function J1(e,t){const s=ii(e.code),r=ii(t.code);return s!==r?s?1:-1:GS(t).localeCompare(GS(e))}function Sse(e,t,s,r){const{leadPins:a,history:o}=r?nP(e,r):Nse(e),i=Math.max(1,s-a.length);if(o.length<=i)return{visible:[...a,...o],overflow:[]};const l=o.findIndex(b=>b.code===t),c=o.length-i,d=Math.min(kse,Math.max(0,i-2)),u=l<0?0:l-d,f=Math.max(0,Math.min(u,c)),h=o.slice(f,f+i),m=new Set(h.map(b=>b.code)),y=o.filter(b=>!m.has(b.code));return{visible:[...a,...h],overflow:y}}function Nse(e){const t=[],s=e.find(l=>l.isActive),r=e.find(l=>l.code===rs),a=e.filter(l=>l.early&&l.code!==rs&&!l.isActive).sort(J1);t.push(...a),s&&t.push(s),r&&r.code!==(s==null?void 0:s.code)&&t.push(r);const o=new Set(t.map(l=>l.code)),i=e.filter(l=>!o.has(l.code)).sort(J1);return{leadPins:t,history:i}}function Cse(e,t){const{leadPins:s,history:r}=nP(e,t);return[...s,...r]}function nP(e,t){const s=[];for(const a of t){const o=e.find(i=>i.code===a);o&&!s.includes(o)&&s.push(o)}const r=e.filter(a=>!s.includes(a)).sort(J1);return{leadPins:s,history:r}}function sw({sets:e,activeCode:t,hrefFor:s,onPrefetch:r,extraHide:a=0,pins:o}){const i=oJ(e.length,a),{visible:l,overflow:c}=Sse(e,t,i,o);return n.jsxs("div",{className:"flex gap-1.5",children:[l.map(d=>n.jsx(Ese,{set:d,active:d.code===t,href:s(d.code),onHover:r?()=>r(d.code):void 0},d.code)),c.length>0&&n.jsx(Rse,{sets:c,activeCode:t,hrefFor:s})]})}const Wp="polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%)",_se=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];function Tse(e){if(e.isActive||ds(e.code)||!e.startDate)return"";const[t,s]=e.startDate.split("-"),r=_se[Number(s)-1];return r?`${r} '${t.slice(2)}`:""}function Ese({set:e,active:t,href:s,onHover:r}){const a=e.early?n.jsxs("span",{className:"absolute left-0 right-0 top-full mt-1 font-mono flex flex-col items-center text-[10px] leading-[1.15] tracking-[0.12em] text-green",children:[n.jsx("span",{children:"EARLY"}),n.jsx("span",{children:"ACCESS"})]}):n.jsx("span",{className:"absolute left-0 right-0 top-full mt-1 font-mono text-center text-[10px] leading-none tracking-[0.06em] text-muted",children:Tse(e)});return n.jsx(rP,{icon:n.jsx(Ae,{code:Qt(e),size:22,className:t?"text-bg":"text-text"}),label:e.shortCode??e.code,active:t,href:s,onHover:r,caption:a})}function rP({icon:e,label:t,active:s,href:r,onHover:a,caption:o}){return n.jsxs("div",{className:"relative",children:[n.jsx(te,{to:r,onMouseEnter:a,onFocus:a,className:"group block cursor-pointer no-underline",style:{clipPath:Wp,background:s?"#2ee85c":"#3b4458",padding:1,minHeight:42},children:n.jsxs("span",{className:j("flex items-center justify-center gap-[7px] w-[98px] px-[17px] font-display h-full",s?"bg-green text-bg":"bg-surface text-text group-hover:bg-surface2"),style:{clipPath:Wp,minHeight:40},children:[e,n.jsx("span",{className:"text-[20px] tracking-[0.06em] leading-none",children:t})]})}),o]})}function Rse({sets:e,activeCode:t,hrefFor:s}){const r=e.map(o=>({value:o.code,label:o.name,section:ii(o.code)?vse:void 0})),a=o=>{const i=e.find(c=>c.code===o.value),l=ds(o.value);return n.jsxs("span",{className:"flex w-full min-w-0 items-center gap-3",children:[n.jsx(Ae,{code:i?Qt(i):o.value,size:22}),n.jsx("span",{className:"text-[20px] leading-none truncate",children:l?o.label:o.value}),!l&&n.jsx("span",{className:"text-muted text-[13px] tracking-[0.06em] truncate",children:o.label})]})};return n.jsx(yt,{value:t,options:r,hrefFor:s,align:"right",searchable:!0,renderOption:a,renderTrigger:({open:o,toggle:i})=>n.jsx("button",{type:"button",onClick:i,className:"group block cursor-pointer transition-colors",style:{clipPath:Wp,background:"#3b4458",padding:1,minHeight:42},children:n.jsxs("span",{className:"flex items-center gap-2 min-w-[98px] pl-[17px] pr-[21px] font-display transition-colors h-full bg-surface text-text group-hover:bg-surface2",style:{clipPath:Wp,minHeight:40},children:[n.jsxs("span",{className:"text-[20px] tracking-[0.06em] leading-none",children:["+",e.length," ",e.length===1?"SET":"SETS"]}),n.jsx(Et,{strokeWidth:2.5,className:j("text-muted h-4 w-4 transition-transform",o&&"rotate-180")}
509)]})})})}function Ase({sets:e,activeCode:t,hrefFor:s,onPrefetch:r}){const[a,o]=wt.useState(!1),i=e.find(c=>c.code===t)??e[0],l=wt.useRef(null);return wt.useEffect(()=>{if(!a)return;const c=u=>{var f;(f=l.current)!=null&&f.contains(u.target)||o(!1)},d=u=>{u.key==="Escape"&&o(!1)};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d)}},[a]),n.jsxs("div",{ref:l,className:"relative",children:[n.jsxs("button",{onClick:()=>o(c=>!c),className:"w-full py-1.5 px-2.5 flex items-center gap-2 bg-transparent border border-border2 text-text font-display text-[13px] tracking-[0.12em] cursor-pointer",children:[n.jsx(Ae,{code:Qt(i),size:16}),n.jsx("span",{children:ds(i.code)?i.name:i.code}),i.isActive&&n.jsx("span",{className:"text-muted text-[10px] tracking-[0.18em]",children:"· LIVE"}),n.jsx("span",{className:"flex-1"}),n.jsx(Et,{strokeWidth:2.5,className:j("text-muted h-3.5 w-3.5 transition-transform",a&&"rotate-180")})]}),a&&n.jsx("div",{className:"absolute left-0 right-0 top-[calc(100%+4px)] bg-surface border border-border2 z-20",children:e.map(c=>n.jsxs(te,{to:s(c.code),onClick:()=>o(!1),onTouchStart:r?()=>r(c.code):void 0,onFocus:r?()=>r(c.code):void 0,className:j("w-full py-[9px] px-2.5 flex items-center gap-2 border-none border-b border-border text-text font-display text-[13px] tracking-[0.1em] cursor-pointer text-left transition-colors no-underline",c.code===t?"bg-surface2":"bg-transparent hover:bg-surface2"),children:[n.jsx(Ae,{code:Qt(c),size:16}),n.jsx("span",{children:ds(c.code)?c.name:c.shortCode??c.code}),!ds(c.code)&&n.jsx("span",{className:"text-muted text-[10px] tracking-[0.06em] flex-1",children:c.name})]},c.code))})]})}const VS="44px 1fr auto",gg=8;function Pse({rows:e,loading:t=!1}){return t?n.jsx(Lse,{}):!e||e.length===0?n.jsx(Dse,{}):n.jsxs("div",{children:[n.jsxs("div",{className:"grid gap-x-3 py-2.5 pl-2 pr-5 mb-1 font-display text-[11px] tracking-[0.2em] text-muted",style:{gridTemplateColumns:VS},children:[n.jsx("span",{className:"text-center",children:"RANK"}),n.jsx("span",{children:"PLAYER"}),n.jsx("span",{className:"text-right",children:"TROPHIES"})]}),n.jsx("div",{className:"flex flex-col gap-[1px]",children:e.map(s=>n.jsxs(te,{to:Gt(s.slug,s.setCode),className:"group/row grid items-center gap-x-3 py-2.5 pl-2 pr-5 bg-surface hover:bg-surface2 transition-colors no-underline text-inherit",style:{gridTemplateColumns:VS},children:[n.jsx("span",{className:"font-num text-[13px] text-muted text-center",children:s.rank}),n.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[n.jsx(as,{displayName:s.displayName,avatarUrl:s.avatarUrl,size:30}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"font-display text-[18px] leading-none tracking-[0.04em] whitespace-nowrap overflow-hidden text-ellipsis transition-colors group-hover/row:text-green",children:s.displayName.toUpperCase()}),n.jsx(Ose,{decks:s.decks.filter(r=>r.isTrophy)})]})]}),n.jsxs("div",{className:"text-right flex items-center justify-end gap-1.5",children:[n.jsx(ct,{size:18,color:"#ffc63a"}),n.jsx("span",{className:"font-display tracking-[0.02em] tabular-nums leading-none text-[18px]",children:s.trophies})]})]},s.slug))})]})}function Ose({decks:e}){return e.length===0?null:n.jsxs("div",{className:"flex items-center gap-2 mt-1.5 flex-wrap",children:[e.slice(0,gg).map((t,s)=>n.jsx(Be,{colors:t.colors,size:12},`${t.sourceMessageId}-${s}`)),e.length>gg&&n.jsxs("span",{className:"font-num text-[11px] text-dim",children:["+",e.length-gg]})]})}function Lse(){return n.jsx("div",{className:"py-3 px-3.5",children:[0,1,2,3,4].map(e=>n.jsxs("div",{className:"grid gap-2.5 py-2.5 border-b border-border items-center",style:{gridTemplateColumns:"32px 1fr 60px"},children:[n.jsx("div",{className:"h-8 bg-surface2"}),n.jsx("div",{className:"h-3.5 bg-surface2 animate-pulse",style:{width:`${50+e*8}%`}}),n.jsx("div",{className:"h-3.5 bg-surface2"})]},e))})}function Dse(){return n.jsxs("div",{className:"p-10 text-center",children:[n.jsx("div",{className:"font-display text-[22px] tracking-[0.04em] text-text",children:"NO TROPHIES YET"}),n.jsx("div",{className:"font-mono text-[11px] text-muted mt-2",children:"NO TROPHIES LOGGED FOR THIS SET YET. LOG ONE WITH /trophy IN DISCORD."})]})}function fc({children:e,className:t}){return n.jsx("div",{className:j("bg-surface px-4 py-3.5",t),children:e})}
509function Co({count:e,size:t="sm",display:s=!1,fixedDigits:r,className:a}){const o=t==="compact"||t==="sm"?12:16,i=t==="compact"?"text-[12px]":t==="sm"?"text-[11px]":"text-[15px]",l=t==="compact"?"text-[14px]":t==="sm"?"text-[13px]":"text-[17px]",c=r?{display:"inline-block",minWidth:`${r}ch`,textAlign:"right"}:void 0;return n.jsxs("span",{className:j("inline-flex items-center gap-1",a),children:[n.jsx(ct,{size:o,color:"#ffc63a"}),n.jsx("span",{className:j(s?j("font-display leading-none",l):j("font-num",i),!s&&t==="md"&&"font-semibold"),style:c,children:e})]})}function Ise({rows:e,setCode:t,maxColors:s=5,maxRecent:r=10}){const a=p.useMemo(()=>(e??[]).flatMap(c=>c.decks.map(d=>({...d,slug:c.slug,displayName:c.displayName}))),[e]),o=p.useMemo(()=>Mse(a.filter(c=>c.isTrophy)),[a]),i=p.useMemo(()=>[...a].sort((c,d)=>d.reportedAt.localeCompare(c.reportedAt)),[a]),l=p.useMemo(()=>a.filter(c=>c.isTrophy).length,[a]);return n.jsxs("aside",{className:"flex flex-col gap-4",children:[n.jsxs(fc,{children:[n.jsx(Xe,{size:16,className:"mb-1 text-subtle",children:"TOP COLORS"}),n.jsx($se,{topColors:o,maxColors:s,loading:!e})]}),n.jsxs(fc,{children:[n.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[n.jsx(ct,{size:16,color:"#ffc63a"}),n.jsx(Xe,{size:16,className:"text-subtle",children:"RECENT DECKS"})]}),n.jsx(Use,{recent:i,setCode:t,maxRecent:r,loading:!e})]}),e&&n.jsxs("div",{className:"font-mono text-[11px] text-muted -mt-2 flex justify-between px-12",children:[n.jsxs("span",{children:[e.length," PLAYERS"]}),n.jsxs("span",{children:[l," TROPHIES"]})]})]})}function Mse(e){const t=new Map;for(const r of e){const a=Cs(r.colors,!1)?it:Bt(r.colors);a&&t.set(a,(t.get(a)??0)+1)}const s=[...t.entries()].map(([r,a])=>({colors:r,trophies:a}));return s.sort((r,a)=>a.trophies-r.trophies||r.colors.localeCompare(a.colors)),s}function $se({topColors:e,maxColors:t,loading:s}){const[r,a]=p.useState(t);if(s)return n.jsx("div",{className:"font-mono text-[11px] text-muted py-2",children:"LOADING…"});if(e.length===0)return n.jsx("div",{className:"font-mono text-[11px] text-muted py-2",children:"NO TROPHIES YET"});const o=e.length>r;return n.jsxs(n.Fragment,{children:[e.slice(0,r).map((i,l)=>n.jsxs("div",{className:j("grid grid-cols-[24px_28px_1fr_auto] gap-2 items-center py-2",l>0&&"border-t border-border"),children:[n.jsx("span",{className:"font-num text-[11px] text-muted",children:l+1}),n.jsx("span",{className:"flex justify-center",children:i.colors===it?n.jsx(ia,{size:18,className:"shrink-0 block -my-1","aria-hidden":"true"}):n.jsx(Be,{colors:i.colors,size:12})}),n.jsx("span",{className:"font-display text-[14px] tracking-[0.05em] pl-1.5",children:ys(i.colors)}),n.jsx(Co,{count:i.trophies,size:"compact",className:"text-muted"})]},i.colors)),o&&n.jsx(aP,{onClick:()=>a(i=>i+t)})]})}function Use({recent:e,setCode:t,maxRecent:s,loading:r}){const[a,o]=p.useState(s);if(r)return n.jsx("div",{className:"font-mono text-[11px] text-muted py-2",children:"LOADING…"});if(e.length===0)return n.jsx("div",{className:"font-mono text-[11px] text-muted py-2",children:"NO DECKS YET"});const i=e.length>a;return n.jsxs(n.Fragment,{children:[e.slice(0,a).map((l,c)=>{const[d,u]=l.record.split("-").map(h=>Number(h)||0),f=Cs(l.colors,!1);return n.jsxs(te,{to:Gt(l.slug,t),className:j("group grid grid-cols-[auto_1fr_28px_auto] gap-2 items-center py-[7px] -mx-1 px-1 no-underline text-inherit transition-colors hover:bg-surface2",c>0&&"border-t border-border"),children:[f?n.jsxs("span",{className:"inline-flex items-center gap-px shrink-0",children:[n.jsx(Be,{colors:wo(l.colors).slice(0,3),size:10}),n.jsx(ia,{size:12,"aria-hidden":"true"})]}):n.jsx(Be,{colors:l.colors,size:10}),n.jsx("span",{className:"font-display text-[15px] leading-none tracking-[0.04em] whitespace-nowrap overflow-hidden text-ellipsis min-w-0",children:l.displayName.toUpperCase()}),n.jsx(ht,{wins:d,losses:u,mono:!0,className:"font-num text-[13px] text-subtle text-right"}),n.jsxs("span",{className:"flex items-center gap-1.5 justify-end whitespace-nowrap",children:[l.isTrophy&&n.jsx(ct,{size:11,color:"#ffc63a"}),n.jsx("span",{className:"font-mono text-[11px] text-text",children:l.platform}),n.jsx("span",{className:"font-mono text-[11px] text-dim tabular-nums transition-colors group-hover:text-text",children:ro(l.reportedAt)})]})]},`${l.slug}-${l.sourceMessageId}`)}),i&&n.jsx(aP,{onClick:()=>o(l=>l+s)})]})}function aP({onClick:e}){return n.jsxs("button",{type:"button",onClick:e,className:"-mb-3.5 mt-0.5 flex w-full items-center justify-center gap-1.5 border-t border-border bg-transparent py-2 font-display text-[12px] tracking-[0.18em] text-muted transition-colors hover:text-text",children:["SHOW MORE",n.jsx(Et,{size:15,strokeWidth:2.5})]})}function zse(e,t=!1){const s=[...e].sort((r,a)=>KS(a).localeCompare(KS(r)));if(t){const r=s.filter(i=>i.custom),a=s.filter(i=>!i.custom),o=a.findIndex(i=>i.isActive);a.splice(o+1,0,...r),s.splice(0,s.length,...a)}return s.map(r=>({value:r.code,label:r.name,triggerLabel:ds(r.code)?r.name:void 0,glyphCode:Qt(r),meta:r.isActive?n.jsx("span",{className:"font-mono text-[10px] tracking-[0.18em] text-green shrink-0",children:"LIVE"}):void 0}))}function KS(e){return e.startDate||(e.custom?"":"9999-99-99")}function X1({label:e,value:t,options:s,onChange:r,hrefFor:a,variant:o,align:i,searchable:l,searchPlaceholder:c="Search sets or codes…",className:d,triggerClassName:u,subtext:f,valueLabel:h="code"}){const m=new Map(s.map(x=>[x.value,x])),y=x=>{var g;return((g=m.get(x))==null?void 0:g.glyphCode)??x},b=x=>{var g,v;return x.value?n.jsxs("span",{className:"flex w-full items-center gap-2 min-w-0",children:[((g=m.get(x.value))==null?void 0:g.icon)??n.jsx(Ae,{code:y(x.value),size:20,className:"text-white shrink-0"}),n.jsx("span",{className:"truncate",children:h==="name"?x.label:((v=m.get(x.value))==null?void 0:v.triggerLabel)??x.value}),f&&n.jsx("span",{className:"ml-auto shrink-0 pl-2 font-mono text-[9px] tracking-normal text-muted whitespace-nowrap",children:f})]}):x.label},w=x=>{const g=m.get(x.value);return n.jsxs("span",{className:"flex w-full min-w-0 items-center gap-2.5",children:[(g==null?void 0:g.icon)??(x.value?n.jsx(Ae,{code:y(x.value),size:20}):n.jsx("span",{className:"w-5 shrink-0"})),g!=null&&g.code?n.jsxs("span",{className:"flex-1 min-w-0 flex items-baseline gap-2",children:[n.jsx("span",{className:"shrink-0 leading-none",children:g.code}),n.jsx("span",{className:"truncate text-muted text-[11px] tracking-[0.08em]",children:x.label})]}):n.jsx("span",{className:"flex-1 truncate",children:x.label}),(g==null?void 0:g.meta)??null]})};return n.jsx(yt,{label:e,value:t,options:s,onChange:r,hrefFor:a,variant:o,align:i,renderValue:b,renderOption:w,searchable:l,searchPlaceholder:c,className:d,triggerClassName:u})}function oP({activeCode:e,hrefFor:t,chips:s,includeAll:r=!0,variant:a="desktop",loading:o=!1}){const i=r?["ALL",...s]:s,l=a==="mobile";return n.jsxs("div",{className:j("flex items-center gap-1 flex-wrap min-w-0",l&&"flex-nowrap overflow-x-auto no-scrollbar pb-2 -mb-2 w-full"),children:[i.map(c=>n.jsx(Fse,{code:c,active:c===e,href:t(c===e&&c!=="ALL"?"ALL":c),pipSize:12},c)),o&&s.length===0&&Bse.map((c,d)=>n.jsx("span",{className:"shrink-0 h-[26px] border border-border2 bg-surface2/40 animate-pulse",style:{width:c},"aria-hidden":"true"},d))]})}const Bse=[44,60,60,44,44,60,44,52];function Fse({code:e,active:t,href:s,pipSize:r}){if(e==="ALL"||e===it||e===kt){const a=e==="ALL"?"ALL":ys(e),o=t&&e==="ALL",i=t&&e!=="ALL";return n.jsxs(te,{to:s,className:j("shrink-0 h-[26px] px-2.5 border inline-flex items-center gap-1.5 cursor-pointer transition-colors no-u
509nderline font-display tracking-[0.18em] text-[13px]",i&&oi,o&&"border-border2 bg-surface text-text",!t&&Rl),children:[e===it&&n.jsx(ia,{size:r,"aria-hidden":"true"}),e===kt&&n.jsx(uo,{size:r-1,"aria-hidden":"true"}),a]})}return n.jsx(te,{to:s,className:j("shrink-0 h-[26px] px-[7px] border inline-flex items-center gap-0.5 cursor-pointer transition-colors no-underline",t?oi:Rl),"aria-label":e,children:[...e].map(a=>n.jsx(fr,{c:a,size:r},a))})}const Wse={Bronze:"bronze",Silver:"silver",Gold:"gold",Platinum:"plat",Diamond:"diamond"};function Hse(e){if(!e)return null;const[t,s]=e.split("-");if(t==="Mythic")return{label:"Mythic",file:"mythic"};const r=Wse[t],a=Number(s);return!r||!(a>=1&&a<=4)?null:{label:`${t} ${a}`,file:`${r}${a}`}}function Tu({endRank:e,size:t=24,title:s,className:r}){const a=Hse(e);return a?n.jsx("img",{src:`/rank/${a.file}.png`,alt:a.label,title:s??a.label,className:r,style:{height:t,width:"auto"}}):null}function Gse({setCode:e,playerSetCode:t,colors:s="ALL",format:r="ALL",otherCombos:a=[],colorsHref:o,searchParams:i,stats:l,updated:c,maxColors:d=5,maxRecent:u=10}){const[f,h]=p.useState("ALL"),m=r!=="ALL"||s!=="ALL"||f!=="ALL",[y,b]=p.useState(u),w=cP({setCode:e,playerSetCode:t,colors:s,format:r,rank:f,otherCombos:a,maxRecent:y},i),x=!!(w.recentScoped&&w.recentScoped.length>=y);return n.jsxs("aside",{className:"flex flex-col gap-4",children:[n.jsxs(fc,{children:[n.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[n.jsx(ct,{size:16,color:"#ffc63a"}),n.jsx(Xe,{size:16,className:"text-subtle whitespace-nowrap",children:w.topColorsTitle}),n.jsx(yt,{value:f,onChange:h,options:Zse,renderOption:Yse,align:"right",className:"ml-auto shrink-0",renderTrigger:({open:g,selected:v,toggle:k})=>n.jsxs("button",{type:"button",onClick:k,"aria-expanded":g,className:j("relative flex h-7 items-center justify-center border bg-transparent pl-2.5 pr-6 font-display tracking-[0.06em] text-[12px] leading-none cursor-pointer transition-colors",g?"border-green text-green":"border-border2 text-text hover:border-green hover:text-green"),children:[n.jsxs("span",{className:"animate-fadeIn flex items-center gap-1.5 whitespace-nowrap",children:[v.value!=="ALL"&&n.jsx(Tu,{endRank:v.value==="Mythic"?"Mythic":`${v.value}-1`,size:15,title:v.label}),v.value==="ALL"?"ALL RANKS":v.label]},v.value),n.jsx(Et,{size:14,strokeWidth:2.5,className:j("absolute right-1 transition-transform",g&&"rotate-180")})]})})]}),n.jsx(iP,{topColors:w.topColors,maxColors:d,colors:s,colorsHref:o,lcqScope:w.lcqScope})]}),n.jsxs(fc,{children:[n.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[n.jsx(ct,{size:16,color:"#ffc63a"}),n.jsx(Xe,{size:16,className:"text-subtle",children:w.recentTitle}),!m&&c&&n.jsxs("span",{className:"ml-auto font-mono text-[11px] text-muted whitespace-nowrap",children:["UPDATED ",c]}),w.namedScope&&n.jsx("span",{className:"ml-auto inline-flex items-center",children:n.jsx(Be,{colors:s,size:12})}),s===it&&n.jsx(ia,{size:13,className:"ml-auto","aria-hidden":"true"}),s===kt&&n.jsx(uo,{size:12,className:"ml-auto","aria-hidden":"true"})]}),n.jsx(lP,{recentScoped:w.recentScoped,recentEmpty:w.recentEmpty,cube:w.cube,showRowPips:w.showRowPips,linkSetCode:w.linkSetCode,qs:w.qs}),x&&n.jsxs("button",{type:"button",onClick:()=>b(g=>g+u),className:"-mb-3.5 mt-0.5 flex w-full items-center justify-center gap-1.5 border-t border-border bg-transparent py-2 font-display text-[12px] tracking-[0.18em] text-muted transition-colors hover:text-text",children:["SHOW MORE",n.jsx(Et,{size:15,strokeWidth:2.5})]})]}),l&&n.jsxs("div",{className:"font-mono text-[11px] text-muted -mt-2 flex justify-between px-12",children:[n.jsxs("span",{children:[l.players," PLAYERS"]}),n.jsxs("span",{children:[l.events," EVENTS"]})]})]})}function Vse({setCode:e,playerSetCode:t,colors:s="ALL",format:r="ALL",otherCombos:a=[],colorsHref:o,searchParams:i,maxColors:l=12,maxRecent:c=25}){const d=cP({setCode:e,playerSetCode:t,colors:s,format:r,otherCombos:a,maxRecent:c},i),[u,f]=p.useState(null),h=p.useRef(null);return p.useEffect(()=>{if(!u)return;const m=b=>{var w;(w=h.current)!=null&&w.contains(b.target)||f(null)},y=b=>{b.key==="Escape"&&f(null)};return document.addEventListener("mousedown",m),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",y)}},[u]),n.jsxs("div",{ref:h,className:"relative border-b border-border bg-bg",children:[n.jsxs("div",{className:"grid grid-cols-2",children:[n.jsx(qS,{open:u==="colors",onClick:()=>f(m=>m==="colors"?null:"colors"),children:"TOP COLORS"}),n.jsxs(qS,{open:u==="recent",onClick:()=>f(m=>m==="recent"?null:"recent"),className:"border-l border-border",children:[n.jsx(ct,{size:13,color:"#ffc63a"}),"RECENT"]})]}),u&&n.jsx("div",{className:"menu-scrollbar absolute inset-x-0 top-full z-20 max-h-[min(62vh,460px)] overflow-y-auto border-b border-border bg-surface px-3 py-1.5 shadow-lg",children:u==="colors"?n.jsx(iP,{topColors:d.topColors,maxColors:l,colors:s,colorsHref:o,onPick:()=>f(null),lcqScope:d.lcqScope}):n.jsx(lP,{recentScoped:d.recentScoped,recentEmpty:d.recentEmpty,cube:d.cube,showRowPips:d.showRowPips,linkSetCode:d.linkSetCode,qs:d.qs})})]})}function qS({open:e,onClick:t,className:s,children:r}){return n.jsxs("button",{type:"button",onClick:t,"aria-expanded":e,className:j("flex items-center justify-center gap-1.5 py-2 bg-transparent font-display text-[12px] tracking-[0.2em] text-subtle transition-colors hover:bg-surface",e&&"bg-surface text-text",s),children:[r,n.jsx(Et,{size:15,strokeWidth:2.5,className:j("text-muted transition-transform",e&&"rotate-180")}
509)]})}function iP({topColors:e,maxColors:t,colors:s,colorsHref:r,onPick:a,lcqScope:o}){const[i,l]=p.useState(t);if(!e)return n.jsx("div",{className:"font-mono text-[11px] text-muted py-2",children:"LOADING…"});if(e.length===0)return n.jsx("div",{className:"font-mono text-[11px] text-muted py-2",children:"NO TROPHIES YET"});const c=e.length>i;return n.jsxs(n.Fragment,{children:[e.slice(0,i).map((d,u)=>{const f=d.colors===s,h=(o?"grid grid-cols-[24px_28px_1fr_auto_auto] ":"grid grid-cols-[24px_28px_1fr_auto] ")+"gap-2 items-center py-2 -mx-1 px-1 text-left transition-colors "+(u?"border-t border-border":"")+(f?" text-green":"")+(r?" cursor-pointer hover:bg-surface2 no-underline":""),m=n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-num text-[13px] text-muted pl-1 leading-none",children:u+1}),n.jsx("span",{className:"flex justify-center",children:d.colors===it?n.jsx(ia,{size:18,className:"shrink-0 block -my-1","aria-hidden":"true"}):n.jsx(Be,{colors:d.colors,size:12})}),n.jsx("span",{className:"font-display text-[14px] tracking-[0.05em] pl-1.5",children:ys(d.colors)}),o&&n.jsx("span",{className:"font-display text-[14px] tracking-[0.02em] tabular-nums text-right text-green mr-2",children:d.earnings?`$${d.earnings/1e3}K`:""}),n.jsx(Co,{count:d.trophies,size:"md",display:!0})]});return r?n.jsx(te,{to:r(f?"ALL":d.colors),onClick:a,"aria-current":f,className:h+" w-full",children:m},d.colors):n.jsx("div",{className:h,children:m},d.colors)}),c&&n.jsxs("button",{type:"button",onClick:()=>l(d=>d+t),className:"-mb-3.5 mt-0.5 flex w-full items-center justify-center gap-1.5 border-t border-border bg-transparent py-2 font-display text-[12px] tracking-[0.18em] text-muted transition-colors hover:text-text",children:["SHOW MORE",n.jsx(Et,{size:15,strokeWidth:2.5})]})]})}function lP({recentScoped:e,recentEmpty:t,cube:s,showRowPips:r,linkSetCode:a,qs:o}){return e?e.length===0?n.jsx("div",{className:"font-mono text-[11px] text-muted py-2",children:t}):n.jsx(n.Fragment,{children:e.map((i,l)=>{const c=!!i.seventeenlandsEventId,d="group grid gap-2 items-center py-[7px] no-underline text-inherit transition-colors hover:bg-surface2 -mx-1 px-1 animate-fadeUpIn "+(r?"grid-cols-[auto_1fr_28px_96px] ":"grid-cols-[1fr_28px_96px] ")+(l?"border-t border-border":""),u=n.jsxs(n.Fragment,{children:[r&&(Cs(i.colors,s)?n.jsxs("span",{className:"inline-flex items-center gap-px shrink-0",children:[n.jsx(Be,{colors:wo(i.colors).slice(0,3),size:10}),n.jsx(ia,{size:12,"aria-hidden":"true"})]}):n.jsx(Be,{colors:i.colors,size:10})),n.jsx("span",{className:"font-display text-[15px] leading-none tracking-[0.04em] whitespace-nowrap overflow-hidden text-ellipsis min-w-0",children:i.displayName.toUpperCase()}),n.jsx(ht,{wins:i.wins,losses:i.losses,mono:!0,color:uP(i)>0?"#2ee85c":void 0,className:"font-num text-[13px] text-subtle text-right"}),n.jsxs("span",{className:"grid grid-cols-[1fr_auto] items-center gap-1 font-mono text-dim",children:[n.jsx("span",{className:"text-[11px] text-text justify-self-center text-center leading-[1.15]",style:dP.includes(i.format)?{color:Ws.LCQ}:void 0,children:ca(i.format)}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"text-[11px] tabular-nums transition-colors group-hover:text-text",children:ro(i.finishedAt)}),c&&n.jsx(en,{size:13,className:"transition-colors group-hover:text-text","aria-hidden":"true"})]})]})]}),f=`${i.slug}-${i.finishedAt}`;return c?n.jsx("a",{href:`https://www.17lands.com/deck/${i.seventeenlandsEventId}`,target:"_blank",rel:"noopener noreferrer",className:d,children:u},f):n.jsx(te,{to:{pathname:Gt(i.slug,a),search:o},className:d,children:u},f)})}):n.jsx("div",{className:"font-mono text-[11px] text-muted py-2",children:"LOADING…"})}const Kse=100;function cP({setCode:e,playerSetCode:t,colors:s="ALL",format:r="ALL",rank:a="ALL",otherCombos:o=[],maxRecent:i=10},l){const c=t??e,d=ds(e),u=q3(l),f=s!=="ALL",h=!f&&r!=="ALL",m=a!=="ALL",{data:y}=IR(h||m?void 0:e),{data:b}=eY(h?e:void 0,h?r:void 0),{data:w}=tY(m&&!h?e:void 0),{data:x}=XZ(h||m?void 0:e,Kse),g=h?b:m?w:x,v=m?g==null?void 0:g.filter(H=>Qse(H.endRank)===a):g,k=TR(e),S=h||m?v&&qse(e,v):y==null?void 0:y.filter(H=>H.trophies>0&&(k||H.colors!==it)),N=v,C=f?(N??[]).filter(H=>s===it?Cs(H.colors,d):s===kt?o.includes(Bt(H.colors)):Bt(H.colors)===s).slice(0,i):N?N.slice(0,i):void 0,_=f?ys(s):h?ca(r):"",T=f||h,E=h?Ws[r]??Ti:null,A=f?n.jsx("span",{className:"text-green",children:_}):h?n.jsx("span",{style:{color:E},children:_}):null,P=h&&r==="LCQ",M=P?"TROPHIES & DAY 2":"TROPHIES",U=T?n.jsxs(n.Fragment,{children:["RECENT ",A," ",M]}):"RECENT TROPHIES",F=T||m?["NO RECENT",m?a.toUpperCase():"",_,M
509].filter(Boolean).join(" "):"NO TROPHIES YET",I=h?n.jsxs(n.Fragment,{children:["TOP COLORS ",A]}):"TOP COLORS",q=f&&s!==it&&s!==kt;return{topColors:S,recentScoped:C,cube:d,qs:u,linkSetCode:c,lcqScope:P,namedScope:q,showRowPips:!q,scopeChip:A,recentTitle:U,recentEmpty:F,topColorsTitle:I}}function qse(e,t){const s=ds(e),r=new Map;for(const a of t){const o=a.isTrophy!==!1,i=uP(a);if(!o&&i===0)continue;const l=[],c=Bt(a.colors);c&&l.push(c),Cs(a.colors,s)&&l.push(it);for(const d of l){const u=r.get(d)??{trophies:0,earnings:0,players:new Set};o&&(u.trophies+=1),u.earnings+=i,u.players.add(a.slug),r.set(d,u)}}return[...r.entries()].map(([a,o])=>({setCode:e,colors:a,trophies:o.trophies,events:o.trophies,players:o.players.size,earnings:o.earnings})).sort((a,o)=>o.trophies-a.trophies||o.earnings-a.earnings)}const dP=Lr("LCQ Draft 2");function uP(e){return dP.includes(e.format)?Oy(e.wins):0}const Zse=[{value:"ALL",label:"ALL RANKS"},...["Mythic","Diamond","Platinum","Gold","Silver","Bronze"].map(e=>({value:e,label:e.toUpperCase()}))],Yse=e=>e.value==="ALL"?n.jsx("span",{children:e.label}):n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Tu,{endRank:e.value==="Mythic"?"Mythic":`${e.value}-1`,size:16}),n.jsx("span",{children:e.label})]});function Qse(e){return e==null?void 0:e.split("-")[0]}function fP({children:e,onClick:t,size:s="md",type:r="button",className:a}){const o=s==="sm",i=o?6:8,l=o?"bg-green text-bg font-display tracking-[0.14em] text-[12px] py-[5px] pl-[14px] pr-[16px] cursor-pointer transition-colors hover:bg-green-2":"bg-green text-bg font-display tracking-[0.10em] text-[15px] leading-none pt-[15px] pb-[5px] pl-[22px] pr-[24px] cursor-pointer transition-colors hover:bg-green-2";return n.jsx("button",{type:r,onClick:t,className:a?`${l} ${a}`:l,style:{clipPath:`polygon(${i}px 0, 100% 0, calc(100% - ${i}px) 100%, 0 100%)`,border:"none"},children:e})}const Jse="#e6ecf5",Xse="#7a8395",ene="#1d2330",tne="#0a0c10",sne=24;function nne(e,t,s){const r=parseInt(e.slice(1,3),16),a=parseInt(e.slice(3,5),16),o=parseInt(e.slice(5,7),16),i=parseInt(t.slice(1,3),16),l=parseInt(t.slice(3,5),16),c=parseInt(t.slice(5,7),16),d=Math.round(r+(i-r)*s),u=
509Math.round(a+(l-a)*s),f=Math.round(o+(c-o)*s),h=m=>m.toString(16).padStart(2,"0");return`#${h(d)}${h(u)}${h(f)}`}const ih=.25;function rne(e){return e<=ih?0:e>=1-ih?1:(e-ih)/(1-2*ih)}function ane(e,t){if(e.length===1)return e[0];const s=e.length-1,r=Math.min(t*s,s),a=Math.min(Math.floor(r),s-1);return nne(e[a],e[a+1],rne(r-a))}function li({entries:e,radius:t=42,strokeWidth:s=14,trackColor:r=ene,topLabel:a,bottomLabel:o,topFontSize:i,bottomFontSize:l,size:c,padding:d=8,pieHole:u,defs:f,activeKey:h,onHoverEntry:m}){const y=u!=null,b=t+s/2,w=y?b*u:t-s/2,x=y?(b+w)/2:t,g=c??b*2+d,v=e.reduce((O,H)=>O+H.value,0)||1,k=g/2,S=g/2,N=i??Math.round(t*.5),C=l??Math.round(t*.22),_=[];{let O=0;for(const H of e){const B=H.value/v;_.push({entry:H,startFrac:O,endFrac:O+B}),O+=B}}const T=1,E=7,A=h==null?null:new Set(Array.isArray(h)?h:[h]),P=O=>A!=null&&A.has(O);function M(O){const H=P(O.entry.key),B=b+(H?E:0),D=(B+w)/2,L=B-w,$=2*Math.PI*D,V=O.endFrac-O.startFrac,z=O.entry.colors&&O.entry.colors.length>0?O.entry.colors:[O.entry.color??r],K=z.length===1?1:sne,W=V/K,J=[];for(let Z=0;Z<K;Z++){const Y=K===1?0:(Z+.5)/K,ae=ane(z,Y),ye=`${W*$+(Z<K-1?T:0)} ${$}`,De=-(O.startFrac+W*Z)*$;J.push(n.jsx("circle",{cx:k,cy:S,r:D,fill:"none",stroke:ae,strokeWidth:L,strokeDasharray:ye,strokeDashoffset:De,transform:`rotate(-90 ${k} ${S})`},Z))}return n.jsx("g",{onMouseEnter:m?()=>m(O.entry.key):void 0,onMouseLeave:m?()=>m(null):void 0,onPointerDown:m?()=>m(O.entry.key):void 0,style:{cursor:m?"pointer":void 0,transition:"all 120ms ease-out"},children:J},O.entry.key)}const U=_.filter(O=>!P(O.entry.key)).map(M),F=_.filter(O=>P(O.entry.key)).map(M),I=[];if(_.length>1){const O=y?w:t-s/2-.5,H=y?b:t+s/2+.5;_.forEach((B,D)=>{const L=B.startFrac*2*Math.PI-Math.PI/2,$=k+O*Math.cos(L),V=S+O*Math.sin(L),z=k+H*Math.cos(L),K=S+H*Math.sin(L);I.push(n.jsx("line",{x1:$,y1:V,x2:z,y2:K,stroke:tne,strokeWidth:1.5,strokeLinecap:"butt"},`div-${D}`))})}const q=_.filter(O=>O.entry.symbol!=null).map(O=>{const B=(O.startFrac+O.endFrac)/2*2*Math.PI-Math.PI/2,D=y?x:t,L=k+D*Math.cos(B),$=S+D*Math.sin(B);return n.jsx("div",{style:{position:"absolute",left:L,top:$,transform:"translate(-50%, -50%)",pointerEvents:"none"},children:O.entry.symbol},`sym-${O.entry.key}`)});return n.jsxs("div",{className:"shrink-0 relative",style:{width:g,height:g},children:[n.jsxs("svg",{width:g,height:g,viewBox:`0 0 ${g} ${g}`,style:{overflow:"visible"},children:[f&&n.jsx("defs",{children:f}),!y&&n.jsx("circle",{cx:k,cy:S,r:t,fill:"none",stroke:r,strokeWidth:s}),U,I,F,!y&&a!=null&&n.jsx("text",{x:k,y:S,dy:o!=null?-2:Math.round(N/3),textAnchor:"middle",fill:Jse,fontFamily:"'Bebas Neue', sans-serif",fontSize:N,children:a}),!y&&o!=null&&n.jsx("text",{x:k,y:S,dy:Math.round(N*.55)+4,textAnchor:"middle",fill:Xse,fontFamily:"'Bebas Neue', sans-serif",fontSize:C,letterSpacing:"0.2em",children:o})]}),q]})}const one="Qualifier_D2_Sealed";function eb(e){return e===one}function tb({size:e=16,box:t,className:s}){const r="inline-flex items-center justify-center shrink-0";return n.jsx("span",{className:s?`${r} ${s}`:r,style:{height:t??e},children:n.jsx("img",{src:"/arenachamp.png",alt:"Arena Championship qualification",title:"Arena Championship qualification",style:{height:e,width:"auto",maxWidth:"none"}})})}function hP({value:e,options:t,onSelect:s,hrefFor:r,variant:a="hero"}){const o=new Map(t.map(c=>[c.value,c])),i=(c,d)=>{const u=o.get(c);return u!=null&&u.icon?u.icon:n.jsx(Ae,{code:(u==null?void 0:u.glyph)??c,size:d,className:"text-white shrink-0"})},l=c=>n.jsxs("span",{className:"flex w-full items-center gap-2.5 min-w-0",children:[i(c.value,20),n.jsx("span",{className:"truncate",children:c.label})]});return n.jsx(yt,{value:e,options:t,onChange:s,hrefFor:r,variant:a==="hero"?"desktop":"mobile",renderValue:l,renderOption:l,renderTrigger:a==="hero"?({open:c,selected:d,toggle:u})=>n.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-2 cursor-pointer transition-colors font-display leading-none bg-transparent border-0 p-0 text-[20px] tracking-[0.04em] text-text hover:text-muted",children:[i(d.value,22),n.jsx("span",{children:d.label}),n.jsx(Et,{strokeWidth:2.5,className:j("text-muted h-3.5 w-3.5 transition-transform",c&&"rotate-180")}
509)]}):void 0})}const ine=e=>({value:e.setCode,label:TZ(e.setCode),glyph:e.setCode});function pP({activeSet:e,seasons:t,hrefFor:s,variant:r="hero"}){const a=sf(e)??Bm,o=ic(a.slug),i=_n(e)?e:o,l=new Map((t??[]).map(u=>[u.setCode,u])),c=_R(a,t).map(ine);if(c.sort((u,f)=>{var h,m;return(((h=l.get(f.value))==null?void 0:h.lastEvent)??"").localeCompare(((m=l.get(u.value))==null?void 0:m.lastEvent)??"")}),c.length===0)return null;const d=[{value:o,label:"ALL SEASONS",icon:n.jsx(Ov,{size:20,className:"text-white shrink-0"})},...c];return n.jsx(hP,{value:i,options:d,hrefFor:s,variant:r})}function mP(e){var t;return((t=sf(e))==null?void 0:t.seasoned)??!1}const xP={WU:"azorius",WB:"orzhov",WR:"boros",WG:"selesnya",UB:"dimir",UR:"izzet",UG:"simic",BR:"rakdos",BG:"golgari",RG:"gruul"},lne={WR:-13,RG:-7,WU:-10,UR:-7,WB:-3,WG:-7,BR:-7},cne={WB:20,RG:20,BR:20},gP="/guilds";function dne(e){const t=xP[e];return t?`${gP}/${t}.webp`:null}function une(e){const t=lne[e]??0,s=cne[e]??0,r=[];return t&&r.push(`translateY(${t}%)`),s&&r.push(`scale(${1+s/100})`),r.length?r.join(" "):void 0}let ZS=!1;function fne(){if(!(ZS||typeof window>"u")){ZS=!0;for(const e of Object.values(xP)){const t=new Image;t.src=`${gP}/${e}.webp`}}}const Bc=e=>{const[t]=Rn();return(s,r)=>{const a=new URLSearchParams(t);return r===e?a.delete(s):a.set(s,r),{search:a.toString()}}};function YS(){var Ie;const e=cn(),t=ut(),s=ln(),{data:r}=un(),a=(Ie=r==null?void 0:r.find(_e=>_e.isActive))==null?void 0:Ie.code,i=(e.setCode?K3(e.setCode,r):void 0)??a??_s,{data:l}=zZ(),c=EZ(l),d=i===a9?ic(Bm.slug):i===rs?c:void 0,u=d??i,f=r==null?void 0:r.find(_e=>_e.code===Tc(u)),h=p.useMemo(()=>sP(AZ(r,l)),[r,l]),m=ii(u),y=GZ(m?u:void 0),[b,w]=Rn();p.useEffect(()=>{e.setCode&&(i===a?s({pathname:kn(),search:b.toString()},{replace:!0}):d?s({pathname:kn(d),search:b.toString()},{replace:!0}):i!==e.setCode&&s({pathname:kn(i),search:b.toString()},{replace:!0}))},[e.setCode,i,a,d,s,b]),p.useEffect(()=>{window.scrollTo(0,0)},[u]);const x=b.get("format")??"ALL",g=b.get("colors")??"ALL",v=g!=="ALL",k=x!=="ALL",S=v&&k,N=k&&!v,C=v&&!k,_=Bc("ALL"),T=_e=>_("format",_e),E=_e=>_("colors",_e),{chips:A,otherCombos:P,loading:M}=Rv(u),{data:U}=Wm(u),F=p.useMemo(()=>{let _e=Tn;if(U){const We=new Set(U);_e=Tn.filter(we=>we.value==="ALL"?!0:(bi[we.value]??[we.value]).some(ee=>We.has(ee)))}return _e.map(We=>({...We,label:bP(We.value,u)}))},[U,u]),I=C&&g===kt,q=C&&g!==kt,O=S&&g===kt,H=S&&g!==kt,B=Tv(v||k?void 0:u),D=LR(N?u:void 0,N?x:void 0),L=VZ(q?u:void 0,q?g:void 0),$=qZ(I||O?u:void 0,I||O?P:void 0,O?x:void 0),V=KZ(H?u:void 0,H?x:void 0,H?g:void 0),z=H?V:I||O?$:q?L:N?D:B,K=z.data,W=z.isLoading,J=z.error,Z=Su(x),Y=x==="Pod"||Z==="direct",ae=x==="Pod"?YJ:V6(Z),pe=pne(b),ye=Y&&pe.key==="score"?ae:pe,De=p.useMemo(()=>K&&K6(K,ye),[K,ye.key,ye.dir]),Fe=_e=>{w(We=>{const we=new URLSearchParams(We),He=we.get("sort")??ae.key,ee=we.get("dir")??ae.dir,Q=He===_e&&ee==="desc"?"asc":"desc";return _e===ae.key&&Q===ae.dir?(we.delete("sort"),we.delete("dir")):(we.set("sort",_e),Q==="desc"?we.delete("dir"):we.set("dir",Q)),we})},tt=f!=null&&f.lastRefreshedAt?Cc(f.lastRefreshedAt):null,st={format:x,formatHref:T,colors:g,colorsHref:E,colorChips:A,colorChipsLoading:M,formatOptions:F,updated:tt},{user:ie}=Qn(),{data:Se}=rf(ie==null?void 0:ie.discordId);return m?n.jsx(mne,{activeSet:u,sets:h,rows:y.data,loading:y.isLoading,searchParams:b,cubeEntryBoard:c,cubeSeasons:l}):t?n.jsx(jne,{activeSet:u,sets:h,cubeSeasons:l,cubeEntryBoard:c,rows:De,isLoading:W,error:J,filters:st,colorsMode:v,otherCombos:P,searchParams:b,sort:ye,onSort:Fe,mySlug:Se??void 0}):n.jsx(xne,{activeSet:u,sets:h,setMeta:f,cubeSeasons:l,cubeEntryBoard:c,rows:De,isLoading:W,error:J,filters:st,colorsMode:v,otherCombos:P,searchParams:b,sort:ye,onSort:Fe,mySlug:Se??void 0})}const hne=new Set(["score","trophies","events","record","winPct","earnings","boxes"]);function pne(e){const t=e.get("sort"),s=e.get("dir");return{key:t&&hne.has(t)?t:G6.key,dir:s==="asc"?"asc":"desc"}}function mne({activeSet:e,sets:t,rows:s,loading:r,searchParams:a,cubeEntryBoard:o,cubeSeasons:i}){var f;const l=ut(),c=h=>nw(h,t,a,o,i),d=(f=t==null?void 0:t.find(h=>
509h.code===e))==null?void 0:f.startDate,u=bse[e];return n.jsxs("div",{className:"bg-bg text-text min-h-screen flex flex-col page-fade",children:[n.jsx(St,{subtitle:"LEADERBOARD"}),n.jsxs("div",{className:"relative px-5 md:px-10 py-5 border-b border-border bg-surface flex items-center gap-3 md:gap-4",children:[u?n.jsxs("div",{className:"flex items-center gap-2 md:gap-2.5 shrink-0",children:[n.jsx("i",{className:`ss ss-${u[0]} text-white`,style:{fontSize:l?52:84,lineHeight:1},"aria-hidden":"true"}),n.jsx("div",{className:"flex flex-col items-center gap-1.5 md:gap-2",children:u.slice(1).map(h=>n.jsx("i",{className:`ss ss-${h} text-white`,style:{fontSize:l?24:38,lineHeight:1},"aria-hidden":"true"},h))})]}):n.jsx(Ae,{code:e,size:l?52:84}),n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"flex items-baseline gap-3",children:[n.jsx("span",{className:"font-display tracking-[0.04em]",style:{fontSize:l?32:56,lineHeight:.9},children:e}),n.jsx("span",{className:"font-display text-[15px] md:text-[22px] text-muted tracking-[0.06em] truncate",children:tP(e).toUpperCase()})]}),d&&n.jsx("div",{className:"font-mono text-[11px] text-muted mt-1 tracking-[0.04em]",children:d1(d)})]}),n.jsx("div",{className:"flex-1"}),t&&(l?n.jsx("div",{className:"w-[150px] shrink-0",children:n.jsx(Ase,{sets:t,activeCode:e,hrefFor:c})}):n.jsx(sw,{sets:t,activeCode:e,hrefFor:c}))]}),n.jsxs("div",{className:"px-5 md:px-10 py-4 grid gap-6 lg:grid-cols-[1fr_320px]",children:[n.jsx(Pse,{rows:s,loading:r}),n.jsx("div",{className:"lg:pt-4 lg:self-start lg:sticky lg:top-4",children:n.jsx(Ise,{rows:s,setCode:e})})]})]})}function xne({activeSet:e,sets:t,setMeta:s,cubeSeasons:r,cubeEntryBoard:a,rows:o,isLoading:i,error:l,filters:c,colorsMode:d,otherCombos:u,searchParams:f,sort:h,onSort:m,mySlug:y}){const{prefetchSet:b,prefetchPlayer:w}=MR(),x=Tc(e);return n.jsxs("div",{className:"bg-bg text-text min-h-screen flex flex-col page-fade",children:[n.jsx(St,{subtitle:"LEADERBOARD"}),n.jsx(gne,{activeSet:e,setMeta:s,sets:t,cubeSeasons:r,setHref:g=>nw(g,t,f,a,r),seasonHref:g=>jP(g,f),onPrefetchSet:b,format:c.format,colors:c.colors}),n.jsx(wne,{...c}),n.jsxs("div",{className:"pl-5 pr-8 grid gap-6",style:{gridTemplateColumns:"1fr 320px"},children:[n.jsx(zv,{rows:o,variant:"desktop",loading:i,error:l,mode:Su(c.format),sort:h,onSort:m,onRowPrefetch:g=>w(g.slug,x),highlightSlug:y,playerHref:g=>Hp(g,x,f),rowExpandable:g=>g.events>0,renderExpanded:g=>n.jsx(Sne,{row:g,to:Hp(g,x,f),activeFormat:c.format,activeColors:c.colors,otherCombos:u})}),n.jsx("div",{className:"pt-4 self-start sticky top-4",children:n.jsx(Gse,{setCode:e,playerSetCode:x,colors:c.colors,format:c.format,otherCombos:u,colorsHref:c.colorsHref,searchParams:f,updated:c.updated,stats:{players:(o==null?void 0:o.length)??0,events:Z7(o)}})})]})]})}function gne({activeSet:e,setMeta:t,sets:s,cubeSeasons:r,setHref:a,seasonHref:o,onPrefetchSet:i,format:l,colors:c}){const d=Tc(e),u=d===rs,f=W3(t),h=l!=="ALL"||c!=="ALL",m=ut(1400),y=o9(e),b=y?s==null?void 0:s.find(k=>k.code===y):void 0,w=u?r==null?void 0:r.find(k=>k.setCode===e):void 0;let x=null;if(w){const k=b==null?void 0:b.endDate,S=k&&k>=w.lastEvent?k:w.lastEvent;x=Ld(w.firstEvent,S)}else!u&&t&&(x=Ld(t.startDate,t.endDate));const g=u?ER(e):(t==null?void 0:t.isActive)??!1,v=u?(sf(e)??Bm).name:(t==null?void 0:t.name)??"";return n.jsxs("div",{className:"relative px-10 py-5 border-b border-border bg-surface flex items-center gap-6",children:[n.jsx(Ae,{code:d,size:84}),n.jsxs("div",{children:[n.jsx(Xe,{size:13,className:j("text-green",!g&&"invisible"),children:"LIVE"}),n.jsxs("div",{className:"flex items-baseline gap-3.5 mt-0.5",children:[n.jsx("span",{className:"font-display tracking-[0.04em]",style:{fontSize:56,lineHeight:.9},children:d}),n.jsx("span",{className:"font-display text-[22px] text-muted tracking-[0.06em]",children:v.toUpperCase()})]}),u?n.jsxs("div",{className:"font-mono text-[11px] text-muted mt-1 tracking-[0.04em] flex items-center gap-6",children:[mP(e)&&n.jsx("div",{className:"h-0 shrink-0 flex items-center",children:n.jsx(pP,{activeSet:e,seasons:r,hrefFor:o})}),n.jsx("span",{className:"whitespace-nowrap ml-auto self-end translate-y-[4px]",children:x||" "})]}):n.jsxs("div",{className:"font-mono text-[11px] text-muted mt-1 flex justify-between gap-4",children:[t&&n.jsx("span",{children:Ld(t.startDate,t.endDate)}),f&&n.jsx("span",{children:f})]})]}),h?n.jsx(vne,{format:l,colors:c,setCode:e}):n.jsx("div",{className:"flex-1"}),s&&n.jsx(sw,{sets:s,activeCode:ds(e)?NR(e):d,hrefFor:a,onPrefetch:i,extraHide:h?m?3:2:0}
509)]})}function QS({code:e}){return n.jsx("span",{className:"shrink-0 inline-flex items-center justify-center",style:{width:48,height:48},children:n.jsx(bne,{code:e})})}function bne({code:e}){if(e===it)return n.jsx(ia,{size:36,"aria-hidden":"true"});if(e===kt)return n.jsx(uo,{size:32,"aria-hidden":"true"});const t=dne(e);if(t)return n.jsx("img",{src:t,alt:"","aria-hidden":"true",className:"block",style:{height:44,width:44,transform:une(e)}},t);if(e.length===1&&"WUBRG".includes(e))return n.jsx(fr,{c:e,size:32});if(e.length===3&&[...e].every(r=>"WUBRG".includes(r))){const[r,a,o]=[...e];return n.jsxs("span",{className:"inline-flex flex-col items-center",style:{gap:2},children:[n.jsx(fr,{c:r,size:20}),n.jsxs("span",{className:"inline-flex",style:{gap:2},children:[n.jsx(fr,{c:a,size:20}),n.jsx(fr,{c:o,size:20})]})]})}return n.jsx(Be,{colors:e,size:22})}const yne=new Set(["HOB"]);function bP(e,t){var s;return e==="LCQ"&&yne.has(t)?"OPEN DRAFT":((s=Tn.find(r=>r.value===e))==null?void 0:s.label)??e.toUpperCase()}function vne({format:e,colors:t,setCode:s}){const r=t!=="ALL",a=e!=="ALL",o=bP(e,s),i=Ws[e]??Ti,l=r?ys(t):"";return r&&a?n.jsxs("div",{className:"flex-1 min-w-0 flex flex-col items-center justify-center pointer-events-none gap-2.5",children:[n.jsx("span",{className:"font-display tracking-[0.06em] whitespace-nowrap max-w-full overflow-hidden text-ellipsis",style:{fontSize:26,lineHeight:1,color:i},children:o}),n.jsxs("span",{className:"relative whitespace-nowrap font-display tracking-[0.06em]",style:{fontSize:32,lineHeight:1},children:[n.jsx("span",{className:"absolute right-full top-1/2 -translate-y-1/2 pr-3 flex items-center",children:n.jsx(QS,{code:t})}),l]})]}):r?n.jsx("div",{className:"flex-1 min-w-0 flex items-center justify-center pointer-events-none",children:n.jsxs("span",{className:"relative whitespace-nowrap font-display tracking-[0.06em]",style:{fontSize:36,lineHeight:1},children:[n.jsx("span",{className:"absolute right-full top-1/2 -translate-y-1/2 pr-3 flex items-center",children:n.jsx(QS,{code:t})}),l]})}):n.jsx("div",{className:"flex-1 min-w-0 flex items-center justify-center pointer-events-none",children:n.jsx("span",{className:"font-display tracking-[0.06em] whitespace-nowrap max-w-full overflow-hidden text-ellipsis",style:{fontSize:36,lineHeight:1,color:i},children:o})})}function wne({format:e,formatHref:t,colors:s,colorsHref:r,colorChips:a,colorChipsLoading:o,formatOptions:i}){return n.jsxs("div",{className:"px-10 py-3 border-b border-border flex items-center gap-4 flex-wrap",children:[n.jsx(yt,{value:e,options:i,hrefFor:t,renderValue:Ss,renderOption:Ss}),n.jsx(Xe,{size:11,children:"COLORS"}),n.jsx(oP,{activeCode:s,hrefFor:r,chips:a,loading:o}),n.jsxs(te,{to:"/leaderboard/about",className:"ml-auto inline-flex items-center gap-1.5 font-display text-[15px] leading-none tracking-[0.08em] text-green hover:text-green-2 transition-colors no-underline whitespace-nowrap",children:["ABOUT THE LEADERBOARD",n.jsx(Jt,{size:15})]})]})}function jne({activeSet:e,sets:t,cubeSeasons:s,cubeEntryBoard:r,rows:a,isLoading:o,error:i,filters:l,colorsMode:c,otherCombos:d,searchParams:u,sort:f,onSort:h,mySlug:m}){const{prefetchPlayer:y}=MR(),b=Tc(e),w=t==null?void 0:t.find(C=>C.code===b),x=w!=null&&w.lastRefreshedAt?Cc(w.lastRefreshedAt):null,g=b===rs,v=p.useMemo(()=>t?zse(t):[],[t]),k=p.useRef(null),[S,N]=p.useState(0);return p.useLayoutEffect(()=>{const C=k.current;if(!C)return;const _=()=>N(C.getBoundingClientRect().height);_();const T=new ResizeObserver(_);return T.observe(C),()=>T.disconnect()},[]),n.jsxs("div",{className:"bg-bg text-text min-h-screen flex flex-col overflow-x-clip page-fade",children:[n.jsxs("div",{ref:k,className:"page-chrome sticky top-0 z-10 bg-bg",children:[n.jsx(St,{subtitle:"LEADERBOARD"}),n.jsxs("div",{className:"px-3 py-2 border-b border-border bg-surface flex items-stretch gap-2",children:[n.jsx("div",{className:"basis-1/2 min-w-0 flex",children:n.jsx(yt,{value:l.format,options:l.formatOptions,hrefFor:l.formatHref,variant:"mobile",renderValue:Ss,renderOption:Ss,triggerClassName:"py-2"})}),t&&n.jsx("div",{className:"basis-1/2 min-w-0 flex",children:n.jsx(X1,{value:ds(e)?NR(e):b,options:v,hrefFor:C=>nw(C,t,u,r,s),variant:"mobile",align:"right",searchable:!0,subtext:x??void 0})})]}),g&&mP(e)&&n.jsx("div",{className:"px-3 py-1.5 border-b border-border bg-surface flex",children:n.jsx(pP,{activeSet:e,seasons:s,hrefFor:C=>jP(C,u),variant:"mobile"})}),n.jsx("div",{className:"px-3 py-1.5 border-b border-border bg-bg",children:n.jsx(oP,{activeCode:l.colors,hrefFor:l.colorsHref,chips:l.colorChips,loading:l.colorChipsLoading,variant:"mobile"})}),n.jsx(Vse,{setCode:e,playerSetCode:b,colors:l.colors,format:l.format,otherCombos:d,colorsHref:l.colorsHref,searchParams:u}),n.jsx(Bv,{variant:"mobile",mode:Su(l.format),sort:f,onSort:h})]}),n.jsx(zv,{rows:a,variant:"mobile",loading:o,error:i,showHeader:!1,mode:Su(l.format),onRowPrefetch:C=>y(C.slug,b),highlightSlug:m,stickyTop:S,playerHref:C=>Hp(C,b,u),rowExpandable:C=>C.events>0,renderExpanded:C=>n.jsx(Ane,{row:C,to:Hp(C,b,u),activeFormat:l.format,activeColors:l.colors,otherCombos:d})})]})}const Jm=88,kne=0;function yP(e,t){const s=Ev(e,t),r=DR(e,t),[a,o]=p.useState(kne===0);return p.useEffect(()=>{},[]),{profile:a?s.data:void 0,events:a?r.data:void 0}}function Hp(e,t,s){const r=q3(s),a=Gt(e.slug,t);return r?`${a}?${r}`:a}function Sne({row:e,to:t,activeFormat:s,activeColors:r,otherCombos:a}){const{profile:o,events:i}=yP(e.slug,e.setCode),{lastTrophies:l,biggestStreak:c}=Tne(i),d=s!=="ALL"||r!=="ALL",u=ds(e.setCode),f=p.useMemo(()=>vP(i,s,r,a,u).slice(0,3),[i,s,r,a,u]),h=d?f:l,m=p.useMemo(()=>h.length===0&&i?wP(i,s,r,a,u).slice(0,3):[],[h.length,i,s,r,a,u]);return n.jsxs("div",{className:"relative pt-3 pb-2 pr-4 pl-[76px] border-t border-dashed border-border2 flex items-start gap-6 transition-colors hover:bg-green/5",children:[n.jsx(te,{to:t,"aria-label":`View ${e.displayName}'s profile`,className:"absolute inset-0"}),n.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:n.jsx(Nne,{breakdown:o==null?void 0:o.formatBreakdown})}),n.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:n.jsx(_ne,{events:i})}),n.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:n.jsx(Ene,{data:h,decks:m,loading:!i,activeFormat:s,activeColors:r})}),n.jsx("div",{className:"flex-[0.4] min-w-0 overflow-hidden self-stretch -ml-6",children:n.jsx(Rne,{data:c,loading:!i})}),n.jsx(fP,{className:"!pt-[10px] !pb-[10px] self-center pointer-events-none",children:n.jsxs("span",{className:"inline-flex items-center gap-2",children:["VIEW PROFILE",n.jsx(Jt,{size:12})]})})]})}function Nne({breakdown:e}){const t=p.useMemo(()=>e?[...e].filter(c=>c.events>0).sort((c,d)=>d.events-c.events):[],[e]),s=t.length>0,r=s?Math.max(1,t.reduce((c,d)=>c+d.events,0)):1,a=t.length>=4,o=a?"text-[11px]":"text-[13px]",i=a?"w-[11px] h-[11px]":"w-[13px] h-[13px]",l=a?"text-[11px]":"text-[12px]";return n.jsxs("div",{style:{minHeight:Jm},children:[n.jsx(Xe,{size:13,className:"text-subtle",children:"FORMAT BREAKDOWN"}),n.jsxs("div",{className:"flex items-center gap-2.5 mt-2 min-w-0",children:[n.jsx("div",{className:"shrink-0",children:n.jsx(li,{entries:t.map(c=>
509({key:c.formatLabel,value:c.events/r,color:Ws[c.formatLabel]??Ti})),radius:28,strokeWidth:10,size:76,pieHole:.5})}),n.jsx("div",{className:"grid items-center gap-x-2 gap-y-0.5 min-w-0",style:{gridTemplateColumns:"auto minmax(0, 1fr) auto"},children:s?t.map(c=>{const d=Ws[c.formatLabel]??Ti;return n.jsxs(p.Fragment,{children:[n.jsx("span",{className:j(i,"shrink-0"),style:{background:d}}),n.jsx("span",{className:j("font-display tracking-[0.08em] truncate",o),children:ca(c.formatLabel)}),n.jsx("span",{className:j("font-num text-muted tabular-nums justify-self-end",l),children:c.events})]},c.formatLabel)}):Cne.map((c,d)=>n.jsxs(p.Fragment,{children:[n.jsx("span",{className:"w-2 h-2 bg-surface2 shrink-0"}),n.jsx("span",{className:"h-2.5 bg-surface2",style:{width:c}}),n.jsx("span",{className:"h-2.5 bg-surface2 justify-self-end",style:{width:18}})]},d))})]})]})}const Cne=[70,56,64,48];function _ne({events:e}){const t=p.useMemo(()=>{if(!e||e.length===0)return[];const s={},r={};for(const a of e){const o=Bt(a.colors);o.length!==0&&(s[o]=(s[o]??0)+1,a.isTrophy&&(r[o]=(r[o]??0)+1))}return Object.entries(s).sort((a,o)=>o[1]-a[1]).slice(0,3).map(([a,o])=>({code:a,count:o,trophies:r[a]??0}))},[e]);return n.jsxs("div",{style:{minHeight:Jm},children:[n.jsx(Xe,{size:13,className:"text-subtle",children:"MOST PLAYED DECKS"}),n.jsx("div",{className:"grid items-center gap-x-3 gap-y-1 mt-2 w-fit",style:{gridTemplateColumns:"auto 64px auto"},children:t.length>0?t.map(s=>n.jsxs(p.Fragment,{children:[n.jsx(Be,{colors:s.code,size:11}),n.jsx("span",{className:"font-display text-[13px] tracking-[0.06em]",children:ys(s.code)}),n.jsx(Co,{count:s.trophies,size:"compact",className:"text-muted"})]},s.code)):[50,60,44].map((s,r)=>n.jsxs(p.Fragment,{children:[n.jsx("span",{className:"w-[26px] h-3 bg-surface2 shrink-0"}),n.jsx("span",{className:"h-3 bg-surface2",style:{width:s}}),n.jsx("span",{className:"h-2.5 bg-surface2",style:{width:22}})]},r))})]})}function vP(e,t,s,r,a){if(!e)return[];const o=new Set(r);return e.filter(l=>{if(!l.isTrophy||!Xa(l.format,t))return!1;if(s!=="ALL"){if(s===it){if(!Cs(l.colors,a))return!1}else if(s===kt){if(Cs(l.colors,a)||!o.has(Bt(l.colors)))return!1}else if(Bt(l.colors)!==s)return!1}return!0}).sort((l,c)=>(c.finishedAt??"").localeCompare(l.finishedAt??""))}function wP(e,t,s,r,a){if(!e)return[];const o=new Set(r);return e.filter(l=>{if(!Xa(l.format,t))return!1;if(s!=="ALL"){if(s===it){if(!Cs(l.colors,a))return!1}else if(s===kt){if(Cs(l.colors,a)||!o.has(Bt(l.colors)))return!1}else if(Bt(l.colors)!==s)return!1}return!0}).sort((l,c)=>(c.finishedAt??"").localeCompare(l.finishedAt??""))}function Tne(e){return p.useMemo(()=>{if(!e||e.length===0)return{lastTrophies:[],biggestStreak:null};const t=[...e].sort((i,l)=>(i.finishedAt??"").localeCompare(l.finishedAt??"")),s=[];for(let i=t.length-1;i>=0&&s.length<3;i--)t[i].isTrophy&&s.push(t[i]);let r=0,a=0,o="";for(const i of t)i.isTrophy?(a+=1,a>r&&(r=a,o=i.format)):a=0;return{lastTrophies:s,biggestStreak:r>=2?{count:r,format:o}:null}},[e])}function Ene({data:e,decks:t=[],loading:s,activeFormat:r,activeColors:a}){const o=a!=="ALL",i=!o&&r!=="ALL",l=o?ys(a):i?r.toUpperCase():null,c=i?{color:Ws[r]??Ti}:void 0,d=!s&&e.length===0&&t.length>0,u=d?t:e,f=d?"DECKS":"TROPHIES";return n.jsxs("div",{style:{minHeight:Jm},children:[n.jsxs(Xe,{size:13,className:"text-subtle",children:["LAST",l&&n.jsxs(n.Fragment,{children:[" ",n.jsx("span",{className:o?"text-green":"",style:c,children:l})]})," ",f]}),n.jsx("div",{className:"flex flex-col gap-1 mt-2.5 min-w-0",children:s?[0,1,2].map(h=>n.jsxs("div",{className:"grid items-center gap-x-3 w-fit",style:{gridTemplateColumns:"auto auto auto auto 12px"},children:[n.jsx("span",{className:"w-[26px] h-3 bg-surface2 shrink-0"}),n.jsx("span",{className:"h-3 bg-surface2",style:{width:50}}),n.jsx("span",{className:"h-3 bg-surface2",style:{width:36}}),n.jsx("span",{className:"h-3 bg-surface2",style:{width:24}}),n.jsx("span",{})]},h)):u.length>0?u.map(h=>{const m=h.seventeenlandsEventId?`https://www.17lands.com/deck/${h.seventeenlandsEventId}`:null,y=m?"a":"div";return n.jsxs(y,{href:m??void 0,target:m?"_blank":void 0,rel:m?"noopener noreferrer":void 0,title:m?"Open deck on 17lands":void 0,className:j("grid items-center gap-x-3 px-1.5 -mx-1.5 rounded transition-colors w-fit",m&&"relative hover:bg-surface2 cursor-pointer no-underline"),style:{gridTemplateColumns:"auto auto auto auto 12px"},children:[n.jsx(Be,{colors:h.colors,size:11}),n.jsx("span",{className:"font-display text-[13px] tracking-[0.06em] text-muted truncate",children:ca(h.format)}
509),n.jsx(ht,{wins:h.wins,losses:h.losses,mono:!0,className:"font-num text-[12px] text-muted text-right justify-self-end"}),n.jsx("span",{className:"font-mono text-[12px] text-dim",children:ro(Hr(h))}),n.jsx("span",{className:"flex justify-center text-subtle",children:m&&n.jsx(en,{size:10,"aria-hidden":"true"})})]},h.eventId)}):n.jsx("div",{className:"font-mono text-[12px] text-muted",children:"NONE YET"})})]})}function Rne({data:e,loading:t}){return n.jsxs("div",{className:"flex flex-col items-center justify-center h-full",style:{minHeight:Jm},children:[n.jsx(Xe,{size:13,className:"text-subtle text-center",children:"MAX TROPHY"}),t?n.jsx("span",{className:"block h-5 w-12 bg-surface2 mt-1"}):e?n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"flex items-center gap-1.5 my-0.5",children:[n.jsx(ct,{size:14,color:"#ffc63a"}),n.jsxs("span",{className:"font-display text-[18px] leading-none tracking-[0.04em]",children:["×",e.count]})]}),n.jsx(Xe,{size:13,className:"text-subtle text-center",children:"STREAK"})]}):n.jsx("div",{className:"font-num text-[12px] text-muted text-center mt-1",children:"—"})]})}function Ane({row:e,to:t,activeFormat:s,activeColors:r,otherCombos:a}){const{events:o}=yP(e.slug,e.setCode),i=ds(e.setCode),l=p.useMemo(()=>{if(!o)return null;if(!(s!=="ALL"||r!=="ALL")){for(const u of o)if(u.isTrophy)return u;return null}return vP(o,s,r,a,i)[0]??null},[o,s,r,a,i]),c=p.useMemo(()=>!o||l?null:wP(o,s,r,a,i)[0]??null,[o,l,s,r,a,i]);return n.jsxs(te,{to:t,"aria-label":`View ${e.displayName}'s profile`,className:"pt-2 pb-3 pr-3.5 pl-9 flex items-center gap-3 border-t border-dashed border-border2 cursor-pointer transition-colors hover:bg-green/5 no-underline text-inherit",children:[n.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-1.5",children:[n.jsxs("span",{className:"font-display text-[12px] tracking-[0.12em] text-muted tabular-nums",children:[e.events," EVENTS · ",n.jsx(ht,{wins:e.wins,losses:e.losses})," · ",Nc(e.wins,e.losses),"%"]}),n.jsx("div",{className:"flex items-center gap-1.5 min-h-[14px]",children:o?l?n.jsxs(n.Fragment,{children:[n.jsx(Xe,{size:11,letterSpacing:"0.18em",children:"LAST TROPHY"}),n.jsx(ct,{size:12,color:"#ffc63a"}),n.jsx(Be,{colors:l.colors,size:12}),n.jsx("span",{className:"text-dim text-[11px]",children:"·"}),n.jsx("span",{className:"font-display text-[11px] tracking-[0.08em] text-muted",children:vp(l.format).toUpperCase()}),eb(l.format)&&n.jsx(tb,{size:22,box:14}),n.jsx("span",{className:"text-dim text-[11px]",children:"·"}),n.jsx("span",{className:"font-display text-[11px] tracking-[0.08em] text-dim tabular-nums",children:ro(Hr(l))})]}):c?n.jsxs(n.Fragment,{children:[n.jsx(Xe,{size:11,letterSpacing:"0.18em",children:"LAST DECK"}),n.jsx(Be,{colors:c.colors,size:12}),n.jsx("span",{className:"text-dim text-[11px]",children:"·"}),n.jsx("span",{className:"font-display text-[11px] tracking-[0.08em] text-muted",children:vp(c.format).toUpperCase()}),n.jsx("span",{className:"text-dim text-[11px]",children:"·"}),n.jsx("span",{className:"font-display text-[11px] tracking-[0.08em] text-dim tabular-nums",children:ro(Hr(c))})]}):null:n.jsx("span",{className:"block h-3 w-40 bg-surface2"})})]}),n.jsxs("span",{className:"font-display text-[12px] leading-none tracking-[0.18em] text-green inline-flex items-center gap-1.5 shrink-0",children:["VIEW PROFILE",n.jsx(Jt,{size:12})]})]})}const nw=(e,t,s,r,a)=>{var c;const i=CR(e===rs&&r?r:e,a),l=(c=t==null?void 0:t.find(d=>d.isActive))==null?void 0:c.code;return{pathname:i===l?kn():kn(i),search:s.toString()}},jP=(e,t)=>({pathname:kn(e),search:t.toString()}),JS="".split(",").map(e=>e.trim()).filter(Boolean),Pne={Noya:"237762740532412416"},One=Object.values(Pne),Lne=JS.length>0?JS:One;function Dne(e){return!!e&&Lne.includes(e)}const kP=p.createContext(null),Ine=kP.Provider,SP=p.createContext({images:new Map,ready:!1}),rw=SP.Provider,NP=()=>p.useContext(SP);function CP(e){const t=p.useContext(kP),s=NP(),r=e.s??t;return p.useMemo(()=>vr(e.n,r,s),[e.n,r,s])}const Eu="overflow-hidden rounded-[4.5%/3.2%] [outline-style:solid] outline-1 -outline-offset-1 outline-white/10 shadow-[0_-2px_6px_rgba(0,0,0,0.6)]",Xm=`${Eu} transition-[outline-color] group-hover:outline-white/50 hover:outline-white/50`;function $i(e){const[t,s]=p.useState(0);return p.useEffect(()=>s(0),[e]),{src:e[t]??null,onError:()=>s(r=>r+1)}}function hc({card:e,className:t}){const s=p.useContext(aw),{src:r,onError:a}=$i(CP(e)),o=s?i=>{i.preventDefault(),s(e)}:void 0;return r?n.jsx("img",{src:r,alt:e.n??"",loading:"lazy",draggable:!1,onError:a,onContextMenu:o,className:j("block aspect-[488/680] w-full object-cover",t)},r):n.jsx("div",{onContextMenu:o,className:j("aspect-[488/680] bg-surface2",t)})}function ex({count:e,reveal:t,width:s,className:r,cardClassName:a,glowIndexes:o=[],cardAt:i,tapToPreview:l=!1,renderCard:c}){const d=p.useContext(aw),[u,f]=p.useState(null);if(e<=0)return null;const h=s!=null?{width:s}:void 0,m=y=>b=>{const w=i==null?void 0:i(y);w&&d&&(b.preventDefault(),d(w))};return n.jsx("div",{className:j("relative [display:flow-root]",r),style:h,children:Array.from({length:e},(y,b)=>{const w=b===e-1,x=o.includes(b),g=u===b?30:x?10:void 0,v={onMouseEnter:()=>f(b),onMouseLeave:()=>f(k=>k===b?null:k),onContextMenu:m(b),onClick:l?m(b):void 0};return w?n.jsx("div",{className:j("group relative",l&&"cursor-pointer",a,x&&"review-last-pick"),style:{marginTop:(e-1)*t,zIndex:g},...v,children:c(b)},b):n.jsx("div",{className:j("group absolute inset-x-0",l&&"cursor-pointer"),style:{to
509p:b*t,height:t,zIndex:g},...v,children:n.jsx("div",{className:j("pointer-events-none absolute inset-x-0 top-0",a,x&&"review-last-pick"),children:c(b)})},b)})})}const aw=p.createContext(null),_P=p.createContext(()=>({tierCard:void 0,dataGrade:null})),TP={"data-keeps-preview":""};function EP({setCode:e,followKey:t,followCard:s,children:r}){const a=$ne(e),[o,i]=p.useState(null),l=p.useMemo(()=>c=>i(c),[]);return p.useEffect(()=>{s&&i(c=>c&&s)},[t,s]),p.useEffect(()=>{if(!o)return;const c=()=>i(null),d=f=>{f.key==="Escape"&&c()},u=f=>{const h=f.target instanceof Element&&f.target.closest("[data-keeps-preview]");f.button===0&&!h&&c()};return window.addEventListener("keydown",d),window.addEventListener("pointerdown",u,!0),()=>{window.removeEventListener("keydown",d),window.removeEventListener("pointerdown",u,!0)}},[o]),n.jsx(aw.Provider,{value:l,children:n.jsxs(_P.Provider,{value:a,children:[r,o&&n.jsx(Une,{card:o,grades:a(o)})]})})}function Mne({card:e}){const{tierCard:t,dataGrade:s}=p.useContext(_P)(e),r=s??(t==null?void 0:t.tier);if(!r||r==="TBD")return null;const a=/[+-]$/.test(r);return n.jsx("div",{className:"pointer-events-none absolute bottom-[44%] right-[8%]",children:n.jsx("div",{className:j("bg-black/80 px-1.5 py-0.5 backdrop-blur-sm lg:px-2 lg:py-1",a&&"pr-0.5 lg:pr-1"),style:{clipPath:"polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px)"},children:n.jsx(sb,{tier:r,className:"text-[15px] lg:text-[20px]"})})})}function $ne(e){const t=Fv(e),{data:s}=Zm(t.effectiveUid,t.graders),r=cf(e);return p.useMemo(()=>{const a=new Map;for(const o of s??[])a.set(Ua(o.name),o);return o=>{var c;const i=o.n??"",l=((c=r==null?void 0:r.gradesFor(i))==null?void 0:c.all)??null;return{tierCard:a.get(Ua(i)),dataGrade:l}}},[s,r])}function Une({card:e,grades:t}){const{src:s,onError:r}=$i(CP(e)),a=t.tierCard||t.dataGrade;return n.jsx("div",{className:"pointer-events-none fixed inset-x-0 top-1/2 z-[70] flex -translate-y-1/2 justify-center md:inset-x-auto md:right-10 md:block",children:n.jsxs("div",{className:"relative",style:{animation:"card-preview-in-right 180ms ease-out"},children:[s?n.jsx("img",{src:s,alt:e.n??"",draggable:!1,onError:r,className:"h-[54vh] max-h-[500px] w-auto rounded-[4.5%/3.2%] shadow-2xl outline outline-1 -outline-offset-1 outline-white/20"},s):n.jsx("div",{className:"flex h-[54vh] max-h-[500px] w-[39vh] max-w-[360px] items-center justify-center rounded-xl bg-surface2 p-6 shadow-2xl",children:n.jsx("span",{className:"font-body text-sm text-subtle",children:e.n})}),a&&n.jsx(zne,{grades:t})]})})}function zne({grades:e}){const{tierCard:t,dataGrade:s}=e,r="text-[12px] font-semibold uppercase leading-none tracking-[0.1em] text-white";return n.jsx("div",{className:"pointer-events-none absolute bottom-[44%] right-[8%]",children:n.jsxs("div",{className:"flex items-center gap-4 bg-black/80 px-3 py-2 backdrop-blur-sm",style:{clipPath:Uc},children:[t&&n.jsxs("span",{className:"flex items-center gap-2.5",children:[n.jsxs("span",{className:j("flex flex-col",r),children:[n.jsx("span",{children:"Tier"}),n.jsx("span",{children:"List"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(sb,{tier:t.tier,className:"text-[26px]"}),t.trend&&n.jsx("span",{className:"flex flex-col items-center",style:{color:El[t.trend]},children:Hv(t).map((a,o,i)=>n.jsx("span",{className:j("text-[11px] leading-none",o>0&&"-mt-[5px]"),style:{zIndex:i.length-o},children:a},o))})]})]}),s&&n.jsxs("span",{className:"flex items-center gap-2.5",children:[n.jsx("span",{className:r,children:"17L"}),n.jsx(sb,{tier:s,className:"text-[26px]"})]})]})})}function sb({tier:e,className:t}){return n.jsx("span",{className:j("font-display leading-none",t),style:{color:Fs(e)},children:e})}function RP(e){return/^[A-Z0-9]{2,5}$/.test(e)}function Bne(e,t){const s=XS(e.collectorNumber)-XS(t.collectorNumber);return s!==0?s:e.collectorNumber.localeCompare(t.collectorNumber)}function XS(e){const t=e.match(/^\d+/);return t?Number(t[0]):1/0}function AP(e){return je({queryKey:["set-cards",e],queryFn:()=>Fne(e),staleTime:1/0,retry:!1,enabled:RP(e)})}async function Fne(e){const t=await fetch(`/api/set-cards/${e}`);if(!t.ok)throw new Error(`Set cards failed with ${t.status}`);return t.json()}const PP={PremierDraft:{entryGems:1500,payouts:[{gems:50,packs:1},{gems:100,packs:1},{gems:250,packs:2},{gems:1e3,packs:2},{gems:1400,packs:3},{gems:1600,packs:4},{gems:1800,packs:5},{gems:2200,packs:6}]},TradDraft:{entryGems:1500,payouts:[{gems:100,packs:1},{gems:250,packs:1},{gems:1e3,packs:3},{gems:2500,packs:6}]},QuickDraft:{entryGems:750,payouts:[{gems:50,packs:1},{gems:100,packs:1},{gems:200,packs:1},{gems:300,packs:1},{gems:450,packs:1},{gems:650,packs:1},{gems:850,packs:1},{gems:950,packs:2}]},PickTwoDraft:{entryGems:0,payouts:[{gems:50,packs:1},{gems:150,packs:1},{gems:800,packs:1},{gems:1e3,packs:2},{gems:1300,packs:3}]}};function ow(e,t){const s=PP[e];return s?s.payouts[Math.min(Math.max(t,0),s.payouts.length-1)]??null:null}function Wne(e){var t;return((t=PP[e])==null?void 0:t.entryGems)??null}const bg={},OP={packsOwned:0,goldenPacks:0,masteryLevel:0,rankedSeasonPacks:0};function Pn(){if(!$t)throw new Error("Tracker needs a Supabase client");return $t}let tl=null;$t==null||$t.auth.onAuthStateChange(()=>{tl=null});async function tx(){return tl||(tl=Pn().auth.getUser().then(({data:e})=>
509{if(!e.user)throw tl=null,new Error("Not authenticated");return e.user.id},e=>{throw tl=null,e})),tl}const Hne="slug, set_code, event_id, format, expansion, wins, losses, is_trophy, colors, started_at, finished_at, seventeenlands_event_id, external_url, event_name, end_rank, account_id, pool_rares, pool_mythics, deck_cards, match_results";async function iw(e,t){const{data:s,error:r}=await Pn().from("public_player_draft_events").select(Hne).eq("slug",e).eq("set_code",t).order("finished_at",{ascending:!1,nullsFirst:!1});if(r)throw r;return(s??[]).map(a=>{const o=a,i=o.match_results??null,l=Gne(o.wins??0,o.losses??0,i);return{slug:o.slug,setCode:o.set_code,eventId:o.event_id,format:o.format,expansion:o.expansion,wins:l.wins,losses:l.losses,isTrophy:!!o.is_trophy,colors:o.colors??"",startedAt:o.started_at??null,finishedAt:o.finished_at??null,seventeenlandsEventId:o.seventeenlands_event_id??null,externalUrl:o.external_url??null,eventName:o.event_name??null,endRank:o.end_rank??null,accountId:o.account_id??null,poolRares:o.pool_rares??null,poolMythics:o.pool_mythics??null,deckCards:o.deck_cards??null,matchResults:i}})}function Gne(e,t,s){if(!s||s.length<=e+t)return{wins:e,losses:t};let r=0;for(const a of s)a.won&&(r+=1);return{wins:r,losses:s.length-r}}async function Vne(){const{data:e,error:t}=await Pn().from("public_my_player_accounts").select("account_id, account_name, events");if(t)throw t;return(e??[]).map(s=>({accountId:s.account_id,accountName:s.account_name,events:s.events??0})).sort((s,r)=>r.events-s.events)}async function Kne(){const{data:e,error:t}=await Pn().from("tracker_draft_notes").select("draft_event_id, note, deck_label");if(t)throw t;return(e??[]).map(s=>({draftEventId:s.draft_event_id,note:s.note??"",deckLabel:s.deck_label??""}))}async function nb(e,t){const{error:s}=await Pn().from("tracker_draft_notes").upsert({user_id:await tx(),draft_event_id:e,...t.note!==void 0?{note:t.note}:{},...t.deckLabel!==void 0?{deck_label:t.deckLabel}:{},updated_at:new Date().toISOString()},{onConflict:"user_id,draft_event_id"});if(s)throw s}async function qne(){const{data:e,error:t}=await Pn().from("tracker_match_notes").select("draft_event_id, match_number, result, opponent_colors, note");if(t)throw t;return(e??[]).map(s=>({draftEventId:s.draft_event_id,matchNumber:s.match_number,result:s.result??null,opponentColors:s.opponent_colors??"",note:s.note??""}))}async function Zne(e,t,s){const{error:r}=await Pn().from("tracker_match_notes").upsert({user_id:await tx(),draft_event_id:e,match_number:t,...s.note!==void 0?{note:s.note}:{},...s.result!==void 0?{result:s.result}:{},...s.opponentColors!==void 0?{opponent_colors:s.opponentColors}:{},updated_at:new Date().toISOString()},{onConflict:"user_id,draft_event_id,match_number"});if(r)throw r}async function Yne(e){const{data:t,error:s}=await Pn().from("tracker_collection").select("card_name, owned").eq("set_code",e);if(s)throw s;return(t??[]).map(r=>({cardName:r.card_name,owned:r.owned}))}async function Qne(e,t){if(t.length===0)return;const s=await tx(),r=new Date().toISOString(),a=t.map(i=>({user_id:s,set_code:e,card_name:i.cardName,owned:i.owned,updated_at:r})),{error:o}=await Pn().from("tracker_collection").upsert(a,{onConflict:"user_id,set_code,card_name"});if(o)throw o}async function Jne(e){return LP(`set_code=${encodeURIComponent(e)}`)}async function Xne(e){return LP(`event_id=${encodeURIComponent(e)}`)}async function LP(e){var i;if(((bg==null?void 0:bg.VITE_DATA_MODE)??"prod").toLowerCase()==="local"){const l=nv.replace(/\/$/,""),c=await fetch(`${l}/tracker/refresh?${e}`,{method:"POST"});if(!c.ok)throw new Error(`Refresh failed (${c.status})`);return c.json()}const s=vE.replace(/\/$/,"");if(!s)throw new Error("Refresh is not available yet");const{data:r}=await Pn().auth.getSession(),a=(i=r.session)==null?void 0:i.access_token;if(!a)throw new Error("Not authenticated");const o=await fetch(`${s}/tracker/refresh?${e}`,{method:"POST",headers:{Authorization:`Bearer ${a}`}});if(!o.ok)throw new Error(`Refresh failed (${o.status})`);return o.json()}async function ere(e){const{data:t,error:s}=await Pn().from("tracker_set_economy").select("packs_owned, golden_packs, mastery_level, ranked_season_packs").eq("set_code",e);if(s)throw s;const r=(t??[])[0];return r?{packsOwned:r.packs_owned??0,goldenPacks:r.golden_packs??0,masteryLevel:r.mastery_level??0,rankedSeasonPacks:r.ranked_season_packs??0}:OP}async function tre(e,t){const{error:s}=await Pn().from("tracker_set_economy").upsert({user_id:await tx(),set_code:e,...t.packsOwned!==void 0?{packs_owned:t.packsOwned}:{},...t.goldenPacks!==void 0?{golden_packs:t.goldenPacks}:{},...t.masteryLevel!==void 0?{mastery_level:t.masteryLevel}:{},...t.rankedSeasonPacks!==void 0?{ranked_season_packs:t.rankedSeasonPacks}:{},updated_at:new Date().toISOString()},{onConflict:"user_id,set_code"});if(s)throw s}function lw(e,t){const s=(e??[]).filter(r=>r.format!=="PodDraft");return t==null?s:s.filter(r=>r.accountId===t||r.accountId==null)}
509function sre(e,t,s){const{data:r}=je({queryKey:["tracker-drafts",e,t],queryFn:()=>iw(e,t),enabled:!!e});return p.useMemo(()=>{const a=lw(r,s),o=a.reduce((l,c)=>{const d=ow(c.format,c.wins);return l.rares+=c.poolRares??0,l.mythics+=c.poolMythics??0,l.gems+=(d==null?void 0:d.gems)??0,l.spent+=Wne(c.format)??0,l.packs+=(d==null?void 0:d.packs)??0,l},{rares:0,mythics:0,gems:0,spent:0,packs:0}),i=Math.max(a.length,1);return{drafts:a.length,rares:o.rares,avgRares:o.rares/i,avgMythics:o.mythics/i,gems:o.gems,spent:o.spent,packs:o.packs}},[r,s])}function nre(e,t,s){const{data:r}=je({queryKey:["tracker-drafts",e,t],queryFn:()=>iw(e,t),enabled:!!e});return p.useMemo(()=>{var l;const a=lw(r,s);if(!a.length)return{avgRares:null,avgPacksWon:null};let o=0,i=0;for(const c of a)o+=c.poolRares??0,i+=((l=ow(c.format,c.wins))==null?void 0:l.packs)??0;return{avgRares:o/a.length,avgPacksWon:i/a.length}},[r,s])}const rre={FRA:{track:{totalPacks:23,levelsCap:18,bonuses:[{atLevel:23,packs:5}],mythicIcrs:[{atLevel:4,cards:3},{atLevel:21,cards:3},{atLevel:29,cards:4}]},mythicUpgrade:7,bonusSlot:{rareChance:1/10,mythicUpgrade:5.7}},HOB:{track:{totalPacks:26,levelsCap:22,bonuses:[{atLevel:21,packs:4}],mythicIcrs:[]},mythicUpgrade:8.1},MSH:{track:{totalPacks:25,levelsCap:21,bonuses:[{atLevel:8,packs:2},{atLevel:24,packs:2}],mythicIcrs:[]},mythicUpgrade:5.8},SOS:{track:{totalPacks:31,levelsCap:27,bonuses:[{atLevel:3,packs:1},{atLevel:17,packs:1},{atLevel:35,packs:1},{atLevel:47,packs:1}],mythicIcrs:[]},mythicUpgrade:7},TMT:{track:{totalPacks:26,levelsCap:22,bonuses:[{atLevel:6,packs:2},{atLevel:30,packs:2}],mythicIcrs:[]},mythicUpgrade:8.1},ECL:{track:{totalPacks:23,levelsCap:18,bonuses:[{atLevel:4,packs:3},{atLevel:26,packs:2}],mythicIcrs:[]},mythicUpgrade:7}},eN=1/30,tN=5,sN=7.1,DP={rares:tN*(1-1/sN),mythics:1+tN/sN},are=3,ore=2.5;function ire(e){return rre[e]??null}function sx(e){const t=1/e.mythicUpgrade;let s=1-t-eN,r=t-eN;if(e.bonusSlot){const{rareChance:a,mythicUpgrade:o}=e.bonusSlot;s+=a*(1-1/o),r+=a/o}return{rares:s,mythics:r}}function cw(e,t){const s=Math.max(0,e);let r=Math.min(Math.trunc(s/2),t.levelsCap);for(const a of t.bonuses)s>=a.atLevel&&(r+=a.packs);return Math.max(0,t.totalPacks-r)}function lre(e,t,s,r){const a=cw(e.masteryLevel,r.track)+e.rankedSeasonPacks,o=t.cards*4,i=s.cards*4,l=s.owned+(e.packsOwned+a)*sx(r).mythics+e.goldenPacks*DP.mythics+ure(e.masteryLevel,r.track);return{futureRewardPacks:a,rarePct:o?Math.round(dw(e,t.owned,r)/o*100):0,mythicPct:i?Math.round(l/i*100):0}}function cre(e,t,s){const r=t.cards*4-dw(e,t.owned,s);return Math.max(Math.ceil(r/sx(s).rares),0)}function dre(e,t,s,r){const a=s.avgRares??are,o=s.avgPacksWon??ore,i=a+o*sx(r).rares;if(i<=0)return 0;const l=t.cards*4-dw(e,t.owned,r);return Math.max(Math.ceil(l/i),0)}function dw(e,t,s){const r=e.packsOwned+cw(e.masteryLevel,s.track)+e.rankedSeasonPacks;return t+r*sx(s).rares+e.goldenPacks*DP.rares}function ure(e,t){let s=0;for(const r of t.mythicIcrs)e<r.atLevel&&(s+=r.cards);return s}const fre="font-display text-[13px] tracking-[0.08em] text-muted",nN={W:"#f5efd6",U:"#4aa8ff",B:"#a98eff",R:"#ff5e5e",G:"#2ee85c",M:"#ffc63a",C:"#8a93a5"},yg={rare:{color:"#A58E4A",gradient:"linear-gradient(90deg, #876a3b 0%, #dfbd6b 50%, #876a3b 100%)"},mythic:{color:"#BF4427",gradient:"linear-gradient(90deg, #9E3620 0%, #D2603C 50%, #9E3620 100%)"}};function Go(e){return e.split(" // ")[0].trim()}function hre(e){const t=new Map;for(const s of e??[])t.set(s.cardName,s.owned),t.set(Go(s.cardName),s.owned);return s=>t.get(s)??t.get(Go(s))??0}function rN(e,t){const s=e.flatMap(o=>o.cards),r=s.reduce((o,i)=>o+t(i),0),a=s.reduce((o,i)=>o+(t(i)>0?1:0),0);return{cards:s.length,owned:r,held:a,pct:s.length?Math.round(r/(s.length*4)*100):0,heldPct:s.length?Math.round(a/s.length*100):0}}function IP({slug:e,setCode:t,accountId:s,narrow:r=!1}){const a=dn(),o=ut();NY(`Tracker ${t}`);const{data:i,isLoading:l,error:c}=AP(t),d=p.useMemo(()=>i&&Sre(i),[i]),{data:u}=je({queryKey:["tracker-collection",t],queryFn:()=>Yne(t),staleTime:6e4}),f=p.useMemo(()=>hre(u),[u]),{setCount:h,syncFailed:m}=mre(t),y=p.useMemo(()=>hte(t,[...(i==null?void 0:i.cards)??[],...(i==null?void 0:i.specialGuests)??[]]
509),[i,t]),{data:b}=je({queryKey:["tracker-economy",t],queryFn:()=>ere(t)}),w=async J=>{await tre(t,J),a.invalidateQueries({queryKey:["tracker-economy",t]})},[x,g]=p.useState(null),v=p.useCallback(()=>g(null),[]),k=p.useCallback((J,Z)=>g({sources:vr(Z,t,y),anchor:uf(J)}),[t,y]),[S,N]=p.useState(null),C=p.useCallback(()=>N(null),[]),_=p.useCallback(J=>{g(null),N({card:J,sources:vr(J,t,y)})},[t,y]),T=nre(e,t,s),[E,A]=p.useState("playset"),[P,M]=p.useState("rare");if(l)return n.jsxs("div",{className:"px-5 md:px-10 py-8 text-muted text-[14px]",children:["Loading ",t," cards"]});if(c||!d||d.rares.length+d.mythics.length===0)return n.jsxs("div",{className:"px-5 md:px-10 py-8 text-red text-[14px]",children:["Scryfall has no rares or mythics for ",t]});const U=rN(d.rares,f),F=rN(d.mythics,f),I=b??OP,q=ire(t),O=q&&lre(I,U,F,q),H=o?"grid-cols-1":r?"grid-cols-2":"grid-cols-2 xl:grid-cols-4",B=o||r?"grid-cols-1":"grid-cols-1 xl:grid-cols-2",D=q&&cw(I.masteryLevel,q.track),L=D==null?null:D+I.rankedSeasonPacks,$=L==null?null:I.packsOwned+L,V=E==="playset",z=()=>A(V?"singles":"playset"),K=[{key:"rare",label:"RARES",sections:d.rares,rarity:yg.rare,owned:V?U.owned:U.held,total:V?U.cards*4:U.cards,pct:V?U.pct:U.heldPct,projected:V?(O==null?void 0:O.rarePct)??null:null,missing:U.cards-U.held,extraLine:q&&`${dre(I,U,T,q)} drafts to complete`},{key:"mythic",label:"MYTHICS",sections:d.mythics,rarity:yg.mythic,owned:V?F.owned:F.held,total:V?F.cards*4:F.cards,pct:V?F.pct:F.heldPct,projected:V?(O==null?void 0:O.mythicPct)??null:null,missing:F.cards-F.held,extraLine:null}],W={lookup:f,playsets:V,costs:o?d.costs:void 0,touch:o,onSet:h,onOpen:_,onHover:o?void 0:k,onLeave:v};return n.jsxs("div",{className:"p-4",children:[m&&n.jsx("div",{className:"border border-red/40 bg-red/10 text-red text-[13px] px-3 py-1.5 mb-3",children:"Some counts failed to save and reverted to the last saved value"}),n.jsx("div",{className:"border border-border bg-surface mb-4",children:n.jsxs("div",{className:"grid gap-[1px] bg-border auto-rows-fr",style:{gridTemplateColumns:"2fr 1fr 2fr 1fr"},children:[n.jsx(lh,{label:"PACKS OWNED",value:I.packsOwned,tooltip:"Unopened Packs you own",onCommit:J=>w({packsOwned:J})}),n.jsx(lh,{label:"GOLDEN PACKS",value:I.goldenPacks,tooltip:"Golden Packs you own, about 4.3 Rares each",onCommit:J=>w({goldenPacks:J})}),n.jsx(lh,{label:"PASS LVL",value:I.masteryLevel,tooltip:"Your Mastery Pass level",onCommit:J=>w({masteryLevel:J})}),n.jsx(lh,{label:"RANKED PACKS",value:I.rankedSeasonPacks,tooltip:"Packs from Ranked Season Rewards",onCommit:J=>w({rankedSeasonPacks:J})}),n.jsx(ch,{label:"PASS PACKS",value:D,tooltip:"Pass Packs left on the track"}),n.jsx(ch,{label:"FUTURE PACKS",value:L,tooltip:"Pass Packs plus Ranked Packs"}),n.jsx(ch,{label:"TO OPEN",value:$,tooltip:"Packs you own plus every Future Pack"}),n.jsx(ch,{label:"PACKS NEEDED",value:q&&cre(I,U,q),tooltip:"Extra Packs you need for a full Rare Playset"})]})}),o&&n.jsx("div",{className:"grid grid-cols-2 gap-2 mb-3",children:K.map(J=>n.jsx("div",{className:j("border",J.key===P?"border-border2 bg-surface2":"border-border bg-surface"),children:n.jsx(oN,{label:J.label,owned:J.owned,total:J.total,pct:J.pct,projected:J.projected,rarity:J.rarity,missing:J.missing,extraLine:J.extraLine,onToggleMode:()=>J.key===P?z():M(J.key)})},J.key))}),n.jsx("div",{className:j("grid gap-4 items-start",H),children:K.filter(J=>!o||J.key===P).map(({key:J,label:Z,sections:Y,rarity:ae,owned:pe,total:ye,pct:De,projected:Fe,missing:tt,extraLine:st})=>n.jsxs("div",{className:j(!r&&!o&&"xl:col-span-2"),children:[!o&&n.jsx("div",{className:"border border-border bg-surface mb-3",children:n.jsx(oN,{label:Z,owned:pe,total:ye,pct:De,projected:Fe,rarity:ae,missing:tt,extraLine:st,onToggleMode:z})}),n.jsx("div",{className:j("grid gap-4",B),children:Y.map(ie=>n.jsx(aN,{label:ie.label,background:nN[ie.color]??nN.C,cards:ie.cards,...W},`${J}-${ie.color}`))}),J==="mythic"&&d.specialGuests.length>0&&n.jsx("div",{className:"mt-4",children:n.jsx(aN,{label:"Special Guests",background:yg.mythic.gradient,cards:d.specialGuests,...W})})]},J))}),x&&n.jsx(xre,{...x}),S&&n.jsx(gre,{...S,onClose:C})]})}const pre=700;function mre(e){const t=dn(),s=p.useRef(new Map),r=p.useRef(null),[a,o]=p.useState(!1),i=p.useCallback(async()=>
509{if(r.current&&(clearTimeout(r.current),r.current=null),s.current.size===0)return;const c=[...s.current].map(([d,u])=>({cardName:d,owned:u}));s.current.clear();try{await Qne(e,c),o(!1)}catch{o(!0),t.invalidateQueries({queryKey:["tracker-collection",e]})}},[e,t]),l=p.useCallback((c,d)=>{t.setQueryData(["tracker-collection",e],u=>{const f=(u??[]).filter(h=>h.cardName!==c);return f.push({cardName:c,owned:d}),f}),s.current.set(c,d),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{i()},pre)},[e,t,i]);return p.useEffect(()=>{const c=()=>{document.hidden&&i()};return document.addEventListener("visibilitychange",c),()=>{document.removeEventListener("visibilitychange",c),i()}},[i]),{setCount:l,syncFailed:a}}function aN({label:e,background:t,cards:s,lookup:r,playsets:a,costs:o,touch:i,onSet:l,onOpen:c,onHover:d,onLeave:u}){let f=0;for(const h of s){const m=r(h);f+=a?m:Math.min(m,1)}return n.jsxs("section",{className:"border border-border",children:[n.jsxs("header",{className:"flex items-baseline gap-2 px-2.5 py-1.5",style:{background:t},children:[n.jsx("span",{className:"font-display text-[15px] tracking-[0.16em] text-bg",children:e}),n.jsxs("span",{className:"font-display tabular-nums ml-auto text-[15px] text-bg/75",children:[f,"/",s.length*(a?4:1)]})]}),n.jsx("div",{className:"flex flex-col gap-[1px] bg-border",children:s.map(h=>n.jsx(bre,{card:h,owned:r(h),cost:o==null?void 0:o[h],touch:i,onSet:l,onOpen:c,onHover:d,onLeave:u},h))})]})}function xre({sources:e,anchor:t}){const{src:s,onError:r}=$i(e);return s?n.jsx(Ym,{anchor:t,children:n.jsx("img",{src:s,alt:"",onError:r,className:"w-full rounded-[10px]"})}):null}function gre({card:e,sources:t,onClose:s}){const{src:r,onError:a}=$i(t);return r?n.jsx(UA,{src:r,alt:Go(e),onError:a,onClose:s}):null}function oN({label:e,owned:t,total:s,pct:r,projected:a,rarity:o,missing:i,extraLine:l,onToggleMode:c}){const d=[`${i}
509 singles missing`,l].filter(Boolean).join(" - "),[u,f]=p.useState(!1);return n.jsx(Ne,{label:d,open:u,children:n.jsxs("button",{onClick:c,onPointerEnter:()=>f(!0),onPointerLeave:()=>f(!1),onFocus:()=>f(!0),onBlur:()=>f(!1),className:"group block w-full text-left px-2.5 py-1",children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[n.jsx("span",{className:"font-display text-[14px] tracking-[0.16em]",style:{color:o.color},children:e}),n.jsxs("span",{className:"font-display tabular-nums text-[16px] text-text ml-auto",style:u?{color:o.color}:void 0,children:[t,"/",s]})]}),n.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[n.jsxs("span",{className:"relative h-[6px] flex-1 min-w-0 bg-bg overflow-hidden",children:[a!=null&&n.jsx("i",{className:"absolute inset-y-0 left-0 opacity-30",style:{width:`${Math.min(a,100)}%`,background:o.gradient}}),n.jsx("i",{className:"absolute inset-y-0 left-0",style:{width:`${Math.min(r,100)}%`,background:o.gradient}})]}),n.jsxs("span",{className:"font-display tabular-nums text-[15px] shrink-0",style:{color:o.color},children:[r,"%"]}),a!=null&&n.jsxs("span",{className:"font-display tabular-nums text-[15px] shrink-0",style:{color:o.color,opacity:.7},children:[a,"%"]})]})]})})}function MP({label:e,tooltip:t}){return n.jsx(Ne,{label:t,children:n.jsx("div",{className:"bg-surface px-2.5 py-1.5 flex items-center",children:n.jsx("span",{className:j("whitespace-nowrap",fre),children:e})})})}function lh({label:e,value:t,tooltip:s,onCommit:r}){const[a,o]=p.useState(String(t));return p.useEffect(()=>{o(String(t))},[t]),n.jsxs(n.Fragment,{children:[n.jsx(MP,{label:e,tooltip:s}),n.jsx(Ne,{label:s,children:n.jsx("label",{className:"bg-bg flex items-center cursor-text hover:bg-surface2",children:n.jsx("input",{value:a,inputMode:"numeric","aria-label":e,onChange:i=>o(i.target.value.replace(/[^0-9]/g,"").slice(0,3)),onFocus:i=>i.currentTarget.select(),onKeyDown:i=>{i.key==="Enter"&&i.currentTarget.blur()},onBlur:()=>{const i=Number(a||0);i!==t&&r(i)},size:2,className:`w-full min-w-0 px-2.5 py-1.5 bg-transparent text-center font-display tabular-nums
510                       text-[17px] text-text outline-none`})})})]})}function ch({label:e,value:t,tooltip:s}){return n.jsxs(n.Fragment,{children:[n.jsx(MP,{label:e,tooltip:s}),n.jsx(Ne,{label:s,children:n.jsx("div",{className:"bg-surface px-2.5 py-1.5 flex items-center justify-center",children:n.jsx("span",{className:"font-display tabular-nums text-[17px] text-subtle",children:t})})})]})}const bre=p.memo(function({card:t,owned:s,cost:r,touch:a=!1,onSet:o,onOpen:i,onHover:l,onLeave:c}){const d=wre(Go(t),yre,vre),u=()=>s<4?s+1:a?0:null;return n.jsxs("div",{onMouseEnter:l&&(f=>l(f.currentTarget,t)),onMouseLeave:c,className:"bg-surface flex items-stretch",children:[n.jsxs("button",{type:"button",onClick:()=>i(t),className:"flex flex-1 min-w-0 items-center text-left outline-none",children:[n.jsx("span",{ref:d,className:j("flex-1 min-w-0 truncate pl-3 pr-2 font-serif",a?"py-2":"py-[3px]",s===0?"text-muted":"text-text"),children:Go(t)}),r&&n.jsx("span",{className:"shrink-0 pr-2",children:n.jsx(lf,{cost:r,size:12})})]}),n.jsx("button",{"aria-label":a?`${Go(t)}, ${s} owned. Tap to add, tap again past four to clear`:`${Go(t)}, ${s} owned. Click to add, right click to remove`,onClick:()=>{const f=u();f!=null&&o(t,f)},onContextMenu:f=>{f.preventDefault(),s>0&&o(t,s-1)},className:j("font-display tabular-nums text-[16px] shrink-0 text-center select-none",a?"w-11":"w-9","border-0 border-l border-border outline-none hover:bg-surface2",s===4?"bg-green/15 text-green":"bg-bg text-text"),children:s})]})}),yre=15,vre=10;function wre(e,t,s){const r=p.useRef(null),a=p.useRef(0);return p.useLayoutEffect(()=>{var d;const o=r.current;if(!o)return;a.current=0;const i=()=>{const u=o.clientWidth;if(!u||u===a.current||(a.current=u,o.style.fontSize=`${t}px`,o.scrollWidth<=u))return;let f=Math.max(s,Math.floor(t*u/o.scrollWidth));for(o.style.fontSize=`${f}px`;f>s&&o.scrollWidth>u;)f-=1,o.style.fontSize=`${f}px`};i();const l=new ResizeObserver(i);l.observe(o);const c=()=>{a.current=0,i()};return(d=document.fonts)==null||d.ready.then(c),()=>l.disconnect()},[e,t,s]),r}const jre=["W","U","B","R","G","M","C"],kre={W:"White",U:"Blue",B:"Black",R:"Red",G:"Green",M:"Multicolor",C:"Colorless"};function Sre(e){const t={};for(const s of[...e.cards,...e.specialGuests])s.manaCost&&(t[s.name]=s.manaCost);return{rares:iN(e.cards.filter(s=>s.rarity==="rare")),mythics:iN(e.cards.filter(s=>s.rarity==="mythic")),specialGuests:e.specialGuests.map(s=>s.name),costs:t}}function iN(e){const t=new Map;for(const r of e){const a=Nre(r.colorIdentity);t.has(a)||t.set(a,[]),t.get(a).push(r.name)}const s=[];for(const r of jre){const a=t.get(r);a!=null&&a.length&&s.push({color:r,label:kre[r],cards:a})}return s}function Nre(e){return e.length===0?"C":e.length>1?"M":e[0]}const $P="h-[40px]",UP="42px 76px 116px 96px 68px 52px 38px 38px 50px 42px minmax(0, 1fr) 30px",zP="26px minmax(0, 1.2fr) 42px minmax(0, 1.25fr) 24px",Cre="flex items-center min-w-0 px-2 py-2.5",_re="font-display text-[13px] tracking-[0.16em] text-muted",Js="border-r border-border",BP="grid [&>*:last-child]:border-r-0";function FP(e){return vp(e).replace(/\s*Draft$/i,"").toUpperCase()}const WP="tracker-draft-sort",lN={key:"number",dir:"asc"};function Tre(e){return e==="number"||e==="date"||e==="colors"||e==="record"||e==="rares"||e==="mythics"}function Ere(){if(typeof window>"u")return lN;const[e,t]=(window.localStorage.getItem(WP)??"").split(":");return!Tre(e)||t!=="asc"&&t!=="desc"?lN:{key:e,dir:t}}function Rre(e,{key:t,dir:s}){const r=s==="desc"?-1:1,a=({event:i})=>i.poolRares??0,o=({event:i})=>i.poolMythics??0;return[...e].sort((i,l)=>{if(t==="colors"){const u=i.event.colors.localeCompare(l.event.colors);return u!==0?r*u:i.index-l.index}let c,d;return t==="number"?(c=i.index,d=l.index):t==="date"?(c=i.event.finishedAt?Date.parse(i.event.finishedAt):0,d=l.event.finishedAt?Date.parse(l.event.finishedAt):0):t==="record"?(c=i.event.wins-i.event.losses,d=l.event.wins-l.event.losses):t==="rares"?(c=a(i),d=a(l)):(c=o(i),d=o(l)),c!==d?r*(c<d?-1:1):i.index-l.index})}function HP({slug:e,setCode:t,accountId:s,updatedAt:r=null}){const a=dn(),o=ut(),{data:i,isLoading:l}=je({queryKey:["tracker-drafts",e,t],queryFn:()=>iw(e,t),enabled:!!e}),{data:c}=je({queryKey:["tracker-draft-notes"],queryFn:Kne}),{data:d}=je({queryKey:["tracker-match-notes"],queryFn:qne}),[u,f]=p.useState(null),[h,m]=p.useState(Ere),[y,b]=p.useState("ALL"),[w,x]=p.useState("ALL"),g=p.useMemo(()=>lw(i,s),[i,s]),v=p.useMemo(()=>g.filter(P=>
510Xa(P.format,y)&&(w==="ALL"||Bt(P.colors)===w)),[g,y,w]),k=p.useMemo(()=>{const P=[...new Set(g.map(M=>Bt(M.colors)).filter(Boolean))].sort();return[sG[0],...P.map(M=>({value:M,label:M}))]},[g]),S=p.useMemo(()=>{const P=[...new Set(g.map(F=>F.format))],M=Tn.filter(F=>F.value!=="ALL"&&P.some(I=>Xa(I,F.value))),U=P.filter(F=>!M.some(I=>Xa(F,I.value))).map(F=>({value:F,label:FP(F)}));return[{value:"ALL",label:"ALL FORMATS"},...M,...U]},[g]),N=p.useMemo(()=>{const P=new Map;for(const M of c??[])P.set(M.draftEventId,M);return P},[c]),C=p.useMemo(()=>{const P=F=>F.finishedAt?Date.parse(F.finishedAt):0,M=[...v].sort((F,I)=>P(F)-P(I)),U=new Map(M.map((F,I)=>[F.eventId,I+1]));return v.map(F=>({event:F,index:U.get(F.eventId)??0}))},[v]),_=p.useMemo(()=>Rre(C,h),[C,h]),T=p.useMemo(()=>v.flatMap(P=>{var M,U;return[...Gp((M=P.deckCards)==null?void 0:M.maindeck),...Gp((U=P.deckCards)==null?void 0:U.sideboard)]}).map(P=>({name:P.name,set:t})),[v,t]),E=Mi(T),A=P=>m(M=>({key:P,dir:M.key===P&&M.dir==="asc"?"desc":"asc"}));return p.useEffect(()=>{window.localStorage.setItem(WP,`${h.key}:${h.dir}`)},[h]),l?n.jsx("div",{className:"px-5 md:px-10 py-8 text-muted text-[14px]",children:"Loading events"}):v.length?n.jsxs("div",{children:[o&&n.jsxs("div",{className:"px-[18px]",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2.5",children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[n.jsx(Xe,{size:12,children:"EVENT LOG"}),n.jsxs("span",{className:"font-display text-[11px] tracking-[0.12em] text-dim",children:[v.length," EVENTS"]})]}),r&&n.jsxs("span",{className:"font-display text-[11px] tracking-[0.12em] text-muted",children:["UPDATED ",Cc(r)]})]}),n.jsxs("div",{className:"flex items-stretch gap-2 mb-3",children:[n.jsx("div",{className:"flex-1 min-w-0 flex",children:n.jsx(yt,{value:y,onChange:b,options:S,variant:"mobile",renderValue:Ss,renderOption:Ss})}),n.jsx("div",{className:"flex-1 min-w-0 flex",children:n.jsx(yt,{label:"COLORS",value:w,onChange:x,options:k,variant:"mobile",renderValue:hr,renderOption:hr})})]})]}),n.jsx("div",{className:j(BP,o?"border-y border-border2":"border-x border-b border-border2",_re,$P),style:{gridTemplateColumns:o?zP:UP},children:o?n.jsxs(n.Fragment,{children:[n.jsx(Cr,{label:"#",sortKey:"number",sort:h,onSort:A}
510),n.jsx(Cr,{label:"COLORS DECK",sortKey:"colors",sort:h,onSort:A,cellClassName:Js}),n.jsx(Cr,{label:"W/L",sortKey:"record",sort:h,onSort:A,align:"center",cellClassName:Js}),n.jsx(ot,{children:"NOTES"}),n.jsx(ot,{})]}):n.jsxs(n.Fragment,{children:[n.jsx(Cr,{label:"#",sortKey:"number",sort:h,onSort:A}),n.jsx(Cr,{label:"COLORS",sortKey:"colors",sort:h,onSort:A}),n.jsx(ot,{className:Js,children:"DECK"}),n.jsx(Ire,{value:y,options:S,onChange:b}),n.jsx(Cr,{label:"DATE",sortKey:"date",sort:h,onSort:A}),n.jsx(Cr,{label:"W/L",sortKey:"record",sort:h,onSort:A,align:"end",cellClassName:Js}),n.jsx(Cr,{label:"R",sortKey:"rares",sort:h,onSort:A,align:"center"}),n.jsx(Cr,{label:"M",sortKey:"mythics",sort:h,onSort:A,align:"center"}),n.jsx(ot,{className:"justify-end",children:"GEMS"}),n.jsx(ot,{className:j("justify-center",Js),children:"PACKS"}),n.jsx(ot,{children:"NOTE"}),n.jsx(ot,{})]})}),n.jsx("div",{className:"flex flex-col",children:_.map(({event:P,index:M})=>{var U,F;return n.jsx(Are,{index:M,event:P,isMobile:o,setCode:t,cardImages:E,note:((U=N.get(P.eventId))==null?void 0:U.note)??"",deckLabel:((F=N.get(P.eventId))==null?void 0:F.deckLabel)??"",matchNotes:(d??[]).filter(I=>I.draftEventId===P.eventId),expanded:u===P.eventId,onToggle:()=>f(u===P.eventId?null:P.eventId),onSaved:()=>{a.invalidateQueries({queryKey:["tracker-draft-notes"]}),a.invalidateQueries({queryKey:["tracker-match-notes"]})}},P.eventId)})})]}):n.jsxs("div",{className:"px-5 md:px-10 py-8 text-muted text-[14px]",children:["No events recorded for ",t]})}function Are({index:e,event:t,isMobile:s,setCode:r,cardImages:a,note:o,deckLabel:i,matchNotes:l,expanded:c,onToggle:d,onSaved:u}){const f=ow(t.format,t.wins),h=t.finishedAt?new Date(t.finishedAt).toLocaleDateString(void 0,{month:"short",day:"numeric"}):"",[m,y]=p.useState(null),b=p.useMemo(()=>{var x,g;return{maindeck:Gp((x=t.deckCards)==null?void 0:x.maindeck),sideboard:Gp((g=t.deckCards)==null?void 0:g.sideboard)}},[t]),w=!s&&b.maindeck.length+b.sideboard.length>0;return n.jsxs("div",{className:j(s?"border-b border-border":"border-x border-b border-border",c?"bg-surface2":"bg-surface"),children:[n.jsx("div",{onClick:d,onMouseEnter:w?x=>{const g=x.currentTarget.getBoundingClientRect();y({top:g.top,bottom:g.bottom})}:void 0,onMouseLeave:w?()=>y(null):void 0,className:j(BP,"cursor-pointer hover:bg-surface2"),style:{gridTemplateColumns:s?zP:UP},children:s?n.jsxs(n.Fragment,{children:[n.jsx(hN,{index:e,externalUrl:t.externalUrl}),n.jsxs(ot,{className:j("p-0",Js),children:[n.jsx("span",{className:"shrink-0 pl-1 flex items-center",children:n.jsx(Be,{colors:t.colors,size:13})}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(pN,{value:i,placeholder:t.colors,onCommit:async x=>{await nb(t.eventId,{deckLabel:x}),u()}})})]}),n.jsx(ot,{className:j("justify-center",Js),children:n.jsxs("span",{className:"font-display tabular-nums text-[17px]",children:[t.wins,"-",t.losses]})}),n.jsx(ot,{children:n.jsx("span",{className:"font-serif text-[14px] text-subtle truncate",children:o})}),n.jsx(ot,{className:"p-0 justify-center",children:c?n.jsx(Et,{size:18,strokeWidth:2.5,className:"text-subtle"}):n.jsx(co,{size:18,strokeWidth:2.5,className:"text-subtle"})})]}):n.jsxs(n.Fragment,{children:[n.jsx(hN,{index:e,externalUrl:t.externalUrl}),n.jsx(ot,{children:n.jsx(Be,{colors:t.colors,size:13})}),n.jsx(ot,{className:j("p-0",Js),children:n.jsx(pN,{value:i,placeholder:t.colors,onCommit:async x=>{await nb(t.eventId,{deckLabel:x}),u()}})}),n.jsx(ot,{children:n.jsx("span",{className:"font-display text-[14px] tracking-[0.1em] text-muted truncate",children:FP(t.format)})}),n.jsx(ot,{children:n.jsx("span",{className:"font-mono text-[13px] text-muted whitespace-nowrap",children:h})}),n.jsx(ot,{className:j("justify-end",Js),children:n.jsxs("span",{className:"font-display tabular-nums text-[17px]",children:[t.wins,"-",t.losses]})}),n.jsx(ot,{className:"justify-center",children:n.jsx("span",{className:"font-display tabular-nums text-[16px] text-subtle",children:t.poolRares??""})}),n.jsx(ot,{className:"justify-center",children:n.jsx("span",{className:"font-display tabular-nums text-[16px] text-subtle",children:t.poolMythics??""})}),n.jsx(ot,{className:"justify-end",children:n.jsx("span",{className:"font-display tabular-nums text-[16px] text-subtle",children:f?f.gems:""})}),n.jsx(ot,{className:j("justify-center",Js),children:n.jsx("span",{className:"font-display tabular-nums text-[16px] text-subtle",children:f?f.packs:""})}),n.jsx(ot,{children:n.jsx("span",{className:"font-serif text-[14px] text-subtle truncate",children:o})}),n.jsx(ot,{className:"p-0 justify-center",children:c?n.jsx(Et,{size:16,strokeWidth:2.5,className:"text-subtle"}):n.jsx(co,{size:16,strokeWidth:2.5,className:"text-subtle"})})]})}),m&&w&&n.jsx(Mre,{maindeck:b.maindeck,sideboard:b.sideboard,set:r,cardImages:a,rowBox:m}),c&&n.jsx(Ore,{event:t,note:o,matchNotes:l,onSaved:u,isMobile:s})]})}const Pre="36px auto auto minmax(0, 1fr)",cN="min-h-[42px]";function Ore({event:e,note:t,matchNotes:s,onSaved:r,isMobile:a}){const o=e.finishedAt?new Date(e.finishedAt).toLocaleDateString(void 0,{month:"short",day:"numeric"}).toUpperCase():"",i=e.wins+e.losses,l="border-t border-border",c=h=>(e.matchResults??[]).find(m=>m.match_number===h)??null,d=Array.from({length:i},(h,m)=>m+1).map(h=>{const m=c(h),y=s.find(b=>b.matchNumber===h);return{matchNumber:h,score:Dre((m==null?void 0:m.games)??[]),opponent:(y==null?void 0:y.opponentColors)||(m==null?void 0:m.opponent_colors)||"",note:(y==null?void 0:y.note)??""}}),u=d.some(h=>h.score)?j("justify-center px-2",l,Js):j("p-0",l),f=d.some(h=>h.opponent)?j("px-2",l,Js):j("p-0",l);return n.jsxs("div",{className:"border-t border-border2 bg-bg",children:[n.jsxs("div",{className:j("flex items-stretch",cN),children:[a&&n.jsxs("div",{className:"flex flex-col items-start justify-center gap-0.5 shrink-0 px-2 border-r border-border",children:[n.jsx("span",{className:"font-display text-[12px] tracking-[0.1em] text-muted leading-none whitespace-nowrap",children:ca(e.format)}),n.jsx("span",{className:"font-mono text-[11px] text-dim leading-none whitespace-nowrap",children:o})]}),e.seventeenlandsEventId&&n.jsx(Lre,{eventId:e.seventeenlandsEventId,onDone:r,className:"shrink-0 border-r border-border px-3 bg-surface2 hover:bg-surface"}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(mN,{initial:t,placeholder:"Notes",onSave:async h=>{await nb(e.eventId,{note:h}),r()}})})]}),n.jsx("div",{className:"grid",style:{gridTemplateColumns:Pre},children:d.map(({matchNumber:h,score:m,opponent:y,note:b})=>n.jsxs(p.Fragment,{children:[n.jsx(ot,{className:j("justify-center",cN,l,Js),children:n.jsxs("span",{className:"font-display tabular-nums text-[15px] text-subtle",children:["M",h]})}),n.jsx(ot,{className:u,children:m&&n.jsxs("span",{className:"font-display tabular-nums text-[17px]",children:[m.won,"-",m.lost]})}),n.jsx(ot,{className:f,children:y&&n.jsx(Be,{colors:y,size:13})}),n.jsx(ot,{className:j("p-0 items-stretch",l),children:n.jsx(mN,{initial:b,onSave:async w=>{await Zne(e.eventId,h,{note:w}),r()}})})]},h))})]})}function Lre({eventId:e,onDone:t,className:s}){const r=dn(),[a,o]=p.useState(!1),i=async()=>{o(!0);try{await Xne(e),r.invalidateQueries({queryKey:["tracker-drafts"]}),t()}finally{o(!1)}};return n.jsx("button",{type:"button",onClick:i,disabled:a,"aria-label":"Refresh this draft from 17lands",className:j("flex items-center justify-center text-muted hover:text-text disabled:opacity-50",s),children:n.jsx($1,{size:14,className:a?"animate-spin":void 0})})}function Dre(e){let t=0,s=0;for(const r of e??[])r.won===!0?t+=1:r.won===!1&&(s+=1);return t+s?{won:t,lost:s}:null}function Ire({value:e,options:t,onChange:s}){return n.jsx(ot,{className:"p-0",children:n.jsx(yt,{value:e,onCh
510ange:s,options:t,renderOption:Ss,className:"h-full",renderTrigger:({open:r,toggle:a})=>n.jsxs("button",{type:"button",onClick:a,"aria-label":"Filter by format",className:j("flex items-center gap-1 w-full h-full px-2 py-2.5 cursor-pointer","tracking-[inherit] text-[inherit] font-[inherit]",e==="ALL"?"hover:text-text":"text-green"),children:["FORMAT",n.jsx(Et,{size:13,strokeWidth:2.5,className:j("transition-transform",r&&"rotate-180")})]})})})}function ot({className:e,children:t}){return n.jsx("div",{className:j(Cre,e),children:t})}function Gp(e){const t=e??[];return[...t.filter(s=>s.rarity==="rare"),...t.filter(s=>s.rarity==="mythic")]}const dN=150,uN=4,fN=6;function Mre({maindeck:e,sideboard:t,set:s,cardImages:r,rowBox:a}){const o=e.length>0&&t.length>0,i=e.length===1&&t.length===1,l=o&&!i,d=(i?1:(e.length?1:0)+(t.length?1:0))*(dN*680/488+2*fN),u=window.innerHeight-a.bottom-8,f=a.top-8,h=d<=u||u>=f?a.bottom+8:a.top-8-d,m=(w,x,g)=>n.jsx("div",{className:j("flex border border-white/60 shadow-2xl overflow-hidden",g?"rounded-none":"rounded-xl",x&&"relative z-10"),style:{backgroundColor:"#161b26",padding:fN,gap:uN,marginBottom:x?-1:0},children:w.map((v,k)=>n.jsx("div",{style:{width:dN},children:n.jsx($re,{name:v.name,set:s,cardImages:r})},`${v.name}-${k}`))}),y=l&&e.length<=t.length,b=l&&t.length<e.length;return n.jsxs("div",{className:j("pointer-events-none fixed z-[100] flex items-center",i?"flex-row":"flex-col"),style:{top:h,left:"50%",transform:"translateX(-50%)",gap:i?uN:0},children:[e.length>0&&m(e,l,y),t.length>0&&m(t,!1,b)]})}function $re({name:e,set:t,cardImages:s}){const{src:r,onError:a}=$i(vr(e,t,s));return r?n.jsx("img",{src:r,alt:e,loading:"lazy",draggable:!1,onError:a,className:"w-full block rounded-[6px]",style:{aspectRatio:"488 / 680"}},r):n.jsx("div",{className:"rounded-[6px] bg-surface2",style:{aspectRatio:"488 / 680"}})}const Ure={start:"justify-start",center:"justify-center",end:"justify-end"};function Cr({label:e,sortKey:t,sort:s,onSort:r,align:a="start",cellClassName:o}){const i=s.key===t,l=s.dir==="asc"?n6:Et;return n.jsx(ot,{className:j("p-0",o),children:n.jsxs("button",{type:"button",onClick:()=>r(t),"aria-label":`Sort by ${e}`,"aria-sort":i?s.dir==="asc"?"ascending":"descending":"none",className:j("flex items-center gap-1 w-full h-full px-2 py-2.5 cursor-pointer","tracking-[inherit] text-[inherit] font-[inherit]",Ure[a],i?"text-text":"hover:text-text"),children:[e,i&&n.jsx(l,{size:13,strokeWidth:2.5})]})})}function hN({index:e,externalUrl:t}){const s="font-display tabular-nums text-[15px] text-subtle";return t?n.jsx(ot,{className:"p-0",children:n.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer","aria-label":`open draft ${e} on 17lands`,onClick:r=>r.stopPropagation(),className:j(s,"flex items-center w-full h-full pl-2 hover:text-green hover:bg-surface2"),children:e})}):n.jsx(ot,{className:"pl-2",children:n.jsx("span",{className:s,children:e})})}function pN({value:e,placeholder:t,onCommit:s}){const[r,a]=p.useState(e);return p.useEffect(()=>{a(e)},[e]),n.jsx("input",{value:r,placeholder:t,"aria-label":"deck name",onClick:o=>o.stopPropagation(),onChange:o=>a(o.target.value),onKeyDown:o=>{o.key==="Enter"&&o.currentTarget.blur()},onBlur:()=>{r!==e&&s(r)},className:`w-full h-full font-body text-[14px] bg-transparent border border-transparent
511                 px-2 text-text placeholder:text-subtle hover:border-border2 focus:border-green focus:bg-bg outline-none`})}function mN({initial:e,placeholder:t="",onSave:s}){const[r,a]=p.useState(e),[o,i]=p.useState(!1),l=p.useRef(null);p.useEffect(()=>{a(e)},[e]),p.useEffect(()=>{const d=l.current;if(!d)return;d.style.height="auto";const u=d.offsetHeight-d.clientHeight;d.style.height=`${d.scrollHeight+u}px`},[r]);const c=async()=>{r!==e&&(i(!0),await s(r),i(!1))};return n.jsx("textarea",{ref:l,value:r,rows:1,placeholder:t,"aria-label":"note",onCh
511ange:d=>a(d.target.value),onKeyDown:d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),d.currentTarget.blur())},onBlur:c,className:j(`block w-full h-full min-h-[42px] px-2 py-2.5 bg-transparent font-serif text-[15px] leading-relaxed
512         text-text outline-none resize-none overflow-hidden border border-transparent
513         placeholder:font-body placeholder:text-[13px] placeholder:text-muted
514         hover:border-border2 focus:border-green focus:bg-bg`,o&&"opacity-60")})}function GP({slug:e,setCode:t,accountId:s=null,className:r}){const a=sre(e,t,s);if(!a.drafts)return null;const o=[{label:"RARES",value:String(a.rares)},{label:"AVG RARES",value:a.avgRares.toFixed(1)},{label:"MYTHICS",value:a.avgMythics.toFixed(1)},{label:"GEMS",value:xN(a.gems)},{label:"GEMS USED",value:xN(a.spent)},{label:"PACKS",value:String(a.packs)}];return n.jsx("div",{className:j("self-stretch shrink-0 grid auto-rows-fr gap-[1px] bg-border border border-border",r),style:{gridTemplateColumns:"repeat(3, auto)"},children:o.map(i=>n.jsxs("div",{className:"bg-surface px-[6px] py-[7px] flex flex-col items-center justify-center text-center",children:[n.jsx("div",{className:"font-display text-[10.5px] tracking-[0.16em] leading-none text-muted whitespace-nowrap",children:i.label}),n.jsx("div",{className:"font-display tabular-nums text-[20px] leading-none mt-1 whitespace-nowrap",children:i.value})]},i.label))})}function xN(e){if(e<1e3)return String(e);const t=Math.round(e/100)/10;return`${t%1===0?t:t.toFixed(1)}k`}const zre="font-display text-[11px] tracking-[0.2em] text-muted",Bre=1e4;function VP({setCode:e,className:t}){const s=dn(),[r,a]=p.useState(!1),[o,i]=p.useState(null);p.useEffect(()=>{if(!o)return;const c=setTimeout(()=>i(null),Bre);return()=>clearTimeout(c)},[o]);const l=async()=>{a(!0);try{const c=await Jne(e);i({text:Fre(c),failed:!1}),s.invalidateQueries({queryKey:["tracker-drafts"]})}catch{i({text:"Refresh failed",failed:!0})}a(!1)};return n.jsxs("span",{className:j("relative inline-flex items-center",t),children:[n.jsx(Ne,{label:"Pull new drafts and deck detail from 17lands",children:n.jsxs("button",{onClick:l,disabled:r||!e,className:j("flex items-center gap-1.5 border border-border2 px-2.5 py-1 text-subtle","hover:text-text hover:border-border disabled:opacity-50",zre),children:[n.jsx(KT,{size:13,className:r?"animate-spin":void 0}),"17L"]})}),o&&n.jsx("span",{className:j("absolute left-1/2 -translate-x-1/2 bottom-full mb-2 z-30 whitespace-nowrap animate-fadeUpIn","rounded-md border border-border2 bg-black px-3 py-2 font-body text-[13px] leading-none","shadow-lg shadow-black/60",o.failed?"text-red":"text-text"),children:o.text})]})}function Fre({ingested:e,filled:t,missed:s}){const r=[];return e&&r.push(`${e} new`),t&&r.push(`${t} fetched`),s&&r.push(`${s} unavailable`),r.length?r.join(", "):"Nothing to update"}function Wre(e){return e.split(/[—-]/)[0].trim()||e}function KP(e){var o;const{data:t}=je({queryKey:["tracker-accounts"],queryFn:Vne,enabled:e}),[s,r]=p.useState(null),a=t??[];return{accounts:a,accountId:s??((o=a[0])==null?void 0:o.accountId)??null,setAccountId:r}}function qP({accounts:e,active:t,onChange:s,className:r}){return e.length<2?null:n.jsx("span",{className:j("flex gap-[1px] bg-border border border-border",r),children:e.map(a=>n.jsx(Ne,{label:`${a.events} drafts`,children:n.jsx("button",{onClick:()=>s(a.accountId),className:j("font-display text-[13px] tracking-[0.12em] px-3 py-1",t===a.accountId?"bg-green text-bg":"bg-surface text-muted hover:text-text"),children:Wre(a.accountName)})},a.accountId))})}const Hre=2e3;function ZP({text:e,label:t,ariaLabel:s,className:r}){const[a,o]=p.useState(!1);p.useEffect(()=>{if(!a)return;const l=window.setTimeout(()=>o(!1),Hre);return()=>window.clearTimeout(l)},[a]);const i=async l=>{l.preventDefault(),l.stopPropagation(),o(await Gre(e()))};return n.jsx(Ne,{label:"Copy to Clipboard",children:n.jsxs("button",{type:"button",onClick:i,"aria-label":s,className:j("shrink-0 inline-flex items-center gap-1.5 rounded-full border bg-surface2 px-3 py-1.5","font-display tracking-[0.14em] leading-none transition-colors cursor-pointer","outline-none focus:outline-none focus-visible:outline-none hover:text-green hover:border-green/50",a?"text-green border-green/50":"text-subtle border-border",r),style:{fontSize:13},children:[a?n.jsx(qy,{size:14}):n.jsx(MT,{size:14}),n.jsxs("span",{className:"grid",children:[n.jsx("span",{className:j("col-start-1 row-start-1",a&&"invisible"),children:t}),n.jsx("span",{className:j("col-start-1 row-start-1",!a&&"invisible"),children:"COPIED!"})]})]})})}async function Gre(e){if(navigator.clipboard&&window.isSecureContext)try{return await navigator.clipboard.writeText(e),!0}catch{return gN(e)}return gN(e)}function gN(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const s=document.execCommand("copy");return t.remove(),s}const Vre=60*60*1e3;function Kre(e){return e.includes("cdn.discordapp.com")||e.includes("media.discordapp.net")}function qre(e){try{const t=new URL(e).searchParams.get("ex");if(!t)return!1;const s=parseInt(t,16);return Number.isFinite(s)?s*1e3-Date.now()>Vre:!1}catch{return!1}}async function Zre(e,t){if(!$t)return null;const{data:s,error:r}=await $t.functions.invoke("refresh-deck-url",{body:{eventId:e,displayName:t}});return r?(console.warn("refresh-deck-url failed",r),null):(s==null?void 0:s.url)??null}async function Yre(e,t){if(!$t)return null;const{data:s,error:r}=await $t.functions.invoke("refresh-deck-url",{body:{channelId:e,messageId:t}});return r?(console.warn("refresh-deck-url (message) failed",r),null):(s==null?void 0:s.url)??null}function YP(e){const{deckScreenshotUrl:t,eventId:s,displayName:r,participantDisplayName:a,screenshotChannelId:o,screenshotMessageId:i}=e,l=!!s||!!o&&!!i,c=p.useMemo(()=>!t||!l?!1:Kre(t)&&!qre(t),[t,l]),[d,u]=p.useState(c?null:t),[f,h]=p.useState(c);return p.useEffect(()=>{u(c?null:t),h(c)},[t,c]),p.useEffect(()=>{if(!c)return;const y=o&&i?Yre(o,i):s?Zre(s,a??r):Promise.resolve(null);let b=!1;return y.then(w=>
514{b||u(w??t)}).finally(()=>{b||h(!1)}),()=>{b=!0}},[c,s,r,a,t,o,i]),{url:d,resolving:f}}const wr=(e,t)=>QP(e,t,null,"screenshot"),ta=(e,t,s,r="screenshot")=>QP(e,t,s,r),sa=(e,t)=>`/pods/${e}/${Jre(t)}`,Qre=(e,t,s,r)=>`${sa(e,t)}/${s+1}/${r+1}`,nx=e=>{if(e)return t=>{No(t)&&(t.preventDefault(),e())}},Ei=e=>n.jsx(te,{state:gi,...e}),QP=(e,t,s,r)=>{const a=new URLSearchParams;t&&a.set("player",t),s&&(a.set("deck",s),r==="decklist"&&a.set("view","pool"));const o=a.toString();return o?`/pods/${e}?${o}`:`/pods/${e}`},Jre=e=>e.playerSlug??String(e.seatIndex),Xre="Seats, logs & replays";function Fc({participant:e,initialTab:t="screenshot",tab:s,onTabChange:r,breakdownHref:a,hideDraftLog:o=!1,draftLogHref:i,cardImages:l,onClose:c,onPrev:d,onNext:u,prevHref:f,nextHref:h}){var V;const m=ut(),y=e.deckScreenshotUrl!==null,b=Number((e.record??"").split("-")[0]||0),w=Number((e.record??"").split("-")[1]||0),x=e.record!=null&&b+w>0,g=(((V=e.mainboard)==null?void 0:V.cards.length)??0)>0,v=`${e.eventId??""}::${e.participantDisplayName??e.displayName}`,[k,S]=p.useState(t),N=s??k,C=z=>{S(z),r==null||r(z)},_=y&&g?N:g?"decklist":"screenshot",T=y&&g,A=T||!o,P=!!e.deckSourceUrl,U=A||!!d||!!u||P,{url:F,resolving:I}=YP(e),[q,O]=p.useState(!1),[H,B]=p.useState(!1),[D,L]=p.useState(!0);p.useEffect(()=>{L(!0)},[e.deckScreenshotUrl]),p.useEffect(()=>{if(O(!1),B(!1),!F)return;const z=new Image;z.onload=()=>O(!0),z.onerror=()=>B(!0),z.src=F},[F]);const $=I||F!==null&&!q&&!H;return p.useEffect(()=>{const z=W=>{W.key==="Escape"?c():W.key==="ArrowLeft"&&d?(W.preventDefault(),d()):W.key==="ArrowRight"&&u&&(W.preventDefault(),u())};window.addEventListener("keydown",z);const K=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",z),document.body.style.overflow=K}},[c,d,u]),It.createPortal(n.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col items-center bg-black/80 backdrop-blur-sm animate-fadeIn px-[4px] md:px-6 pt-28 pb-6 lg:pt-28 lg:pb-8",onClick:c,role:"dialog","aria-modal":"true","aria-label":`${e.displayName}'s deck`,children:[n.jsxs("div",{className:"relative bg-surface border border-border w-full max-w-[1400px] h-[70vh] shrink-0 flex flex-col",onClick:z=>z.stopPropagation(),children:[n.jsxs("header",{className:"flex items-center gap-3 lg:gap-6 pl-9 pr-5 py-3 border-b border-border shrink-0",children:[n.jsx(Be,{colors:e.deckColors??"",size:18}),n.jsx("span",{className:"font-display text-text truncate flex-1 text-center lg:text-left",style:{fontSize:26,lineHeight:1,letterSpacing:"0.04em",fontFamily:"'Bebas Neue', sans-serif",paddingTop:4},children:e.displayName}),x&&n.jsx(ht,{wins:b,losses:w,className:"font-num text-[20px] shrink-0"}),n.jsx("button",{type:"button",onClick:c,"aria-label":"Close",className:"text-muted hover:text-text transition-colors p-1 bg-transparent border-0 cursor-pointer shrink-0",children:n.jsx(rn,{size:18})})]}),n.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:n.jsx("div",{className:"h-full animate-fadeIn",children:_==="decklist"&&e.mainboard?n.jsx(oae,{mainboard:e.mainboard,warmedImages:l}):$?n.jsx("div",{className:"h-full p-4 md:p-5",children:n.jsx("div",{className:"w-full h-full bg-surface2 animate-pulse"})}):H?n.jsx("div",{className:"h-full flex items-center justify-center px-5 text-center text-muted font-body",children:"Deck screenshot failed to load"}):F?m?n.jsxs("div",{className:"relative h-full",children:[D?n.jsx("div",{className:"h-full overflow-x-auto overflow-y-hidden themed-scrollbar",children:n.jsx("img",{src:F,alt:`${e.displayName} deck screenshot`,className:"block h-full w-auto max-w-none select-none",draggable:!1})}):n.jsx("div",{className:"h-full flex items-center justify-center overflow-hidden",children:n.jsx("img",{src:F,alt:`${e.displayName} deck screenshot`,className:"block max-h-full max-w-full w-auto h-auto select-none",draggable:!1})}),n.jsxs("button",{type:"button",onClick:()=>L(z=>!z),"aria-label":D?"Fit deck to screen":"Zoom deck",className:"absolute left-2 bottom-2 z-10 inline-flex items-center gap-1.5 rounded bg-bg/85 border border-border text-text px-2.5 py-1.5 font-display tracking-[0.14em] text-[11px] cursor-pointer backdrop-blur-sm",children:[D?n.jsx(jB,{size:13}):n.jsx(vB,{size:13}),D?"ZOOM OUT":"ZOOM IN"]})]}):n.jsx("div",{className:"h-full flex items-center justify-center overflow-hidden px-4 py-6",children:n.jsx("img",{src:F,alt:`${e.displayName} deck screenshot`,className:"block max-h-full max-w-full w-auto h-auto 
514select-none",draggable:!1})}):n.jsx("div",{className:"h-full flex items-center justify-center px-5 text-center text-muted font-body",children:"No deck screenshot available"})},v)}),a&&n.jsx("div",{className:"hidden lg:block border-t border-border shrink-0",children:n.jsxs("div",{className:"relative flex items-center justify-between gap-4 px-4 py-3 bg-surface hover:bg-green/5 transition-colors cursor-pointer",children:[n.jsxs("div",{className:"flex flex-1 items-center gap-3 min-w-0 pl-5",children:[e.deckScreenshotCaption&&n.jsx("span",{className:"text-muted text-[15px] font-body italic leading-snug min-w-0 truncate",children:e.deckScreenshotCaption}),g&&n.jsx(bN,{mainboard:e.mainboard,className:"relative z-10 ml-auto"})]}),n.jsxs(te,{to:a,className:j("flex items-center gap-4 shrink-0 no-underline","after:absolute after:inset-0 after:content-['']"),children:[n.jsx("span",{className:"text-muted text-[13px] font-body",children:Xre}),n.jsx(fP,{children:n.jsxs("span",{className:"inline-flex items-center gap-2",children:[n.jsx(gr,{size:30,className:"-my-[6px]"}),"VIEW BREAKDOWN",n.jsx(Jt,{size:14})]})})]})]})}),(e.deckScreenshotCaption||g)&&n.jsxs("div",{className:j("flex items-center gap-3 px-4 py-3 lg:pl-9 lg:pr-5 lg:py-4 border-t border-border shrink-0 bg-surface",a&&"lg:hidden"),children:[e.deckScreenshotCaption&&n.jsx("span",{className:"text-muted text-[15px] font-body italic leading-snug min-w-0",children:e.deckScreenshotCaption}),g&&n.jsx(bN,{mainboard:e.mainboard,className:"ml-auto"})]})]}),n.jsxs("div",{className:"flex-1 min-h-0 w-full max-w-[1400px] flex flex-col items-center justify-center gap-10 px-4 md:px-0",children:[U&&n.jsxs("div",{onClick:z=>z.stopPropagation(),className:j("shrink-0 flex items-center rounded-2xl bg-surface border border-border shadow-lg px-3 py-2 lg:px-4",A?"w-full lg:w-auto justify-between gap-2 lg:gap-4":"justify-center gap-2 lg:gap-3"),children:[d?n.jsx(vN,{side:"left",onClick:d,href:f}):A?n.jsx("span",{className:"w-10 shrink-0"}):null,n.jsxs("div",{className:"flex items-center gap-1.5",children:[P&&n.jsxs("a",{href:e.deckSourceUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-2 rounded-full border border-border bg-surface2 text-muted hover:text-text px-4 py-2.5 font-display tracking-[0.14em] no-underline transition-colors",style:{fontSize:14},children:[n.jsx(l6,{size:16}),"VIEW ON DISCORD"]}),T&&n.jsx(vg,{active:_==="screenshot",onClick:()=>C("screenshot"),icon:n.jsx(M1,{size:16}),children:"IMAGE"}),T&&n.jsxs(vg,{active:_==="decklist",onClick:()=>C("decklist"),icon:n.jsx(Gn,{size:17}),children:[n.jsx("span",{className:"lg:hidden",children:"POOL"}),n.jsx("span",{className:"hidden lg:inline",children:"CARD POOL"})]}),!o&&n.jsxs(vg,{disabled:!i,href:i??void 0,icon:n.jsx(cc,{size:16}),children:[n.jsx("span",{className:"lg:hidden",children:"LOG"}),n.jsx("span",{className:"hidden lg:inline",children:"DRAFT LOG"})]})]}),u?n.jsx(vN,{side:"right",onClick:u,href:h}):A?n.jsx("span",{className:"w-10 shrink-0"}):null]}),a&&n.jsxs(te,{to:a,onClick:z=>z.stopPropagation(),"aria-label":"View breakdown",className:"lg:hidden self-end inline-flex items-center gap-1.5 pr-1 text-green hover:text-green/80 no-underline font-display tracking-[0.18em] leading-none",style:{fontSize:13},children:["VIEW BREAKDOWN",n.jsx(Jt,{size:13})]})]})]}),document.body)}function bN({mainboard:e,className:t}){return n.jsx(ZP,{text:()=>eae(e),label:"COPY DECK",ariaLabel:"Copy deck to clipboard",className:t})}function eae(e){const t=["Deck",...e.cards.map(s=>yN(s,e.set))];return e.sideboard.length>0&&t.push("","Sideboard",...e.sideboard.map(s=>yN(s,e.set))),t.join(`
515`)}function yN(e,t){const s=e.set??t,r=`${e.count??1} ${e.name}`;return!s||!e.cn?r:`${r} (${s.toUpperCase()}) ${e.cn}`}function vN({side:e,onClick:t,href:s}){const r=e==="left"?Zy:rc,a=e==="left"?"Previous deck":"Next deck",o="shrink-0 inline-flex items-center justify-center w-10 h-10 rounded-full bg-surface2 border border-border text-muted hover:text-text hover:border-border2 transition-colors cursor-pointer outline-none focus:outline-none focus-visible:outline-none",i=n.jsx(r,{size:22,strokeWidth:2.25});return s?n.jsx(te,{to:s,replace:!0,onClick:nx(t),"aria-label":a,className:o,children:i}):n.jsx("button",{type:"button",onClick:l=>{l.stopPropagation(),t()},"aria-label":a,className:o,children:i})}function vg({active:e=!1,onClick:t,href:s,disabled:r=!1,icon:a,children:o}){const i=j("inline-flex items-center gap-1.5 rounded-full border px-3 py-2 lg:px-4 lg:py-2.5 font-display tracking-[0.14em] leading-none transition-colors","outline-none focus:outline-none focus-visible:outline-none",r?"bg-surface2 text-subtle border-border opacity-50 cursor-not-allowed":e?"bg-green/15 text-green border-green/50 cursor-pointer":"bg-surface2 text-muted border-border hover:text-text cursor-pointer"),l=n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"relative inline-flex items-center justify-center",children:[a,r&&n.jsx("span",{"aria-hidden":!0,
515className:"pointer-events-none absolute left-1/2 top-1/2 h-[1.5px] w-[150%] -translate-x-1/2 -translate-y-1/2 rotate-45 rounded-full bg-current"})]}),o]});return s&&!r?n.jsx(te,{to:s,className:j(i,"no-underline"),style:{fontSize:14},children:l}):n.jsx("button",{type:"button",role:"tab","aria-selected":e,disabled:r,onClick:t,className:i,style:{fontSize:14},children:l})}const JP=30,wN=28,tae=132,sae=220,nae=168;function jN(e){return e.flatMap(t=>Array.from({length:t.count??1},()=>({...t,count:1})))}const rae={W:0,U:1,B:2,R:3,G:4};function aae(e){return/land/i.test(e??"")}function kN(e){return e.length===0?7:e.length>1?5:rae[e[0]]??6}function wg(e,t){return kN(e.colors??[])-kN(t.colors??[])||e.name.localeCompare(t.name)}function oae({mainboard:e,warmedImages:t}){const[s,r]=p.useState(!0),a=p.useMemo(()=>t?[]:[...e.cards,...e.sideboard].map(f=>({name:f.name,set:f.set??e.set})),[e,t]),o=Mi(a),i=t??o,{mvPiles:l,lands:c,side:d}=p.useMemo(()=>{const f=[],h=new Map;for(const y of jN(e.cards)){if(aae(y.type)){f.push(y);continue}const b=y.cmc??0,w=h.get(b);w?w.push(y):h.set(b,[y])}return{mvPiles:[...h.entries()].sort((y,b)=>y[0]-b[0]).map(([y,b])=>({cmc:y,cards:b.slice().sort(wg)})),lands:f.slice().sort(wg),side:jN(e.sideboard).sort(wg)}},[e]),u=d.length>0;return n.jsx(rw,{value:i,children:n.jsxs("div",{className:"relative h-full flex min-h-0",children:[n.jsx("div",{className:"relative flex-1 min-w-0 overflow-auto themed-scrollbar px-4 md:px-5 py-5",children:n.jsxs("div",{className:"flex gap-2 md:gap-3 items-start",children:[l.map(f=>n.jsx(jg,{cards:f.cards,deckSet:e.set},f.cmc)),c.length>0&&n.jsx(jg,{cards:c,deckSet:e.set})]})}),u&&!s&&n.jsxs("button",{type:"button",onClick:()=>r(!0),className:"absolute top-3 right-3 z-10 inline-flex items-center gap-1.5 rounded-full border border-border bg-surface2 px-3 py-1.5 font-display tracking-[0.14em] text-subtle hover:text-text hover:border-green/50 transition-colors cursor-pointer",style:{fontSize:13},children:[n.jsx(Zy,{size:15}),"SIDEBOARD ",d.length]}),u&&s&&n.jsxs("aside",{className:"shrink-0 flex flex-col min-h-0 border-l border-border bg-surface/60",style:{width:nae},children:[n.jsxs("button",{type:"button",onClick:()=>r(!1),className:"flex items-center gap-2 px-3 py-2.5 border-b border-border font-display tracking-[0.16em] text-text hover:text-green transition-colors cursor-pointer",style:{fontSize:15},children:[n.jsx("span",{children:"SIDEBOARD"}),n.jsx("span",{className:"ml-auto tabular-nums",children:d.length}),n.jsx(rc,{size:18})]}),n.jsx("div",{className:"flex-1 overflow-auto themed-scrollbar px-3 py-3",children:n.jsx(jg,{cards:d,deckSet:e.set})})]})]})})}function jg({cards:e,deckSet:t}){return e.length===0?null:n.jsx("div",{className:"flex-1",style:{minWidth:tae,maxWidth:sae},children:n.jsx(ex,{count:e.length,reveal:JP,cardClassName:`w-full ${Xm}`,renderCard:s=>n.jsx(iae,{card:e[s],deckSet:t})})})}function iae({card:e,deckSet:t}){const s=NP(),r=e.set??t,a=p.useMemo(()=>vr(e.name,r,s),[e.name,r,s]),{src:o,onError:i}=$i(a),l=e.count??1;return n.jsxs(n.Fragment,{children:[o?n.jsx("img",{src:o,alt:e.name,loading:"lazy",onError:i,className:"block w-full h-auto",draggable:!1},o):s.ready?n.jsx("div",{className:"w-full aspect-[488/680] bg-surface2 flex items-start p-2",children:n.jsx("span",{className:"font-body text-subtle leading-tight",style:{fontSize:12},children:e.name})}):n.jsx("div",{className:"w-full aspect-[488/680] bg-surface2 animate-pulse"}),l>1&&n.jsx(lae,{n:l,onStrip:!1})]})}function lae({n:e,onStrip:t}){return n.jsxs("span",{className:"absolute right-1.5 inline-flex items-center justify-center bg-black/85 text-white font-display tabular-nums rounded px-2 leading-none",style:{fontSize:17,height:wN,top:t?(JP-wN)/2:6,letterSpacing:"0.04em"},children:["×",e]})}function zr({label:e,value:t,accent:s=!1,onClick:r,buttonRef:a}){const o="flex flex-col items-center text-center py-[7px] px-[6px] bg-surface border border-border min-w-0 overflow-hidden",i=n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"text-[10.5px] tracking-[0.16em] leading-none text-muted font-display whitespace-nowrap relative inline-block",children:[e,r&&n.jsx("span",{"aria-hidden":"true",className:"absolute top-1/2 -translate-y-1/2 ml-1 leading-none",style:{left:"100%"},children:n.jsx(Pv,{size:11,className:"text-muted"})})]}),n.jsx("span",{className:j("font-display tracking-[0.02em] text-[20px] leading-none mt-1 whitespace-nowrap tabular-nums",s?"text-green":"text-text"),children:t})]});return r?n.jsx("button",{type:"button",ref:a,onClick:r,className:j(o,"curs
515or-pointer hover:bg-surface2 transition-colors"),children:i}):n.jsx("div",{className:o,children:i})}const XP=["Mythic","Diamond","Platinum","Gold","Silver","Bronze"];function kg(e){return`${Math.round(e*100)}%`}const cae={Premier:"Premier Draft",Trad:"Traditional Draft",Sealed:"Sealed",Quick:"Quick Draft","LCQ Draft 1":"LCQ Draft 1","LCQ Draft 2":"LCQ Draft 2",Pod:"Pod Draft"};function dae(e){return cae[e]??e}function uae(e,t,s,r){const a=t.find(h=>h.formatLabel===e.label),o=(a==null?void 0:a.events)??0,i=(a==null?void 0:a.wins)??0,l=(a==null?void 0:a.losses)??0,c=(a==null?void 0:a.trophies)??0,d=s.get(e.label)??0;if(e.rule==="lcq_draft_2"){const h=i+l,m=h>0?i/h:0;return{label:e.label,played:h>0,events:o,wins:i,losses:l,count:i,points:e.points,weightedPoints:i*e.points,rate:m,isLcq:!0,isPod:!1,rankWeighted:!1,twoWins:0,oneWins:0,rankTerms:[],score:d}}const u=(a==null?void 0:a.weightedTrophies)||c,f=o>0?c/o:0;return{label:e.label,played:o>0,events:o,wins:i,losses:l,count:c,points:e.points,weightedPoints:Math.round(u*e.points*100)/100,rate:f,isLcq:!1,isPod:!1,rankWeighted:e.rankPoints!=null,twoWins:0,oneWins:0,rankTerms:fae(e,c,r),score:d}}function fae(e,t,s){if(!e.rankPoints||t===0||!s)return[];const r=[];let a=0;for(const i of XP){const l=s.get(i)??0;l>0&&(r.push({tier:i,points:e.rankPoints[i]??e.points,count:l}),a+=l)}if(r.length===0)return[];const o=t-a;return o>0&&r.push({tier:null,points:e.points,count:o}),r}function hae(e){const t=new Map;for(const s of e){const r=XP.find(i=>{var l;return i===((l=s.endRank)==null?void 0:l.split("-")[0])}),a=$7[s.format];if(!s.isTrophy||!r||!a)continue;const o=t.get(a)??new Map;o.set(r,(o.get(r)??0)+1),t.set(a,o)}return t}function pae(e){return{label:e.formatLabel,played:!0,events:e.events,wins:e.wins,losses:e.losses,count:e.trophies,points:0,weightedPoints:0,rate:0,isLcq:!1,isPod:!0,rankWeighted:!1,twoWins:e.twoWins??0,oneWins:e.oneWins??0,rankTerms:[],score:e.scoreContribution}}function mae(e,t,s){const r=e.filter(d=>d.formatLabel!=="Pod"),a=vo(Ay(r)),o=t??a.confidence,i=t!=null&&a.confidence>0?t/a.confidence:1,l=U3.map(d=>{const u=uae(d,r,a.contributionByLabel,s==null?void 0:s.get(d.label));return i!==1&&!u.isLcq&&(u.score*=i),u}).filter(d=>d.played),c=e.find(d=>d.formatLabel==="Pod");return c&&l.push(pae(c)),{rows:l,confidence:o}}const xae=540,Sg=8,gae=10;function SN({rows:e,confidence:t=0}){return n.jsx(n.Fragment,{children:e.map(s=>{const r=Ws[s.label]??Ti,a=s.isLcq,o=s.isPod?s.score>0:s.count>0;return n.jsxs("div",{className:"px-4 py-2 border-b border-border last:border-b-0 flex items-center gap-3",children:[n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1 min-w-0",children:[n.jsx("span",{className:"font-display tracking-[0.06em] truncate shrink-0",style:{color:r,fontSize:16,width:120},children:dae(s.label)}),n.jsxs("span",{className:"text-[12px] text-subtle tabular-nums whitespace-nowrap shrink-0 text-left",style:{width:78},children:[s.events," ",s.events===1?"event":"events"]}),n.jsx(ht,{mono:!0,wins:s.wins,losses:s.losses,className:"text-[12px] text-subtle tabular-nums whitespace-nowrap shrink-0 text-left",style:{width:62}}),s.rankTerms.length>0&&n.jsx("span",{className:"text-[12px] text-subtle tabular-nums flex flex-wrap items-center gap-x-3 gap-y-0.5 min-w-0",children:s.rankTerms.map(i=>n.jsx(bae,{term:i},i.tier??"unranked"))})]}),n.jsx("div",{className:"mt-1 text-[10.5px] text-subtle tabular-nums",children:s.isPod?n.jsxs(Ng,{children:[n.jsx(NN,{count:s.count}),n.jsx(xa,{}),n.jsx("span",{children:"5 pts"}),s.twoWins>0&&n.jsxs(n.Fragment,{children:[n.jsx(CN,{}),n.jsxs("span",{children:[s.twoWins," 2-win"]}),n.jsx(xa,{}),n.jsx("span",{children:"2 pts"})]}),s.oneWins>0&&n.jsxs(n.Fragment,{children:[n.jsx(CN,{}),n.jsxs("span",{children:[s.oneWins," 1-win"]}),n.jsx(xa,{}),n.jsx("span",{children:"½ pts"})]})]}):a?n.jsxs(Ng,{children:[n.jsxs("span",{className:"inline-flex items-center gap-0.5",children:[s.count,n.jsx("span",{className:"ml-0.5",children:"wins"})]}),o&&n.jsxs(n.Fragment,{children:[n.jsx(xa,{}
515),n.jsxs("span",{children:[kg(s.rate)," win rate"]})]}),n.jsx(xa,{}),n.jsxs("span",{children:[s.points," pts"]})]}):n.jsxs(Ng,{children:[n.jsx(NN,{count:s.count}),s.rankWeighted?n.jsxs("span",{children:["(",yae(s.weightedPoints)," pts)"]}):n.jsxs(n.Fragment,{children:[n.jsx(xa,{}),n.jsxs("span",{children:[s.points," pts"]})]}),o&&n.jsxs(n.Fragment,{children:[n.jsx(xa,{}),n.jsxs("span",{children:[kg(s.rate)," trophy rate"]})]}),o&&t>0&&n.jsxs(n.Fragment,{children:[n.jsx(xa,{}),n.jsxs("span",{children:[kg(t)," confidence"]})]})]})})]}),n.jsx("span",{className:"font-display text-text tabular-nums shrink-0 self-center leading-none text-[20px]",children:o?s.isPod?s.score.toFixed(0):s.score.toFixed(2):n.jsx("span",{className:"text-dim",children:"—"})})]},s.label)})})}function eO({open:e,onClose:t,breakdown:s,confidenceOverride:r,events:a,anchorRef:o}){const i=p.useRef(null),[l,c]=p.useState(null);if(p.useLayoutEffect(()=>{if(!e)return;const w=()=>{const x=o==null?void 0:o.current;if(!x)return;const g=x.getBoundingClientRect(),v=window.innerWidth,k=Math.min(xae,v-Sg*2),S=(g.left+g.right)/2,N=Math.min(v-Sg,g.right),C=Math.max(Sg,N-k),_=Math.max(16,Math.min(k-16,S-C));c({top:g.bottom+gae,left:C,width:k,notchLeft:_})};return w(),window.addEventListener("resize",w),window.addEventListener("scroll",w,!0),()=>{window.removeEventListener("resize",w),window.removeEventListener("scroll",w,!0)}},[e,o]),p.useEffect(()=>{if(!e)return;const w=g=>{g.key==="Escape"&&t()},x=g=>{var k,S;const v=g.target;v&&((k=o==null?void 0:o.current)!=null&&k.contains(v)||(S=i.current)!=null&&S.contains(v)||v instanceof Element&&v.closest("[data-popover-keep-open]")||t())};return window.addEventListener("keydown",w),document.addEventListener("mousedown",x),()=>{window.removeEventListener("keydown",w),document.removeEventListener("mousedown",x)}},[e,t,o]),!e||!l)return null;const d=a?hae(a):void 0,{rows:u,confidence:f}=mae(s,r,d),h=[...u].sort((w,x)=>x.score-w.score),m=h.filter(w=>!w.isPod),y=h.filter(w=>w.isPod),b=Math.round(u.reduce((w,x)=>w+x.score,0));return It.createPortal(n.jsxs("div",{ref:i,role:"dialog","aria-modal":"false","aria-label":"Points breakdown",style:{position:"fixed",top:l.top,left:l.left,width:l.width},className:"z-50 bg-surface border border-border2 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.7)] animate-fadeUpIn outline-none",children:[n.jsx("span",{"aria-hidden":"true",className:"absolute -top-[7px] w-[12px] h-[12px] rotate-45 bg-surface border-l border-t border-border2",style:{left:l.notchLeft-6}}),n.jsxs("header",{className:"flex items-center justify-between px-4 py-2.5 border-b border-border",children:[n.jsx("span",{className:"font-display text-text",style:{fontSize:18,lineHeight:1,letterSpacing:"0.06em",fontFamily:"'Bebas Neue', sans-serif",paddingTop:3},children:"POINTS BREAKDOWN"}),n.jsx("button",{type:"button",onClick:t,"aria-label":"Close",className:"text-muted hover:text-text transition-colors p-1 bg-transparent border-0 cursor-pointer shrink-0 -mr-1",children:n.jsx(rn,{size:15})})]}),n.jsx("div",{className:"pt-1",children:n.jsx(SN,{rows:m,confidence:f})}),y.length>0&&n.jsx("div",{className:"border-t border-border",children:n.jsx(SN,{rows:y})}),n.jsxs("footer",{className:"px-4 py-2.5 border-t border-border flex items-center justify-between gap-3",children:[n.jsx(H6,{size:14,label:"ABOUT POINTS"}),n.jsx("span",{className:"font-display text-green text-[22px] leading-none tabular-nums shrink-0",children:b})]})]}),document.body)}function Ng({children:e}){return n.jsx("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-0.5",children:e})}function NN({count:e}){return n.jsxs("span",{className:"inline-flex items-center gap-1",children:[e,n.jsx(ct,{size:11,color:"#ffc63a"})]})}function bae({term:e}){return n.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap",children:[e.count,e.tier?n.jsx(Tu,{endRank:e.tier==="Mythic"?"Mythic":`${e.tier}-1`,size:15,title:`${e.tier}, ${e.points} pts each`}):n.jsx(ct,{size:12,color:"#ffc63a"})]})}function yae(e){return String(Math.round(e*100)/100)}function xa(){return n.jsx("span",{className:"text-green text-[14px] leading-none align-middle",children:"×"})}function CN(){return n.jsx("span",{className:"text-green text-[16px] font-bold leading-none align-middle",children:"+"})}const vae="polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%)",Al="__lifetime__";function Ru({sets:e,activeCode:t,onChange:s,hrefFor:r,size:a="md",chamfer:o=!0,includeLifetime:i=!1}){const l=wt.useMemo(()=>{const v=[...e].sort((S,N)=>
515{const C=ii(S.code),_=ii(N.code);return C!==_?C?1:-1:N.startDate.localeCompare(S.startDate)}).map(S=>({value:S.code,label:S.name,section:ii(S.code)?"MTGO FLASHBACKS":void 0}));return[...i?[{value:Al,label:"Lifetime"}]:[],...v]},[e,i]),c=a==="sm",d=c?"text-[22px]":"text-[26px]",u=o?c?"pl-[14px]":"pl-[16px]":"pl-2",f=o?c?"pr-[18px]":"pr-[20px]":"pr-1.5",h=o?"gap-2":"gap-1.5",m=c?38:46,y=c?36:44,b=c?26:32,w=o?vae:void 0,x=t===Al,g=v=>v.value===Al?n.jsxs("span",{className:"flex w-full min-w-0 items-center gap-2.5",children:[n.jsx("span",{className:"flex items-center justify-center",style:{width:b,height:b},children:n.jsx(uo,{size:Math.round(b*.62)})}),n.jsx("span",{className:j(d,"leading-none"),children:"ALL"}),n.jsx("span",{className:"text-muted text-[13px] tracking-[0.06em] truncate",children:v.label})]}):n.jsxs("span",{className:"flex w-full min-w-0 items-center gap-2.5",children:[n.jsx(Ae,{code:v.value,size:b}),n.jsx("span",{className:j(d,"leading-none"),children:v.value}),n.jsx("span",{className:"text-muted text-[13px] tracking-[0.06em] truncate",children:v.label})]});return n.jsx(yt,{value:t,options:l,onChange:s,hrefFor:r,searchable:!0,searchPlaceholder:"Search sets or codes…",mobileCentered:!0,renderOption:g,renderTrigger:({open:v,toggle:k})=>n.jsx("button",{type:"button",onClick:k,className:"group block cursor-pointer transition-colors",style:{clipPath:w,background:"#3b4458",padding:1,minHeight:m},children:n.jsxs("span",{className:j("flex items-center font-display tracking-[0.06em] transition-colors h-full bg-surface text-text group-hover:bg-surface2",h,u,f),style:{clipPath:w,minHeight:y},children:[x?n.jsx("span",{className:"flex items-center justify-center",style:{width:b,height:b},children:n.jsx(uo,{size:Math.round(b*.62)})}):n.jsx(Ae,{code:t,size:b}),n.jsx("span",{className:j(d,"leading-none"),children:x?"ALL":t}),n.jsx(Et,{strokeWidth:2.5,className:j("text-muted transition-transform",c?"h-4 w-4":"h-[18px] w-[18px]",v&&"rotate-180")})]})})})}const tO="bg-transparent border-none font-display leading-none flex items-center transition-colors",_N="opacity-30 cursor-default pointer-events-none";function pc({to:e,onClick:t,label:s="BACK TO LEADERBOARD",compact:r=!1,inline:a=!1}){const o=j(tO,"text-muted cursor-pointer hover:text-text no-underline",r?"text-[12px] tracking-[0.15em] gap-1.5":"text-[14px] tracking-[0.18em] gap-1.5",!r&&!a&&"mb-3.5"),i=n.jsxs(n.Fragment,{children:[n.jsx(lo,{size:r?14:16,className:"shrink-0"}),r?"BACK":s]});return e?n.jsx(te,{to:e,className:o,children:i}):n.jsx("button",{type:"button",onClick:t,className:o,children:i})}function sO({prevTo:e,nextTo:t,prevLabel:s="PREV",nextLabel:r="NEXT",prevAriaLabel:a,nextAriaLabel:o,compact:i=!1}){const l=j(tO,"gap-1.5 text-muted",i?"text-[12px] tracking-[0.15em]":"text-[14px] tracking-[0.18em]","cursor-pointer hover:text-text no-underline"),c=i?14:16;return n.jsxs("div",{"data-popover-keep-open":!0,className:j("flex items-center",i?"gap-3":"gap-5"),children:[e?n.jsxs(te,{to:e,className:l,"aria-label":a??"Previous",children:[n.jsx(lo,{size:c,className:"shrink-0"})," ",s]}):n.jsxs("span",{className:j(l,_N),"aria-disabled":"true",children:[n.jsx(lo,{size:c,className:"shrink-0"})," ",s]}),t?n.jsxs(te,{to:t,className:l,"aria-label":o??"Next",children:[r," ",n.jsx(co,{size:c,className:"shrink-0"})]}):n.jsxs("span",{className:j(l,_N),"aria-disabled":"true",children:[r," ",n.jsx(co,{size:c,className:"shrink-0"})]})]})}function Bd({backTo:e,backOnClick:t,prevTo:s,nextTo:r,prevAriaLabel:a,nextAriaLabel:o}){return n.jsxs("header",{className:"py-3 px-[18px] border-b border-border grid grid-cols-3 items-center",children:[n.jsx(pc,{to:e,onClick:t,compact:!0,inline:!0}),n.jsx(te,{to:"/",className:"flex justify-center no-underline","aria-label":"Home",children:n.jsx("div",{className:"flex items-center overflow-visible",style:{height:14},children:n.jsx(yr,{size:22})})}),n.jsx("div",{className:"justify-self-end",children:n.jsx(sO,{prevTo:s,nextTo:r,prevAriaLabel:a,nextAriaLabel:o,compact:!0})})]})}const TN="polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%)",wae={sm:{fontSize:14,px:10,outer:26,inner:24},md:{fontSize:22,px:14,outer:38,inner:36},lg:{fontSize:26,px:18,outer:46,inner:44}};function nO({rank:e,size:t="md"}){const s=wae[t];return n.jsx("span",{className:"inline-block font-display tracking-[0.18em]",style:{clipPath:TN,background:"#2ee85c",padding:1,minHeight:s.outer},children:n.jsxs("span",{className:"flex items-center bg-surface text-green font-display tracking-[0.06em] leading-none h-full",style:{clipPath:TN,minHeight:s.inner,fontSize:s.fontSize,paddingLeft:s.px,paddingRight:s.px},children:["#",e]})})}const uw={W:"#f0f2c0",U:"#b5cde3",B:"#aca29a",R:"#db8664",G:"#93b483"},rO=["W","U","B","R","G"],aO={W:"White",U:"Blue",B:"Black",R:"Red",G:"Green"};function oO(e){const t=[];for(const s of e){const r=uw[s];r&&t.push(r)}return t.length>0?t:["#7a8395"]}function Cg(){var B;const e=cn(),t=e.slug.toLowerCase(),s=ln(),{data:r}=un(),a=p.useMemo(()=>sP(r),[r]),o=(B=r==null?void 0:r.find(D=>D.isActive))==null?void 0:B.code,i=!e.setCode,l=(e.setCode?K3(e.setCode,r):void 0)??o??_s,{data:c,isLoading:d,isFetching:u,error:f}=Ev(t,l,!i),{data:h,isFetching:m}=DR(t,l,!i),[y]=Rn(),b=y.get("format")??"ALL",w=y.get("colors")??"ALL",x=y.get("season")??"ALL",g=p.useMemo(()=>kae(x,r),[x,r]),v=ZZ(t,i),k=YZ(t,i,b,w,g==null?void 0:g.start,g==null?void 0:g.endExclusive),S=p.useMemo(()=>{var D;return(((D=k.data)==null?void 0:D.pages)??[]).flat()},[k.data]),N=i&&(b!=="ALL"||w!=="ALL")&&!!k.hasNextPage,C=QZ(t,N,b,w,g==null?void 0:g.start,g==null?void 0:g.endExclusive),{data:_}=JZ(t,!i&&!d&&!c),T=(u||m)&&!d,{data:E}=Tv(l),A=ut();p.useEffect(()=>{window.scrollTo(0,0)},[t,l,i]),p.useEffect(()=>{if(e.setCode&&l!==e.setCode){const D=new URLSearchParams(y);D.delete("season"),s({pathname:Gt(t,l),search:D.toString()},{replace:!0})}},[e.setCode,l,t,s,y]);const P=(E==null?void 0:E.findIndex(D=>D.slug===t))??-1;let M=null,U=null;E&&E.length>0&&(P===-1?(M=E[E.length-1].slug,U=E[0].slug):(M=P>0?E[P-1].slug:null,U=P<E.length-1?E[P+1].slug:null));const F={setCode:l,prevSlug:M,nextSlug:U},I=y.toString(),q=y.has("deck"),O=()=>{const D=new URLSearchParams(y);return D.delete("season"),D.toString()},H=D=>{const L=D===Al,$=e.trackerTab?`/${e.trackerTab}`:"";return{pathname:L?`/player/${t}`:`${Gt(t,D)}${$}`,search:L?I:O()}};return p.useEffect(()=>{const D=L=>{if(i||L.metaKey||L.ctrlKey||L.altKey||L.shiftKey||q)return;const $=L.target;$ instanceof HTMLElement&&($.tagName==="INPUT"||$.tagName==="TEXTAREA"||$.isContentEditable)||(L.key==="ArrowLeft"&&M?(L.preventDefault(),s({pathname:Gt(M,l),search:O()}
515)):L.key==="ArrowRight"&&U&&(L.preventDefault(),s({pathname:Gt(U,l),search:O()})))};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[M,U,l,s,I,q,i]),i?n.jsx(Nae,{profile:v.data??null,isLoading:v.isLoading,error:v.error,events:S,filteredStats:C.data??null,hasNextPage:!!k.hasNextPage,isFetchingNextPage:k.isFetchingNextPage,fetchNextPage:k.fetchNextPage,sets:a,isMobile:A,setHref:H,qs:O()}):f?n.jsxs("div",{className:"bg-bg text-text min-h-screen page-fade",children:[A?n.jsx(Vp,{sibling:F,qs:O()}):n.jsx(St,{subtitle:"PLAYER PROFILE"}),n.jsx(Uv,{error:f,compact:A})]}):d?n.jsxs("div",{className:"bg-bg text-text min-h-screen page-fade",children:[A?n.jsx(Vp,{sibling:F,qs:O()}):n.jsx(St,{subtitle:"PLAYER PROFILE"}),A?n.jsx(Rae,{}):n.jsx(Aae,{})]}):c?n.jsxs(n.Fragment,{children:[T&&n.jsx(Tae,{}),A?n.jsx(zae,{profile:c,events:h??[],sibling:F,sets:a,setHref:H}):n.jsx(Lae,{profile:c,events:h??[],sibling:F,sets:a,setHref:H})]}):n.jsx(Eae,{sets:a,setCode:l,setHref:H,sibling:F,qs:O(),isMobile:A,identity:_??null})}const fw="ALL";function jae(e){return!e.custom&&!!e.startDate&&!!e.endDate&&e.code!=="CUBE"&&!e.code.includes("-")}function kae(e,t){if(e===fw)return null;const s=t==null?void 0:t.find(a=>a.code===e);if(!s||!s.startDate||!s.endDate)return null;const r=new Date(`${s.endDate}T00:00:00Z`);return r.setUTCDate(r.getUTCDate()+1),{start:s.startDate,endExclusive:r.toISOString().slice(0,10)}}function Sae(e){const t=(e??[]).filter(jae).sort((s,r)=>r.startDate.localeCompare(s.startDate));return[{value:fw,label:"ALL SEASONS"},...t.map(s=>({value:s.code,label:`${s.code} SEASON`}))]}const dh=e=>e.value===fw?n.jsx("span",{children:e.label}):n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Ae,{code:e.value,size:14,className:"text-white/85 shrink-0"}),n.jsx("span",{children:e.label})]});function Nae({profile:e,isLoading:t,error:s,events:r,filteredStats:a,hasNextPage:o,isFetchingNextPage:i,fetchNextPage:l,sets:c,isMobile:d,setHref:u,qs:f}){const h={pathname:kn(),search:f},[m,y]=Rn(),[b,w]=p.useState("sets"),x=m.get("format")??"ALL",g=m.get("colors")??"ALL",v=m.get("season")??"ALL",k=(I,q)=>{y(O=>{const H=new URLSearchParams(O);return q==="ALL"?H.delete(I):H.set(I,q),H},{replace:!0})},S=p.useMemo(()=>Sae(c),[c]),N=p.useMemo(()=>[{value:"ALL",label:"ALL COLORS"},...lv.map(I=>({value:I,label:ys(I)})),{value:it,label:"3+ COLORS"}],[]);if(s)return n.jsxs("div",{className:"bg-bg text-text min-h-screen page-fade",children:[d?n.jsx(_g,{backTo:h}):n.jsx(St,{subtitle:"PLAYER PROFILE"}),n.jsx(Uv,{error:s,compact:d})]});if(t||!e)return n.jsxs("div",{className:"bg-bg text-text min-h-screen page-fade",children:[d?n.jsx(_g,{backTo:h}):n.jsx(St,{subtitle:"PLAYER PROFILE"}),t?d?n.jsx(Oae,{}):n.jsx(Pae,{}):n.jsx("div",{className:"p-20 text-center text-muted font-display tracking-[0.2em]",children:"PLAYER NOT FOUND"})]});const C=e.setsPlayed??[],_=v!=="ALL"?C.find(I=>I.setCode===v):void 0,T=x!=="ALL"||g!=="ALL",E=v!=="ALL"?_??{trophies:0,events:0,wins:0,losses:0}:e,A=a??hw(r),P=T?{trophies:A.trophies,events:A.events,wins:A.wins,losses:A.losses,score:0}:{trophies:E.trophies,events:E.events,wins:E.wins,losses:E.losses,score:0},M=Nc(P.wins,P.losses),U=e.selfReportedEvents.some(I=>I.isTrophy)?"17L TROPHIES":"TROPHIES",F=e.lastCalculatedAt?Cc(e.lastCalculatedAt):null;return d?n.jsxs("div",{className:"bg-bg text-text min-h-screen page-fade",children:[n.jsx(_g,{backTo:h}),n.jsxs("section",{className:"px-[18px] pt-5 pb-4 border-b border-border",style:{background:"linear-gradient(180deg, #14181f 0%, #0a0c10 100%)"},children:[n.jsxs("div",{className:"flex items-center",children:[n.jsx(as,{displayName:e.displayName,avatarUrl:e.avatarUrl,size:84,green:!0}),n.jsxs("div",{className:"flex-1 min-w-0 ml-3 relative flex items-center min-h-[84px]",children:[n.jsx("h1",{className:"font-display tracking-[0.03em] m-0 pl-[5px] line-clamp-2 break-words",style:{fontSize:"clamp(20px, 7vw, 44px)",lineHeight:.95},children:e.displayName.toUpperCase()}),n.jsx(qp,{trophies:e.selfReportedEvents,mobile:!0,className:"absolute bottom-0 left-0"})]}),c?n.jsx(Ru,{sets:c,activeCode:Al,hrefFor:u,size:"sm",chamfer:!1,includeLifetime:!0}):n.jsx("span",{className:"shrink-0 font-display text-[16px] tracking-[0.18em] text-muted",children:"ALL SETS"})]}),n.jsxs("div",{className:"mt-[18px] grid gap-[5px] grid-cols-4",children:[n.jsx(zr,{label:U,value:cO(P.trophies)}),n.jsx(zr,{label:"EVENTS",value:dO(P.events)}),n.jsx(zr,{label:"RECORD",value:uO(P.wins,P.losses)}),n.jsx(zr,{label:"WIN %",value:fO(P.wins,P.losses,M)})]})]}),n.jsxs("div",{className:"flex items-stretch border-b border-border bg-surface h-11",children:[n.jsx(Kp,{active:b==="sets",onClick:()=>w("sets"),className:"flex-1 justify-center",children:"SET HISTORY"}),n.jsx(Kp,{active:b==="events",onClick:()=>w("events"),className:"flex-1 justify-center",children:"EVENT LOG"})]}),b==="sets"?n.jsx(AN,{setsPlayed:C,sets:c,slug:e.slug,isMobile:!0}):n.jsx(PN,{events:r,hasNextPage:o,isFetchingNextPage:i,fetchNextPage:l,playerDisplayName:e.displayName,slug:e.slug,updated:F,formatFilter:x,setFormatFilter:I=>k("format",I),colorsFilter:g,setColorsFilter:I=>k("colors",I),colorOptions:N,seasonFilter:v,setSeasonFilter:I=>k("season",I),seasonOptions:S,isMobile:!0})]}):n.jsxs("div",{className:"bg-bg text-text min-h-screen page-fade",children:[n.jsx(St,{subtitle:"PLAYER PROFILE"}),n.jsxs("section",{className:"px-8 pt-5 pb-7 border-b border-border",style:{background:"linear-gradient(180deg, #14181f 0%, #0a0c10 100%)"},children:[n.jsx("div",{className:"flex items-center justify-between mb-4",children:n.jsx(pc,{to:h,inline:!0})}),n.jsxs("div",{className:"flex items-end gap-7",children:[n.jsx(as,{displayName:e.displayName,avatarUrl:e.avatarUrl,size:120,green:!0}),n.jsxs("div",{className:"shrink-0",children:[n.jsx("h1",{className:"font-display tracking-[0.03em] m-0 whitespace-nowrap pl-[5px]",style:{fontSize:"clamp(38px, 3.6vw, 64px)",lineHeight:.95},children:e.displayName.toUpperCase()}),n.jsx("div",{className:"mt-2 flex items-center gap-3 font-display tracking-[0.18em]",children:c?n.jsx(Ru,{sets:c,activeCode:Al,hrefFor:u,includeLifetime:!0}):n.jsx("span",{className:"text-muted text-[22px]",children:"ALL SETS"})})]}),n.jsxs("div",{className:"ml-auto flex items-stretch gap-4 min-w-0",children:[n.jsx(qp,{trophies:e.selfReportedEvents}),P.events>0&&n.jsx(xO,{stats:P,wp:M,showPoints:!1,trophiesLabel:U})]})]})]}),n.jsxs("div",{className:"grid",style:{gridTemplateColumns:C.length>0?"clamp(360px, 32vw, 460px) minmax(0, 1fr)":"minmax(0, 1fr)"},children:[C.length>0&&n.jsx(AN,{setsPlayed:C,sets:c,slug:e.slug}),n.jsx(PN,{events:r,hasNextPage:o,isFetchingNextPage:i,fetchNextPage:l,playerDisplayName:e.displayName,slug:e.slug,updated:F,formatFilter:x,setFormatFilter:I=>k("format",I),colorsFilter:g,setColorsFilter:I=>k("colors",I),colorOptions:N,seasonFilter:v,setSeasonFilter:I=>k("season",I),seasonOptions:S})]})]})}function _g({backTo:e}){return n.jsx(Bd,{backTo:e,prevTo:null,nextTo:null})}function Cae({text:e,max:t=15,min:s=9,className:r}){const a=p.useRef(null);return p.useLayoutEffect(()=>{var d;const o=a.current;if(!o)return;const i=()=>
515{if(o.style.fontSize=`${t}px`,o.clientWidth>0&&o.scrollWidth>o.clientWidth){const u=t*o.clientWidth/o.scrollWidth;o.style.fontSize=`${Math.max(s,Math.floor(u*10)/10)}px`}};i();const l=new ResizeObserver(i);l.observe(o);let c=!1;return(d=document.fonts)==null||d.ready.then(()=>{c||i()}),()=>{c=!0,l.disconnect()}},[e,t,s]),n.jsx("span",{ref:a,className:j("block min-w-0 flex-1 overflow-hidden whitespace-nowrap leading-none",r),children:e})}function EN(e){const t=e.wins+e.losses;return t>0?e.wins/t:0}const RN={"Alchemy Horizons: Baldur's Gate":"Baldur's Gate"};function _ae(e){return RN[e]?RN[e]:e.toLowerCase()==="peasant"?"Peasant Cube":e}function AN({setsPlayed:e,sets:t,slug:s,isMobile:r=!1}){const[a,o]=p.useState("release"),[i,l]=p.useState("desc"),c=p.useCallback(m=>{var y;return((y=t==null?void 0:t.find(b=>b.code===m))==null?void 0:y.name)??m},[t]),d=p.useCallback(m=>{var y;return((y=t==null?void 0:t.find(b=>b.code===m))==null?void 0:y.startDate)??""},[t]),u=p.useMemo(()=>{const m=[...e];return m.sort((y,b)=>{let w;return a==="release"?w=d(y.setCode).localeCompare(d(b.setCode)):a==="set"?w=c(y.setCode).localeCompare(c(b.setCode)):a==="trophies"?w=y.trophies-b.trophies:a==="events"?w=y.events-b.events:w=EN(y)-EN(b),i==="asc"?w:-w}),m},[e,a,i,c,d]);if(e.length===0)return null;const f=m=>{const y=m==="set"?"asc":"desc";if(m!==a){o(m),l(y);return}i===y?l(y==="asc"?"desc":"asc"):(o("release"),l("desc"))},h="minmax(0,1fr) 64px 52px 45px";return n.jsxs("section",{className:j(r?"pt-0 pb-5 px-[18px] border-b border-border":"pb-6 px-5 border-r border-border"),children:[n.jsxs("div",{className:"grid items-center h-[42px] gap-x-2 px-5 -mx-5 border-b border-border2",style:{gridTemplateColumns:h},children:[n.jsx(uh,{label:"SET NAME",active:a==="set",dir:i,onClick:()=>f("set"),align:"left",primary:!0}),n.jsx(uh,{label:"TROPHIES",active:a==="trophies",dir:i,onClick:()=>f("trophies"),align:"right"}),n.jsx(uh,{label:"EVENTS",active:a==="events",dir:i,onClick:()=>f("events"),align:"right"}),n.jsx(uh,{label:"WIN %",active:a==="winrate",dir:i,onClick:()=>f("winrate"),align:"right"})]}),n.jsx("div",{className:"flex flex-col",children:u.map(m=>n.jsxs(te,{to:Gt(s,m.setCode),className:"grid items-center gap-x-2 min-h-[44px] px-2 -mx-2 no-underline text-inherit border-b border-border transition-colors hover:bg-surface2",style:{gridTemplateColumns:h},children:[n.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[n.jsx(Ae,{code:m.setCode,size:22,className:"text-white/85 shrink-0"}),n.jsxs("span",{className:"flex items-baseline gap-2 min-w-0 flex-1",children:[n.jsx("span",{className:"font-display text-[18px] leading-none tracking-[0.04em] shrink-0",children:m.setCode}),n.jsx(Cae,{text:_ae(c(m.setCode)),className:"font-display text-muted tracking-[0.03em]",max:12,min:9})]})]}),m.trophies>0?n.jsx(Co,{count:m.trophies,size:"md",display:!0,fixedDigits:2,className:"text-subtle justify-self-end"}):n.jsx("span",{className:"font-display text-[17px] text-dim leading-none justify-self-end",children:"—"}),n.jsx("span",{className:"font-display text-[17px] text-right text-subtle",children:m.events}),n.jsxs("span",{className:"font-display text-[17px] text-right text-subtle",children:[Nc(m.wins,m.losses),"%"]})]},m.setCode))})]})}function uh({label:e,active:t,dir:s,onClick:r,align:a,primary:o=!1}){const i=s==="asc"?n6:Et;return n.jsx("button",{type:"button",onClick:r,"aria-sort":t?s==="asc"?"ascending":"descending":"none",className:j("flex items-center w-full h-full bg-transparent border-0 cursor-pointer font-display tracking-[0.2em] transition-colors whitespace-nowrap",o?"text-[14px]":"text-[12px]",a==="right"?"justify-end":"justify-start",t?"text-text":"text-muted hover:text-text"),children:n.jsxs("span",{className:"relative",children:[e,t&&n.jsx(i,{size:12,strokeWidth:2.5,className:"absolute left-full top-1/2 -translate-y-1/2 ml-[-2px]"})]})})}function PN({events:e,hasNextPage:t,isFetchingNextPage:s,fetchNextPage:r,playerDisplayName:a,slug:o,updated:i,formatFilter:l,setFormatFilter:c,colorsFilter:d,setColorsFilter:u,colorOptions:f,seasonFilter:h,setSeasonFilter:m,seasonOptions:y,isMobile:b=!1}){const w=ut(1240),x=Bc("ALL"),g=p.useRef(null);p.useEffect(()=>{const N=g.current;if(!N||!t)return;const C=new IntersectionObserver(_=>{var T;(T=_[0])!=null&&T.isIntersecting&&t&&!s&&r()},{rootMargin:"600px"});return C.observe(N),()=>C.disconnect()},[t,s,r]);const v=`${e.length}${t?"+":""} EVENTS`,k=t&&n.jsx("div",{ref:g,className:"col-span-full flex justify-center py-6",children:n.jsx("button",{type:"button",onClick:()=>r(),disabled:s,className:"font-display text-[13px] tracking-[0.18em] text-muted hover:text-text transition-colors bg-transparent border border-border2 px-4 py-2 cursor-pointer disabled:opacity-50",children:s?"LOADING…":"LOAD MORE"})}),S=e.length===0&&n.jsx("div",{className:"p-6 text-center text-muted font-display tracking-[0.2em] col-span-full",children:l==="ALL"&&d==="ALL"&&h==="ALL"?"NO EVENTS RECORDED":"NO EVENTS MATCH FILTER"});return b?n.jsxs("section",{className:"pt-2 pb-4 px-[18px]",children:[n.jsxs("div",{className:"flex items-baseline justify-between gap-2.5 mb-2",children:[n.jsxs("div",{className:"flex items-baseline gap-2.5",children:[n.jsx(Xe,{size:14,children:"EVENT LOG"}),e.length>0&&n.jsx("span",{className:"font-display text-[13px] tracking-[0.14em] text-subtle whitespace-nowrap",children:v})]}),i&&n.jsxs("span",{className:"font-display text-[13px] tracking-[0.14em] text-muted shrink-0 whitespace-nowrap",children:["UPDATED ",i]})]}),n.jsxs("div",{className:"mb-2 grid grid-cols-3 gap-2",children:[n.jsx(yt,{value:h,onChange:m,hrefFor:N=>x("season",N),options:y,renderValue:dh,renderOption:dh,className:"w-full min-w-0",triggerClassName:"w-full min-w-0"}
515),n.jsx(yt,{value:l,onChange:c,hrefFor:N=>x("format",N),options:Tn,renderValue:Ss,renderOption:Ss,className:"w-full min-w-0",triggerClassName:"w-full min-w-0"}),n.jsx(yt,{value:d,onChange:u,hrefFor:N=>x("colors",N),options:f,align:"right",renderValue:hr,renderOption:hr,className:"w-full min-w-0",triggerClassName:"w-full min-w-0"})]}),n.jsx("div",{className:"flex flex-col border-t border-border2 -mx-[18px] px-[18px]",children:e.map(N=>n.jsx(Zp,{event:N,variant:"mobile",playerDisplayName:a,setColumn:!0,setHref:Gt(o,N.setCode)},N.eventId))}),S,k]}):n.jsxs("section",{className:"pb-6 px-5 min-w-0",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3 h-[42px] px-5 -mx-5 border-b border-border2",children:[n.jsxs("div",{className:"flex items-baseline gap-2.5 shrink-0",children:[n.jsx(Xe,{size:14,children:"EVENT LOG"}),e.length>0&&n.jsx("span",{className:"font-display text-[13px] tracking-[0.14em] text-subtle whitespace-nowrap",children:v})]}),n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i&&n.jsxs("span",{className:"font-display text-[13px] tracking-[0.14em] text-muted shrink-0 whitespace-nowrap mr-1",children:["UPDATED ",i]}),n.jsx(yt,{value:h,onChange:m,hrefFor:N=>x("season",N),options:y,renderValue:dh,renderOption:dh,className:"min-w-0 max-w-[200px]",triggerClassName:"min-w-0"}),n.jsx(yt,{value:l,onChange:c,hrefFor:N=>x("format",N),options:Tn,renderValue:Ss,renderOption:Ss,className:"min-w-0 max-w-[200px]",triggerClassName:"min-w-0"}),n.jsx(yt,{value:d,onChange:u,hrefFor:N=>x("colors",N),options:f,align:"right",renderValue:hr,renderOption:hr,className:"min-w-0 max-w-[200px]",triggerClassName:"min-w-0"})]})]}),n.jsxs("div",{className:"grid gap-x-2 items-stretch",style:{gridTemplateColumns:"40px 22px 70px max-content 1fr 24px auto"},children:[e.map(N=>n.jsx(Zp,{event:N,variant:"desktop",playerDisplayName:a,setColumn:!0,setHref:Gt(o,N.setCode),compact:w},N.eventId)),S,k]})]})}function Tae(){return n.jsx("div",{"aria-hidden":"true",className:"fixed top-0 left-0 right-0 h-[2px] z-[60] overflow-hidden pointer-events-none bg-border/30",children:n.jsx("div",{className:"h-full w-1/3 bg-green animate-loadingBar"})})}function iO(){const[e,t]=Rn(),s=e.get("format")??"ALL",r=e.get("colors")??"ALL",a=(i,l)=>{t(c=>{const d=new URLSearchParams(c);return l==="ALL"?d.delete(i):d.set(i,l),d},{replace:!0})},o=new URLSearchParams(e);return o.delete("season"),[s,i=>a("format",i),r,i=>a("colors",i),o.toString()]}function lO(e){const[t,s]=Rn(),r=Rt(),a=t.get("deck"),o=p.useMemo(()=>a?e.find(u=>u.sourceMessageId===a)??null:null,[a,e]),i=u=>{const f=new URLSearchParams(t);return u?f.set("deck",u):f.delete("deck"),f.toString()},l=u=>`${r.pathname}?${i(u.sourceMessageId)}`,c=u=>s(i(u.sourceMessageId),{replace:!0,state:r.state}),d=Ju({pathname:r.pathname,search:i(null)});return{shotTrophy:o,trophyHref:l,selectTrophy:c,closeTrophy:d}}function Vp({sibling:e,qs:t=""}){const s=r=>r?{pathname:Gt(r,e.setCode),search:t}:null;return n.jsx(Bd,{backTo:{pathname:kn(e.setCode),search:t},prevTo:s(e.prevSlug),nextTo:s(e.nextSlug),prevAriaLabel:"Previous player",nextAriaLabel:"Next player"})}function Eae({sets:e,setCode:t,setHref:s,sibling:r,qs:a,isMobile:o,identity:i}){const l=e?n.jsx(Ru,{sets:e,activeCode:t,hrefFor:s,size:o?"sm":"md",chamfer:!o,includeLifetime:!0}):n.jsx("span",{className:"text-[22px]",children:t});return n.jsxs("div",{className:"bg-bg text-text min-h-screen page-fade",children:[o?n.jsx(Vp,{sibling:r,qs:a}):n.jsx(St,{subtitle:"PLAYER PROFILE"}),n.jsxs("section",{className:j("border-b border-border",o?"px-[18px] pt-4 pb-8":"px-8 pt-5 pb-7"),style:{background:"linear-gradient(180deg, #14181f 0%, #0a0c10 100%)"},children:[!o&&n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx(pc,{to:{pathname:kn(t),search:a},inline:!0}),n.jsx(wO,{sibling:r,qs:a})]}),o?n.jsxs("div",{className:"flex items-center justify-between gap-4",children:[n.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[i&&n.jsx(as,{displayName:i.displayName,avatarUrl:i.avatarUrl,size:84,green:!0}),i&&n.jsx("h1",{className:"font-display tracking-[0.03em] m-0 truncate pl-[5px]",style:{fontSize:"clamp(20px, 7vw, 44px)",lineHeight:.95},children:i.displayName.toUpperCase()})]}),n.jsx("div",{className:"shrink-0 flex items-center gap-3 font-display tracking-[0.18em]",children:l})]}):n.jsxs("div",{className:"flex items-end gap-7",children:[i&&n.jsx(as,{displayName:i.displayName,avatarUrl:i.avatarUrl,size:120,green:!0}),n.jsxs("div",{className:"shrink-0",children:[i&&n.jsx("h1",{className:"font-display tracking-[0.03em] m-0 whitespace-nowrap pl-[5px]",style:{fontSize:64,lineHeight:.95},children:i.displayName.toUpperCase()}),n.jsx("div",{className:j("flex items-center gap-3 font-display tracking-[0.18em]",i&&"mt-2"),children:l})]})]})]}),n.jsxs("div",{className:"p-20 text-center text-muted font-display tracking-[0.2em]",children:["NO ",t," EVENTS RECORDED"]})]})}function be({className:e}){return n.jsx("div",{className:j("bg-surface2 animate-pulse",e)})}function Rae(){return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"px-[18px] pt-5 pb-4 border-b border-border",style:{background:"linear-gradient(180deg, #14181f 0%, #0a0c10 100%)"},children:[n.jsxs("div",{className:"flex items-center",children:[n.jsx(be,{className:"w-[84px] h-[84px] rounded-full shrink-0"}),n.jsx("div",{className:"flex-1 min-w-0 ml-3 flex items-center min-h-[84px]",children:n.jsx(be,{className:"w-40 h-9"})}),n.jsxs("div",{className:"flex flex-col items-end gap-1.5 shrink-0",children:[n.jsx(be,{className:"w-[51px] h-[38px]"}),n.jsx(be,{className:"w-[92px] h-[38px]"})]})]}
515),n.jsx("div",{className:"mt-[18px] grid grid-cols-5 gap-[5px]",children:[0,1,2,3,4].map(e=>n.jsx(be,{className:"h-12"},e))})]}),n.jsxs("section",{className:"border-b border-border",children:[n.jsx("div",{className:"flex border-b border-border",children:[0,1,2].map(e=>n.jsx("div",{className:"flex-1 py-2.5 px-1.5 flex justify-center",children:n.jsx(be,{className:"w-3/4 h-3"})},e))}),n.jsxs("div",{className:"px-[18px] py-4 flex items-center gap-3.5",children:[n.jsx(be,{className:"w-[108px] h-[108px] rounded-full"}),n.jsx("div",{className:"flex-1 flex flex-col gap-1.5",children:[0,1,2,3,4].map(e=>n.jsx(be,{className:"h-5"},e))})]})]}),n.jsxs("section",{className:"py-4 px-[18px]",children:[n.jsx(be,{className:"w-32 h-3 mb-3"}),[0,1,2,3,4,5].map(e=>n.jsxs("div",{className:"grid gap-2.5 py-2.5 border-b border-border items-center",style:{gridTemplateColumns:"20px 1fr auto"},children:[n.jsx(be,{className:"w-4 h-4"}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx(be,{className:"w-28 h-3"}),n.jsx(be,{className:"w-20 h-2"})]}),n.jsx(be,{className:"w-10 h-3.5"})]},e))]})]})}function Aae(){return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"px-8 pt-5 pb-7 border-b border-border",style:{background:"linear-gradient(180deg, #14181f 0%, #0a0c10 100%)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx(be,{className:"w-48 h-5"}),n.jsx(be,{className:"w-28 h-5"})]}),n.jsxs("div",{className:"flex items-end gap-7",children:[n.jsx(be,{className:"w-[120px] h-[120px] rounded-full"}),n.jsxs("div",{className:"shrink-0 flex flex-col gap-3",children:[n.jsx(be,{className:"w-72 h-12"}),n.jsx(be,{className:"w-44 h-9"})]}),n.jsx("div",{className:"ml-auto self-end grid border border-border2",style:{flex:"0 1 601px",height:"106px",gridTemplateColumns:"1fr 1fr 1.3fr 1fr 0.9fr"},children:[0,1,2,3,4].map(e=>n.jsxs("div",{className:j("px-3 flex flex-col items-center justify-center gap-3",e<4&&"border-r border-border2"),children:[n.jsx(be,{className:"w-12 h-2.5"}),n.jsx(be,{className:"w-16 h-10"})]},e))})]})]}),n.jsxs("div",{className:"grid",style:{gridTemplateColumns:"clamp(360px, 32vw, 460px) minmax(0, 1fr)"},children:[n.jsx("section",{className:"py-5 pr-8 pl-6 min-[1360px]:pl-10 border-r border-border",children:[0,1,2].map(e=>n.jsxs("div",{className:e>0?"mt-6":void 0,children:[n.jsx("div",{className:"flex justify-center mb-3.5",style:{width:148},children:n.jsx(be,{className:"w-28 h-4"})}),n.jsxs("div",{className:"flex items-center gap-5",children:[n.jsx(be,{className:"w-[148px] h-[148px] rounded-full shrink-0"}),n.jsx("div",{className:"flex-1 flex flex-col gap-2",children:[0,1,2,3,4].map(t=>n.jsx(be,{className:"h-5"},t))})]})]},e))}),n.jsxs("section",{className:"pb-6 px-5 min-w-0",children:[n.jsxs("div",{className:"h-[42px] flex items-center justify-between px-5 -mx-5 border-b border-border2",children:[n.jsx(be,{className:"w-40 h-3"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(be,{className:"w-36 h-8"}),n.jsx(be,{className:"w-36 h-8"})]})]}),Array.from({length:13}).map((e,t)=>n.jsxs("div",{className:"grid items-center gap-x-2 min-h-[44px] px-2 -mx-2 border-b border-border",style:{gridTemplateColumns:"22px 70px max-content 1fr 24px auto"},children:[n.jsx("span",{}),n.jsx(be,{className:"w-12 h-3"}),n.jsx(be,{className:"w-24 h-3.5"}),n.jsx(be,{className:"w-16 h-3"}),n.jsx("span",{}),n.jsx(be,{className:"w-10 h-4 justify-self-end"})]},t))]})]})]})}function Pae(){return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"px-8 pt-5 pb-7 border-b border-border",style:{background:"linear-gradient(180deg, #14181f 0%, #0a0c10 100%)"},children:[n.jsx("div",{className:"mb-4",children:n.jsx(be,{className:"w-48 h-5"})}),n.jsxs("div",{className:"flex items-end gap-7",children:[n.jsx(be,{className:"w-[120px] h-[120px] rounded-full"}),n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx(be,{className:"w-72 h-12"}),n.jsx(be,{className:"w-40 h-9"})]}),n.jsx("div",{className:"ml-auto self-end grid border border-border2",style:{flex:"0 1 596px",height:"106px",gridTemplateColumns:"1fr 1fr 1.3fr 1fr"}
515,children:[0,1,2,3].map(e=>n.jsxs("div",{className:j("px-3 flex flex-col items-center justify-center gap-3",e<3&&"border-r border-border2"),children:[n.jsx(be,{className:"w-12 h-2.5"}),n.jsx(be,{className:"w-16 h-10"})]},e))})]})]}),n.jsxs("div",{className:"grid",style:{gridTemplateColumns:"clamp(360px, 32vw, 460px) minmax(0, 1fr)"},children:[n.jsxs("section",{className:"pb-6 px-5 border-r border-border",children:[n.jsx("div",{className:"h-[42px] flex items-center px-5 -mx-5 border-b border-border2",children:n.jsx(be,{className:"w-20 h-3"})}),Array.from({length:13}).map((e,t)=>n.jsxs("div",{className:"grid items-center gap-x-2 min-h-[44px] px-2 -mx-2 border-b border-border",style:{gridTemplateColumns:"minmax(0,1fr) 64px 52px 45px"},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(be,{className:"w-[22px] h-[22px] rounded-full"}),n.jsx(be,{className:"w-28 h-3"})]}),n.jsx(be,{className:"w-8 h-3 justify-self-end"}),n.jsx(be,{className:"w-6 h-3 justify-self-end"}),n.jsx(be,{className:"w-9 h-3 justify-self-end"})]},t))]}),n.jsxs("section",{className:"pb-6 px-5 min-w-0",children:[n.jsxs("div",{className:"h-[42px] flex items-center justify-between px-5 -mx-5 border-b border-border2",children:[n.jsx(be,{className:"w-40 h-3"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(be,{className:"w-36 h-8"}),n.jsx(be,{className:"w-36 h-8"})]})]}),Array.from({length:13}).map((e,t)=>n.jsxs("div",{className:"grid items-center gap-x-2 min-h-[44px] px-2 -mx-2 border-b border-border",style:{gridTemplateColumns:"40px 22px 70px max-content 1fr 24px auto"},children:[n.jsx(be,{className:"w-[18px] h-[18px] mx-auto"}),n.jsx("span",{}),n.jsx(be,{className:"w-12 h-3"}),n.jsx(be,{className:"w-24 h-3.5"}),n.jsx(be,{className:"w-16 h-3"}),n.jsx("span",{}),n.jsx(be,{className:"w-10 h-4 justify-self-end"})]},t))]})]})]})}function Oae(){return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"px-[18px] pt-5 pb-4 border-b border-border",style:{background:"linear-gradient(180deg, #14181f 0%, #0a0c10 100%)"},children:[n.jsxs("div",{className:"flex items-center",children:[n.jsx(be,{className:"w-[84px] h-[84px] rounded-full shrink-0"}),n.jsx("div",{className:"flex-1 min-w-0 ml-3 flex items-center min-h-[84px]",children:n.jsx(be,{className:"w-40 h-9"})}),n.jsx(be,{className:"w-[92px] h-[38px] shrink-0"})]}),n.jsx("div",{className:"mt-[18px] grid grid-cols-4 gap-[5px]",children:[0,1,2,3].map(e=>n.jsx(be,{className:"h-12"},e))})]}),n.jsx("div",{className:"flex items-stretch border-b border-border bg-surface h-11",children:[0,1].map(e=>n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsx(be,{className:"w-24 h-3"})},e))}),n.jsxs("section",{className:"pt-0 pb-5 px-[18px]",children:[n.jsxs("div",{className:"grid items-center h-[42px] gap-x-2 px-5 -mx-5 border-b border-border2",style:{gridTemplateColumns:"minmax(0,1fr) 64px 52px 45px"},children:[n.jsx(be,{className:"w-20 h-3"}),n.jsx(be,{className:"w-12 h-3 justify-self-end"}),n.jsx(be,{className:"w-10 h-3 justify-self-end"}),n.jsx(be,{className:"w-9 h-3 justify-self-end"})]}),Array.from({length:11}).map((e,t)=>n.jsxs("div",{className:"grid items-center gap-x-2 min-h-[44px] px-2 -mx-2 border-b border-border",style:{gridTemplateColumns:"minmax(0,1fr) 64px 52px 45px"},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(be,{className:"w-[22px] h-[22px] rounded-full"}),n.jsx(be,{className:"w-24 h-3"})]}),n.jsx(be,{className:"w-7 h-3 justify-self-end"}),n.jsx(be,{className:"w-5 h-3 justify-self-end"}),n.jsx(be,{className:"w-8 h-3 justify-self-end"})]},t))]})]})}function hw(e){let t=0,s=0,r=0,a=0;const o=[];for(const i of e)i.format.startsWith("MidWeek")||(i.isTrophy&&(t+=1),s+=i.wins,r+=i.losses,a+=1,o.push({format:i.format,wins:i.wins,losses:i.losses,trophies:i.isTrophy?1:0,events:1}));return{trophies:t,events:a,wins:s,losses:r,score:z3(o)}}const rx=n.jsx("span",{className:"text-dim",children:"—"}),cO=e=>e>0?n.jsxs("span",{className:"flex items-center gap-[3px]",children:[n.jsx(ct,{size:12,color:"#ffc63a"}),e]}):rx,dO=e=>e>0?e:rx,uO=(e,t)=>e+t>0?`${e}–${t}`:rx,fO=(e,t,s)=>e+t>0?`${s}%`:rx;function pw(e,t=[]){const s={W:0,U:0,B:0,R:0,G:0},r={},a={};for(const o of[...e,...t]){const i=wo(o.colors);for(const c of i)c in s&&s[c]++;const l=Bt(o.colors);l.length!==0&&(r[l]=(r[l]??0)+1,o.isTrophy&&(a[l]=(a[l]??0)+1))}return{colorCount:s,comboCount:r,comboTrophies:a}}function Lae({profile:e,events:t,sibling:s,sets:r,setHref:a}){var Z;const[o,i,l,c,d]=iO(),{chips:u,otherCombos:f}=Rv(e.setCode),h=ds(e.setCode),m=p.useMemo(()=>{const Y=[{value:"ALL",label:"ALL COLORS"}];for(const ae of u)ae===it?Y.push({value:it,label:"SOUP"}):ae===kt?Y.push({value:kt,label:"OTHER"}):Y.push({value:ae,label:ys(ae)});return Y},[u]),{data:y}=Wm(e.setCode),b=p.useMemo(()=>{const Y=new Set(y??[]),ae=y?Tn.filter(ye=>
515ye.value==="ALL"?!0:(bi[ye.value]??[ye.value]).some(Fe=>Y.has(Fe))):Tn,pe=Array.from(new Set(e.selfReportedEvents.map(ye=>ye.platform)));return[...ae,...pe.map(ye=>({value:ye,label:ye.toUpperCase()}))]},[y,e.selfReportedEvents]),w=p.useMemo(()=>new Set(f),[f]),x=p.useCallback((Y,ae)=>{if(o!=="ALL"&&!Xa(ae,o))return!1;if(l!=="ALL"){if(l===it){if(!Cs(Y,h))return!1}else if(l===kt){if(Cs(Y,h)||!w.has(Bt(Y)))return!1}else if(Bt(Y)!==l)return!1}return!0},[o,l,w,h]),g=p.useMemo(()=>t.filter(Y=>x(Y.colors,Y.format)),[t,x]),v=p.useMemo(()=>pO(g,e,x),[g,e,x]),{shotTrophy:k,trophyHref:S,selectTrophy:N,closeTrophy:C}=lO(e.selfReportedEvents),_=o!=="ALL"||l!=="ALL",T=p.useMemo(()=>{if(o==="ALL")return e.formatBreakdown;const Y=new Set(bi[o]??[o]);return e.formatBreakdown.filter(ae=>Y.has(ae.formatLabel))},[e.formatBreakdown,o]),E=p.useMemo(()=>vo(e.formatBreakdown.filter(Y=>Y.formatLabel!=="Pod").map(Y=>({label:Y.formatLabel,events:Y.events,wins:Y.wins,losses:Y.losses,trophies:Y.trophies}))).confidence,[e.formatBreakdown]),A=o==="ALL"?e.score:Math.round(T.reduce((Y,ae)=>Y+ae.scoreContribution,0)*100)/100,P=o!=="ALL"&&T.length>0?T.map(Y=>Y.formatLabel):null,M=p.useMemo(()=>{if(!_)return{trophies:e.trophies,events:e.events,wins:e.wins,losses:e.losses,score:e.score};const Y=hw(g),ae=v.length-g.length;return{trophies:Y.trophies+ae,events:Y.events,wins:Y.wins,losses:Y.losses,score:A}},[_,g,v,A,e.trophies,e.events,e.wins,e.losses,e.score]),U=Nc(M.wins,M.losses),F=e.rank>0,I=e.events>0||e.selfReportedEvents.length>0,q=hO(e.slug),{trackerTab:O}=cn(),H=O==="breakdown"?"breakdown":"collection",{search:B}=Rt(),D=Gt(e.slug,e.setCode),L=Y=>({pathname:`${D}/${Y}`,search:B}),{accounts:$,accountId:V,setAccountId:z}=KP(q),[K,W]=p.useState(!1),J=p.useRef(null);return n.jsxs("div",{className:"bg-bg text-text min-h-screen page-fade",children:[n.jsx(St,{subtitle:"PLAYER PROFILE"}),n.jsxs("section",{className:"px-8 pt-5 pb-7 border-b border-border",style:{background:"linear-gradient(180deg, #14181f 0%, #0a0c10 100%)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx(pc,{to:{pathname:kn(e.setCode),search:d},inline:!0}),n.jsx(wO,{sibling:s,qs:d})]}),n.jsxs("div",{className:"flex items-end gap-7",children:[n.jsx(as,{displayName:e.displayName,avatarUrl:e.avatarUrl,size:120,green:!0}),n.jsxs("div",{className:"shrink-0",children:[n.jsx("h1",{className:"font-display tracking-[0.03em] m-0 whitespace-nowrap pl-[5px]",style:{fontSize:"clamp(38px, 3.6vw, 64px)",lineHeight:.95},children:e.displayName.toUpperCase()}),n.jsxs("div",{className:"mt-2 flex items-center gap-3 font-display tracking-[0.18em]",children:[r?n.jsx(Ru,{sets:r,activeCode:e.setCode,hrefFor:a,includeLifetime:!0}):n.jsx("span",{className:"text-[22px]",children:e.setCode}),F&&n.jsx(nO,{rank:e.rank,size:"lg"})]})]}),n.jsxs("div",{className:"ml-auto flex items-stretch gap-4 min-w-0",children:[q&&n.jsx(GP,{slug:e.slug,setCode:e.setCode,accountId:V}),n.jsx(qp,{trophies:e.selfReportedEvents}),e.events>0&&n.jsx(xO,{stats:M,wp:U,showPoints:F,onPointsClick:()=>W(Y=>!Y),pointsBtnRef:J,trophiesLabel:e.selfReportedEvents.some(Y=>Y.isTrophy)?"17L TROPHIES":"TROPHIES"})]})]})]}),n.jsxs("div",{className:j("grid",q&&"grid-cols-1 min-[1128px]:grid-cols-[480px_minmax(0,1fr)]"),style:q?void 0:{gridTemplateColumns:I?"clamp(360px, 32vw, 460px) minmax(0, 1fr)":"minmax(0, 1fr)"},children:[q?n.jsxs("div",{className:"border-b border-border min-[1128px]:border-b-0 min-[1128px]:border-r",children:[n.jsxs("div",{className:j("flex items-center gap-2 border-b border-border bg-surface pl-8 pr-4",$P),children:[n.jsx(Kp,{active:H==="breakdown",to:L("breakdown"),children:"BREAKDOWN"}),n.jsx(Kp,{active:H==="collection",to:L("collection"),children:"COLLECTION"}),n.jsx(qP,{accounts:$,active:V,onChange:z,className:"ml-auto"}),n.jsx(VP,{setCode:e.setCode,className:"ml-auto"})]}),H==="collection"?n.jsx(IP,{slug:e.slug,setCode:e.setCode,accountId:V,narrow:!0}):n.jsx(ON,{breakdown:e.formatBreakdown,totalScore:e.score,events:t,selfReported:e.selfReportedEvents,showPoints:F,lockedFormats:P,bordered:!1})]}):I&&n.jsx(ON,{breakdown:e.formatBreakdown,totalScore:e.score,events:t,selfReported:e.selfReportedEvents,showPoints:F,lockedFormats:P}),q?n.jsx(HP,{slug:e.slug,setCode:e.setCode,accountId:V}):n.jsx($ae,{events:t,filtered:g,rows:v,summary:vO(t.length,e.selfReportedEvents,v.length,_),trophyHref:S,formatFilter:o,setFormatFilter:i,colorsFilter:l,setColorsFilter:c,colorOptions:m,formatOptions:b,setEndDate:((Z=r==null?void 0:r.find(Y=>Y.code===e.setCode))==null?void 0:Z.endDate)??null,playerDisplayName:e.displayName,updated:e.last
515CalculatedAt?Cc(e.lastCalculatedAt):null})]}),n.jsx(eO,{open:K,onClose:()=>W(!1),breakdown:T,confidenceOverride:o!=="ALL"?E:void 0,events:t,anchorRef:J}),k&&n.jsx(mO,{trophy:k,trophies:e.selfReportedEvents,displayName:e.displayName,trophyHref:S,onSelect:N,onClose:C})]})}function Kp({active:e,onClick:t,to:s,children:r,className:a}){const o=j("font-display text-[14px] tracking-[0.18em] px-4 h-full inline-flex items-center border-b-2 -mb-px",e?"text-green border-green":"text-muted border-transparent hover:text-text",a);return s?n.jsx(te,{to:s,className:o,children:r}):n.jsx("button",{type:"button",onClick:t,className:o,children:r})}function hO(e){const{user:t}=Qn(),{data:s}=rf(t==null?void 0:t.discordId);return Dne(t==null?void 0:t.discordId)&&s===e}function Dae(e){return(Number(e.split("-")[0])||0)>=7?"Premier Draft":"Trad Draft"}function Iae(e,t){const[s,r]=e.record.split("-");return{slug:"",setCode:e.setCode||t,eventId:`selftrophy-${e.sourceMessageId}`,format:e.platform,expansion:e.setCode||t,wins:Number(s)||0,losses:Number(r)||0,isTrophy:e.isTrophy,colors:e.colors,startedAt:e.reportedAt,finishedAt:e.reportedAt,externalUrl:null,eventName:null,podEventSlug:null,trophy:e}}function pO(e,t,s){const r=t.selfReportedEvents.map(a=>Iae(a,t.setCode)).filter(a=>s(a.colors,a.format));return[...e,...r].sort((a,o)=>Hr(a)<Hr(o)?1:Hr(a)>Hr(o)?-1:0)}function mO({trophy:e,trophies:t,displayName:s,trophyHref:r,onSelect:a,onClose:o}){const i=t.findIndex(u=>u.sourceMessageId===e.sourceMessageId),l=t.length>1,c=l?t[(i-1+t.length)%t.length]:null,d=l?t[(i+1)%t.length]:null;return n.jsx(Fc,{participant:{displayName:s,deckColors:e.colors,deckScreenshotUrl:e.screenshotUrl,deckScreenshotCaption:e.caption,deckSourceUrl:e.sourceUrl,record:e.record,screenshotChannelId:e.sourceChannelId,screenshotMessageId:e.sourceMessageId,mainboard:null},hideDraftLog:!0,onClose:o,onPrev:c?()=>a(c):void 0,onNext:d?()=>a(d):void 0,prevHref:c?r(c):void 0,nextHref:d?r(d):void 0})}function xO({stats:e,wp:t,showPoints:s=!0,onPointsClick:r,pointsBtnRef:a,trophiesLabel:o="TROPHIES"}){const i="font-display leading-none text-[clamp(26px,3vw,44px)]",l=[{label:o,value:n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(ct,{size:26,color:"#ffc63a"}),n.jsx("span",{className:i,children:e.trophies})]})},{label:"EVENTS",value:n.jsx("span",{className:i,children:e.events})},{label:"RECORD",value:n.jsx(ht,{mono:!0,wins:e.wins,losses:e.losses,separatorMargin:4,className:i})},{label:"WIN %",value:n.jsxs("span",{className:i,children:[t,n.jsx("span",{className:"text-[clamp(14px,1.5vw,22px)] text-muted",children:"%"})]})},...s?[{label:"POINTS",value:n.jsx("span",{className:j(i,"text-green"),children:ea(e.score)}),accent:!0,onClick:r,btnRef:a}]:[]];return n.jsx("div",{className:"grid border border-border2 bg-bg self-stretch min-w-0 ml-auto",style:{flex:"0 1 720px",gridTemplateColumns:s?"1fr 1fr 1.3fr 1fr 1.05fr":"1fr 1fr 1.3fr 1fr"},children:l.map((c,d)=>{const u=j("py-3.5 px-3 flex flex-col items-center text-center min-w-0",d<l.length-1&&"border-r border-border2"),f=n.jsx(Xe,{size:14,children:c.onClick?n.jsxs("span",{className:"relative inline-block leading-none",children:[c.label,n.jsx("span",{"aria-hidden":"true",className:"absolute top-1/2 -translate-y-1/2 ml-[3px] leading-none",style:{left:"100%"},children:n.jsx(Pv,{size:14,className:"text-muted"})})]}):c.label}),h=n.jsxs(n.Fragment,{children:[f,n.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.value})]});return c.onClick?n.jsx(Ne,{label:"View Points Breakdown",children:n.jsx("button",{type:"button",ref:c.btnRef,onClick:c.onClick,"aria-label":`Show ${c.label.toLowerCase()} breakdown`,className:j(u,"bg-transparent cursor-pointer hover:bg-surface2/40 transition-colors"),children:h})},c.label):n.jsx("div",{className:u,children:h},c.label)})})}const Tg="#e6ecf5";function ON({breakdown:e,totalScore:t,events:s,selfReported:r,showPoints:a,lockedFormats:o,bordered:i=!0}){const l=p.useMemo(()=>[...e].sort((N,C)=>C.scoreContribution-N.scoreContribution),[e]),c=l.reduce((N,C)=>N+C.scoreContribution,0)||1,{colorCount:d,comboCount:u,comboTrophies:f}=pw(s,r),h=Object.entries(u).sort((N,C)=>C[1]-N[1]);h.reduce((N,[,C])=>N+C,0);const m=Object.values(d).reduce((N,C)=>N+C,0)||1,[y,b]=p.useState(null),w=y??o??null,[x,g]=p.useState(null),[v,k]=p.useState(null),S=p.useRef({});return p.useEffect(()=>{var N;x&&((N=S.current[x])==null||N.scrollIntoView({block:"nearest",behavior:"smooth"}))},[x]),n.jsxs("section",{className:j("py-5 pr-8 pl-6 min-[1360px]:pl-10",i&&"border-r border-border"),children:[a&&l.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(Xe,{size:15,letterSpacing:"0.18em",color:Tg,className:"mb-3.5 text-center whitespace-nowrap",style:{width:148},children:"POINTS BY FORMAT"}),n.jsxs("div",{className:"flex items-center gap-5 mb-4",children:[n.jsx(li,{pieHole:.5,entries:l.map(N=>({key:N.formatLabel,value:N.scoreContribution/c,color:Ws[N.formatLabel]??"#5c8aff"})),radius:56,strokeWidth:18,size:148,activeKey:w,onHoverEntry:b}),n.jsx(Mae,{breakdown:l,totalScore:t,hoveredKey:w,onHover:b})]})]}),n.jsx(Xe,{size:15,letterSpacing:"0.18em",color:Tg,className:j("mb-3 text-center whitespace-nowrap",a&&l.length>0&&"mt-6"),style:{width:148},children:"DECK COLORS"}),n.jsxs("div",{className:"flex items-center gap-5",children:[n.jsx(li,{pieHole:.5,entries:h.map(([N,C])=>({key:N,value:C,colors:oO(N)})),radius:56,strokeWidth:18,size:148,activeKey:x,onHoverEntry:g}),n.jsx("div",{className:"flex-1 flex flex-col gap-1 max-h-[148px] overflow-y-auto overflow-x-hidden pr-2 [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-border2 [&::-webkit-scrollbar-thumb]:rounded-full",style:{scrollbarWidth:"thin",scrollbarColor:"#3b4458 transparent"},children:h.map(([N,C])=>n.jsxs("div",{ref:_=>{S.current[N]=_},onMouseEnter:()=>g(N),onMouseLeave:()=>g(null),className:j("grid gap-2 items-center px-1.5 rounded transition-colors cursor-default",x===N&&"bg-surface2"),style:{gridTemplateColumns:"auto 1fr 44px 40px"},children:[n.jsx(Be,{colors:N,size:14}),n.jsx("span",{className:"font-display text-[15px] tracking-[0.06em]",children:ys(N)}),n.jsx(Co,{count:f[N]??0,size:"md",display:!0,fixedDigits:2,className:"text-subtle justify-self-end"}),n.jsxs("span",{className:"font-num text-[15px] text-subtle text-right",children:["×",C]})]},N))})]}),n.jsx(Xe,{size:15,letterSpacing:"0.18em",color:Tg,className:"mt-6 mb-3 text-center whitespace-nowrap",style:{width:148},children:"COLORS PLAYED"}),n.jsxs("div",{className:"flex items-center gap-5",children:[n.jsx(li,{pieHole:.5,entries:Object.entries(d).filter(([,N])=>N>0).map(([N,C])=>({key:N,value:C,color:uw[N]})),radius:56,strokeWidth:18,size:148,activeKey:v,onHoverEntry:k}),n.jsx("div",{className:"flex-1 flex flex-col gap-1 pr-4",children:rO.map(N=>{const C=d[N]/m*100;return n.jsxs("div",{onMouseEnter:()=>k(N),onMouseLeave:()=>k(null),className:j("grid gap-2 items-center px-1.5 -mx-1.5 rounded transition-colors cursor-default",v===N&&"bg-surface2"),style:{gridTemplateColumns:"auto 1fr 48px"},children:[n.jsx(fr,{c:N,size:14}),n.jsx("span",{className:"font-display text-[15px] tracking-[0.06em]",children:aO[N]}),n.jsxs("span",{className:"font-num text-[15px] text-subtle text-right",children:[C.toFixed(0),"%"]})]},N)})})]})]})}function Mae({breakdown:e,totalScore:t,hoveredKey:s,onHover:r}){const a=o=>Array.isArray(s)?s.includes(o):s===o;return n.jsx("div",{className:"flex-1 flex flex-col",children:e.map((o,i)=>{const l=t?o.scoreContribution/t*100:0;return n.jsxs("div",{onMouseEnter:r?()=>r(o.formatLabel):void 0,onMouseLeave:r?()=>r(null):void 0,className:j("grid items-center py-[5px] gap-2.5 px-1.5 -mx-1.5 rounded transition-colors cursor-default",a(o.formatLabel)&&"bg-surface2"),style:{gridTemplateColumns:"1fr 44px 68px 48px"},children:[n.jsx("span",{className:"font-display text-[15px] tracking-[0.06em]",style:{color:Ws[o.formatLabel]??"#5c8aff"},children:ca(o.formatLabel)}),n.jsx(Co,{count:o.trophies,size:"md",display:!0,fixedDigits:2,className:"text-subtle justify-self-end"}),n.jsx(ht,{mono:!0,wins:o.wins,losses:o.losses,className:"font-num text-[13px] text-right text-subtle"}),n.jsx("span",{className:j("font-display text-[17px] text-right",l>0?"text-green":"text-muted"),children:ea(o.scoreContribution)})]},o.formatLabel)})})}function $ae({events:e,filtered:t,rows:s,summary:r,trophyHref:a,formatFilter:o,setFormatFilter:i,colorsFilter:l,setColorsFilter:c,colorOptions:d,formatOptions:u,setEndDate:f,playerDisplayName:h,updated:m}){const y=ut(1240),b=Bc("ALL"),w=p.useRef(null),x=()=>{var g;return(g=w.current)==null?void 0:g.scrollIntoView({behavior:"smooth",block:"start"})};return n.jsxs("section",{ref:w,className:"pb-6 px-5 min-w-0",children:[n.jsxs("div",{className:"flex justify-between items-center gap-3 h-[42px] px-5 -mx-5 border-b border-border2",children:[n.jsxs("div",{className:"flex items-baseline gap-2.5 shrink-0",children:[n.jsx(Xe,{size:14,children:"EVENT LOG"}),r.length>0&&n.jsx("span",{className:"inline-flex items-baseline gap-x-3 font-display text-[13px] tracking-[0.14em] text-subtle whitespace-nowrap",children:r.map(g=>n.jsx("span",{children:g},g))})]}),m&&n.jsxs("span",{className:"font-display text-[13px] tracking-[0.14em] text-muted shrink-0 whitespace-nowrap",children:["UPDATED ",m]}),n.jsxs("div",{className:"flex gap-2 min-w-0 shrink justify-end",children:[n.jsx(yt,{value:o,onChange:i,hrefFor:g=>b("format",g),options:u,renderValue:Ss,renderOption:Ss,className:"min-w-0 max-w-[200px]",triggerClassName:"min-w-0"}
515),n.jsx(yt,{value:l,onChange:c,hrefFor:g=>b("colors",g),options:d,align:"right",renderValue:hr,renderOption:hr,className:"min-w-0 max-w-[200px]",triggerClassName:"min-w-0"})]})]}),n.jsxs("div",{className:"grid gap-x-2 items-stretch",style:{gridTemplateColumns:"22px 70px max-content 1fr 24px auto"},children:[s.map((g,v)=>{const k=Sl(g.finishedAt,f),S=s[v-1],N=s[v+1],C=!k&&!!S&&Sl(S.finishedAt,f),_=k&&!!N&&!Sl(N.finishedAt,f);return n.jsxs(wt.Fragment,{children:[C&&n.jsx(gO,{variant:"desktop"}),n.jsx(Zp,{event:g,variant:"desktop",hideBottomBorder:_,playerDisplayName:h,trophyHref:a,compact:y})]},g.eventId)}),s.length===0&&n.jsx("div",{className:"p-6 text-center text-muted font-display tracking-[0.2em] col-span-full",children:"NO EVENTS MATCH FILTER"}),n.jsx(zc,{onClick:x})]})]})}function LN({tag:e}){if(e.tone==="alchemy")return n.jsx("img",{src:"/alchemy.png",alt:e.label,className:"h-6 w-auto object-contain"});const t=e.tone==="midweek"?"border-[#a86bff] text-[#a86bff]":"border-[#ffc63a] text-[#ffc63a]";return n.jsx("span",{className:j("inline-flex items-center px-2 py-0.5 bg-bg border font-display text-[11px] tracking-[0.2em] leading-none uppercase whitespace-nowrap",t),children:e.label})}function DN({amount:e,className:t}){return n.jsx("span",{className:j("inline-flex items-center px-2 py-1 bg-[#ff8c3a] border border-[#ff8c3a] text-bg font-mono font-bold text-[13px] tracking-[0.08em] leading-none whitespace-nowrap",t),children:e})}function gO({variant:e}){const t=e==="mobile"?"-mx-[18px]":"-mx-2",s=e==="desktop"?"col-span-full":"";return n.jsx("div",{className:j("relative my-1 border-t border-teal",t,s),children:n.jsx("span",{className:"absolute left-1/2 -translate-x-1/2 -top-[9px] px-2 py-0.5 bg-bg border border-teal text-teal font-display text-[11px] tracking-[0.2em] leading-none",children:"FLASHBACK"})})}function Eg({size:e="md"}){const t=e==="sm",s="polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%)";return n.jsx("span",{className:"inline-block bg-transparent transition-colors group-hover:[animation:pod-border-pulse_1.4s_ease-in-out_infinite]",style:{clipPath:s,padding:1},children:n.jsxs("span",{className:j("inline-flex items-center gap-1.5 leading-none font-display text-text bg-surface2 whitespace-nowrap",t?"text-[11px] tracking-[0.14em] py-[5px] pl-[8px] pr-[10px]":"text-[13px] tracking-[0.14em] py-[6px] pl-[10px] pr-[12px]"),style:{clipPath:s},children:[n.jsx(gr,{size:t?14:16,className:"text-green shrink-0"}),n.jsx("span",{className:t?"inline":"hidden xl:inline",children:"VIEW EVENT"}),n.jsx(Jt,{size:t?10:12,className:t?"inline-block":"hidden xl:inline-block"})]})})}const Uae=["MTGA","MTGO","PAPER","OTHER"],IN={MTGA:"/platforms/mtga.png",MTGO:"/platforms/mtgo.png",PAPER:"/platforms/cardback.png"};function bO(e){const t=e.toLowerCase();return t.includes("mtgo")||t.includes("online")?"MTGO":t.includes("mtga")||t.includes("arena")?"MTGA":t.includes("paper")||t.includes("pre")?"PAPER":"OTHER"}function yO(e){const t=new Map;for(const s of e){const r=bO(s.platform);t.set(r,(t.get(r)??0)+1)}return Uae.filter(s=>t.has(s)).map(s=>({bucket:s,count:t.get(s)}))}function vO(e,t,s,r){if(e===0&&t.length===0)return[];if(r)return[`${s} OF ${e+t.length}`];if(t.length===0)return[`${e} EVENTS`];const a=e>0?[`${e} 17LANDS`]:[];for(const{bucket:o,count:i}of yO(t))a.push(`${i} ${o}`);return a}function qp({trophies:e,mobile:t=!1,className:s}){const r=e.filter(c=>c.isTrophy);if(r.length===0)return null;const a=yO(r),o=t?18:24,i=t?"text-[16px]":"text-[clamp(22px,2.4vw,32px)]",l=a.map(({bucket:c,count:d})=>n.jsxs("span",{className:j("inline-flex items-center",t?"gap-1":"gap-1.5"),children:[IN[c]?n.jsx("img",{src:IN[c],alt:c,style:{height:o},className:"w-auto shrink-0",draggable:!1}):n.jsx("span",{className:"font-display text-muted text-[12px] tracking-[0.12em]",children:c}),n.jsx("span",{className:j("font-display leading-none tabular-nums",i),children:d})]},c));return t?n.jsxs("div",{className:j("pl-[5px] flex items-center flex-wrap gap-x-2 gap-y-1",s),children:[n.jsx(ct,{size:o,color:"#ffc63a"}),l]}):n.jsxs("div",{className:"border border-border2 bg-bg px-4 py-3.5 flex flex-col items-center justify-center text-center gap-2 self
515-stretch shrink-0 min-w-[120px]",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Xe,{size:13,children:"MANUAL"}),n.jsx(ct,{size:18,color:"#ffc63a"})]}),n.jsx("div",{className:"flex items-center justify-center flex-wrap gap-4",children:l})]})}function MN({platform:e,label:t=e}){const s=Ws[e];return n.jsx("span",{className:j("inline-flex items-center px-2 py-1 bg-bg border font-display text-[13px] tracking-[0.18em] leading-none uppercase whitespace-nowrap",s?"":"border-border text-muted"),style:s?{borderColor:s,color:s}:void 0,children:t})}function Zp({event:e,variant:t,hideBottomBorder:s=!1,playerDisplayName:r,trophyHref:a,setColumn:o=!1,setHref:i,compact:l=!1}){const c=e.trophy??null,d=e.externalUrl??null,u=e.format==="PodDraft",f=u?e.podEventSlug??null:null,h=f?`/pods/${f}${r?`?player=${encodeURIComponent(r)}`:""}`:null,m=u&&!!f,y=!u&&!!d,b=m||y||c?"group cursor-pointer transition-colors hover:bg-surface2 no-underline text-inherit":"",w=u&&!e.colors,x=c?(c.format??Dae(c.record)).toUpperCase():X7(e).toUpperCase(),g=u||c?null:e9(e.format,e.expansion),v=t9(e),k=v?"#ff8c3a":e.isTrophy?"#2ee85c":"#e6ecf5",S=s?"":"border-b border-border";if(t==="desktop"){const{name:T,splash:E}=w?{name:"",splash:""}:TE(e.colors),A=l?n.jsx("span",{className:"flex items-center",children:n.jsx(Be,{colors:e.colors,size:14})}):n.jsxs("span",{className:"grid items-center gap-x-2",style:{gridTemplateColumns:"100px 96px 1fr"},children:[n.jsx(Be,{colors:e.colors,size:14}),n.jsx("span",{className:"text-[13px] text-muted whitespace-nowrap",style:E?void 0:{gridColumn:"span 2"},children:T}),E&&n.jsx("span",{className:"text-[13px] text-muted",children:E})]}),P=n.jsxs(n.Fragment,{children:[o&&n.jsx("span",{className:"flex items-center justify-center",children:n.jsx(Ae,{code:e.setCode,size:18,className:"text-white/85"})}),n.jsx("span",{className:"text-right pr-1",children:e.isTrophy&&n.jsx(ct,{size:18,color:"#ffc63a"})}),n.jsx("span",{className:"text-[13px] text-muted text-center",children:d1(Hr(e))}),n.jsxs("span",{className:"flex items-center gap-2 min-w-0 pr-4",children:[n.jsx("span",{className:"font-display text-[16px] tracking-[0.08em] whitespace-nowrap",children:Si(x)}),e.isTrophy&&eb(e.format)&&n.jsx(tb,{size:36,box:22}),n.jsx("span",{className:"flex-1 flex items-center justify-center",children:v&&n.jsx(DN,{amount:v})}),g&&n.jsx(LN,{tag:g})]}),u?l?n.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[!w&&n.jsx(Be,{colors:e.colors,size:14}),f&&n.jsx(Eg,{})]}):n.jsxs("span",{className:"grid items-center gap-x-2 min-w-0",style:{gridTemplateColumns:"100px 96px minmax(0, 100px) auto 1fr"},children:[w?n.jsx("span",{className:"text-[13px] text-muted",style:{gridColumn:"1 / 4"},children:"Deck not submitted"}):n.jsxs(n.Fragment,{children:[n.jsx(Be,{colors:e.colors,size:14}),n.jsx("span",{className:"text-[13px] text-muted whitespace-nowrap",style:E?void 0:{gridColumn:"span 2"},children:T}),E&&n.jsx("span",{className:"text-[13px] text-muted",children:E})]}),f&&n.jsx(Eg,{})]}):A,n.jsx("span",{className:"flex items-center justify-center",children:n.jsx(Tu,{endRank:e.endRank,size:22})}),c?n.jsxs("span",{className:"inline-flex items-center justify-end gap-3 text-dim group-hover:text-text transition-colors",children:[n.jsx(MN,{platform:c.platform}),n.jsx(M1,{size:18,"aria-hidden":"true"}),n.jsx(ht,{mono:!0,wins:e.wins,losses:e.losses,color:k,className:"text-right font-display text-[22px]"})]}):u?h?n.jsxs("span",{className:"inline-flex items-center justify-end gap-3 text-dim group-hover:text-text transition-colors",children:[n.jsx(ht,{mono:!0,wins:e.wins,losses:e.losses,color:k,className:"text-right font-display text-[22px]"}),n.jsx(en,{size:18,"aria-hidden":"true"})]}):n.jsx("span",{className:"inline-flex items-center justify-end",children:n.jsx(ht,{mono:!0,wins:e.wins,losses:e.losses,color:k,className:"text-right font-display text-[22px]"})}):n.jsx(Ne,{label:"View deck in 17lands",children:n.jsxs("span",{className:"inline-flex items-center justify-end gap-3 text-dim group-hover:text-text transition-colors",children:[n.jsx(ht,{mono:!0,wins:e.wins,losses:e.losses,color:k,className:"text-right font-display text-[22px]"}),d&&n.jsx(en,{size:18,"aria-hidden":"true"})]})})]}),M=j("grid gap-x-3 py-[6px] px-2 -mx-2 items-center col-span-full",S,b),U={gridTemplateColumns:"subgrid"};return c&&a?n.jsx(te,{to:a(c),state:gi,className:j("text-left w-full",M),style:U,children:P}):m&&h?n.jsx(te,{to:h,className:M,style:U,children:P}):y?n.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:M,style:U,children:P}):i?n.jsx(te,{to:i,className:M,style:U,children:P}):n.jsx("div",{className:M,style:U,children:P})}const N=n.jsxs(n.Fragment,{children:[n.jsx("span",{children:e.isTrophy&&n.jsx(ct,{size:16,color:"#ffc63a"})}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[o&&n.jsx(Ae,{code:e.setCode,size:16,className:"text-white/85"}),!w&&n.jsx(Be,{colors:e.colors,size:11}),n.jsx("span",{className:"font-display text-[13px] tracking-[0.08em]",children:Si(x)}),e.isTrophy&&eb(e.format)&&n.jsx(tb,{size:28,box:16}),v&&n.jsx(DN,{amount:v,className:"mx-1.5"}),g&&n.jsx(LN,{tag:g})]}),n.jsx("div",{className:"mt-0.5",children:n.jsx("span",{className:"text-[11px] text-muted",children:[w?"Deck not submitted":tG(e.colors),d1(Hr(e))].filter(
515Boolean).join(" · ")})})]}),c?n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-dim group-hover:text-text transition-colors",children:[n.jsx(MN,{platform:c.platform,label:bO(c.platform)}),n.jsx(M1,{size:16,"aria-hidden":"true"}),n.jsx(ht,{mono:!0,wins:e.wins,losses:e.losses,color:k,className:"font-display text-[22px]"})]}):u?n.jsxs("span",{className:"inline-flex items-center gap-2.5",children:[f&&n.jsx(Eg,{size:"sm"}),h?n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-dim group-hover:text-text transition-colors",children:[n.jsx(ht,{mono:!0,wins:e.wins,losses:e.losses,color:k,className:"font-display text-[22px]"}),n.jsx(en,{size:16,"aria-hidden":"true"})]}):n.jsx(ht,{mono:!0,wins:e.wins,losses:e.losses,color:k,className:"font-display text-[22px]"})]}):n.jsx(Ne,{label:"View deck in 17lands",children:n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-dim group-hover:text-text transition-colors",children:[n.jsx(Tu,{endRank:e.endRank,size:18,className:"mr-0.5"}),n.jsx(ht,{mono:!0,wins:e.wins,losses:e.losses,color:k,className:"font-display text-[22px]"}),d&&n.jsx(en,{size:16,"aria-hidden":"true"})]})})]}),C=j("grid gap-2.5 py-2.5 px-[18px] -mx-[18px] items-center",S,b),_={gridTemplateColumns:"20px 1fr auto"};return c&&a?n.jsx(te,{to:a(c),state:gi,className:j("text-left w-[calc(100%+36px)]",C),style:_,children:N}):m&&h?n.jsx(te,{to:h,className:C,style:_,children:N}):y?n.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:C,style:_,children:N}):i?n.jsx(te,{to:i,className:C,style:_,children:N}):n.jsx("div",{className:C,style:_,children:N})}function zae({profile:e,events:t,sibling:s,sets:r,setHref:a}){const[o,i,l,c,d]=iO(),u=Bc("ALL"),{chips:f,otherCombos:h}=Rv(e.setCode),m=ds(e.setCode),y=p.useMemo(()=>{const W=[{value:"ALL",label:"ALL COLORS"}];for(const J of f)J===it?W.push({value:it,label:"SOUP"}):J===kt?W.push({value:kt,label:"OTHER"}):W.push({value:J,label:ys(J)});return W},[f]),{data:b}=Wm(e.setCode),w=p.useMemo(()=>{const W=new Set(b??[]),J=b?Tn.filter(Y=>Y.value==="ALL"?!0:(bi[Y.value]??[Y.value]).some(pe=>W.has(pe))):Tn,Z=Array.from(new Set(e.selfReportedEvents.map(Y=>Y.platform)));return[...J,...Z.map(Y=>({value:Y,label:Y.toUpperCase()}))]},[b,e.selfReportedEvents]),x=p.useMemo(()=>new Set(h),[h]),g=p.useCallback((W,J)=>{if(o!=="ALL"&&!Xa(J,o))return!1;if(l!=="ALL"){if(l===it){if(!Cs(W,m))return!1}else if(l===kt){if(Cs(W,m)||!x.has(Bt(W)))return!1}else if(Bt(W)!==l)return!1}return!0},[o,l,x,m]),v=p.useMemo(()=>t.filter(W=>g(W.colors,W.format)),[t,g]),k=p.useMemo(()=>pO(v,e,g),[v,e,g]),{shotTrophy:S,trophyHref:N,selectTrophy:C,closeTrophy:_}=lO(e.selfReportedEvents),T=o!=="ALL"||l!=="ALL",E=p.useMemo(()=>{if(o==="ALL")return e.formatBreakdown;const W=new Set(bi[o]??[o]);return e.formatBreakdown.filter(J=>W.has(J.formatLabel))},[e.formatBreakdown,o]),A=p.useMemo(()=>vo(e.formatBreakdown.filter(W=>W.formatLabel!=="Pod").map(W=>({label:W.formatLabel,events:W.events,wins:W.wins,losses:W.losses,trophies:W.trophies}))).confidence,[e.formatBreakdown]),P=o==="ALL"?e.score:Math.round(E.reduce((W,J)=>W+J.scoreContribution,0)*100)/100,M=o!=="ALL"&&E.length>0?E.map(W=>W.formatLabel):null,U=p.useMemo(()=>{if(!T)return{trophies:e.trophies,events:e.events,wins:e.wins,losses:e.losses,score:e.score};const W=hw(v),J=k.length-v.length;return{trophies:W.trophies+J,events:W.events,wins:W.wins,losses:W.losses,score:P}},[T,v,k,P,e.trophies,e.events,e.wins,e.losses,e.score]),F=Nc(U.wins,U.losses),I=e.rank>0,q=e.events>0||e.selfReportedEvents.length>0,O=hO(e.slug),{accounts:H,accountId:B,setAccountId:D}=KP(O),[L,$]=p.useState(!1),V=p.useRef(null),z=p.useRef(null),K=()=>{var W;return(W=z.current)==null?void 0:W.scrollIntoView({behavior:"smooth",block:"start"})};return n.jsxs("div",{className:"bg-bg text-text min-h-screen page-fade",children:[n.jsx(Vp,{sibling:s,qs:d}),n.jsxs("section",{className:"px-[18px] pt-5 pb-4 border-b border-border",style:{background:"linear-gradient(180deg, #14181f 0%, #0a0c10 100%)"},children:[n.jsxs("div",{className:"flex items-center",children:[n.jsx(as,{displayName:e.displayName,avatarUrl:e.avatarUrl,size:84,green:!0}),n.jsxs("div",{className:"flex-1 min-w-0 ml-3 relative flex items-center min-h-[84px]",children:[n.jsx("h1",{className:"font-display tracking-[0.03em] m-0 pl-[5px] line-clamp-2 break-words",style:{fontSize:"clamp(20px, 7vw, 44px)",lineHeight:.95},children:e.displayName.toUpperCase()}),n.jsx(qp,{trophies:e.selfReportedEvents,mobile:!0,className:"absolute bottom-0 left-0"})]}),n.jsxs("div",{className:"flex flex-col items-end gap-1.5 font-display tracking-[0.18em] shrink-0",children:[I&&n.jsx("span",{className:"flex items-center gap-2",style:{marginRight:-8},children:n.jsx(nO,{rank:e.rank,size:"md"})}),r?n.jsx(Ru,{sets:r,activeCode:e.setCode,hrefFor:a,size:"sm",chamfer:!1,includeLifetime:!0}):n.jsx("span",{className:"text-[18px]",children:e.setCode})]})]}),n.jsxs("div",{className:j("mt-[18px] grid gap-[5px]",I?"grid-cols-5":"grid-cols-4"),children:[n.jsx(zr,{label:e.selfReportedEvents.some(W=>W.isTrophy)?"17L TROPHIES":"TROPHIES",value:cO(U.trophies)}),n.jsx(zr,{label:"EVENTS",value:dO(U.events)}),n.jsx(zr,{label:"RECORD",value:uO(U.wins,U.losses)}),n.jsx(zr,{label:"WIN %",value:fO(U.wins,U.losses,F)}),I&&n.jsx(zr,{label:"POINTS",value:ea(U.score),accent:!0,onClick:()=>$(W=>!W),buttonRef:V})]})]}),(q||O)&&n.jsx(Fae,{breakdown:e.formatBreakdown,events:t,selfReported:e.selfReportedEvents,showPoints:I,lockedFormats:M,tracker:O?{slug:e.slug,setCode:e.setCode,updatedAt:e.lastCalculatedAt??null,accounts:H,accountId:B,onChangeAccount:D}:null}),!O&&n.jsxs("section",{ref:z,className:"py-4 px-[18px]",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2.5 gap-2",children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[n.jsx(Xe,{size:12,children:"EVENT LOG"}),n.jsx("span",{className:"inline-flex items-baseline gap-x-2.5 font-display text-[11px] tracking-[0.12em] text-dim",children:vO(t.length,e.selfReportedEvents,k.length,T).map(W=>n.jsx("span",{children:W},W))})]}),e.lastCalculatedAt&&n.jsxs("span",{className:"font-display text-[11px] tracking-[0.12em] text-muted",children:["UPDATED ",Cc(e.lastCalculatedAt)]})]}),n.jsxs("div",{className:"flex items-stretch gap-2 mb-3",children:[n.jsx("div",{className:"flex-1 min-w-0 flex",children:n.jsx(yt,{value:o,onChange:i,hrefFor:W=>u("format",W),options:w,variant:"mobile",renderValue:Ss,renderOption:Ss})}),n.jsx("div",{className:"flex-1 min-w-0 flex",children:n.jsx(yt,{value:l,onCh
515ange:c,hrefFor:W=>u("colors",W),options:y,align:"right",variant:"mobile",renderValue:hr,renderOption:hr})})]}),(()=>{var J;const W=((J=r==null?void 0:r.find(Z=>Z.code===e.setCode))==null?void 0:J.endDate)??null;return k.map((Z,Y)=>{const ae=Sl(Z.finishedAt,W),pe=k[Y-1],ye=k[Y+1],De=!ae&&!!pe&&Sl(pe.finishedAt,W),Fe=ae&&!!ye&&!Sl(ye.finishedAt,W);return n.jsxs(wt.Fragment,{children:[De&&n.jsx(gO,{variant:"mobile"}),n.jsx(Zp,{event:Z,variant:"mobile",hideBottomBorder:Fe,playerDisplayName:e.displayName,trophyHref:N})]},Z.eventId)})})(),k.length===0&&n.jsx("div",{className:"p-6 text-center text-muted font-display tracking-[0.2em] text-[13px]",children:"NO EVENTS MATCH FILTER"}),n.jsx(zc,{onClick:K,compact:!0})]}),n.jsx(eO,{open:L,onClose:()=>$(!1),breakdown:E,confidenceOverride:o!=="ALL"?A:void 0,events:t,anchorRef:V}),S&&n.jsx(mO,{trophy:S,trophies:e.selfReportedEvents,displayName:e.displayName,trophyHref:N,onSelect:C,onClose:_})]})}const $N="player-breakdown-tab";function Bae(e){return e==="format"||e==="deckColors"||e==="manaPips"||e==="collection"||e==="games"}function Fae({breakdown:e,events:t,selfReported:s,showPoints:r,lockedFormats:a,tracker:o}){const[i,l]=p.useState(()=>{if(typeof window>"u")return"deckColors";const f=window.localStorage.getItem($N);return Bae(f)?f:"deckColors"});p.useEffect(()=>{window.localStorage.setItem($N,i)},[i]);const d=(f=>f==="format"?r:f==="collection"||f==="games"?!!o:!0)(i)?i:"deckColors",u=p.useRef(null);return n.jsxs("section",{ref:u,className:"border-b border-border",children:[n.jsxs("div",{className:"flex border-b border-border",children:[o&&n.jsx(cd,{active:d==="collection",onClick:()=>l("collection"),children:"COLLECTION"}),o&&n.jsx(cd,{active:d==="games",onClick:()=>l("games"),children:"GAMES"}),r&&n.jsx(cd,{active:d==="format",onClick:()=>l("format"),children:o?"POINTS":"POINTS BY FORMAT"}),n.jsx(cd,{active:d==="deckColors",onClick:()=>l("deckColors"),children:o?"DECKS":"DECK COLORS"}),n.jsx(cd,{active:d==="manaPips",onClick:()=>l("manaPips"),children:o?"COLORS":"COLORS PLAYED"})]}),d==="collection"&&o&&n.jsx(Wae,{tracker:o}),d!=="collection"&&d!=="games"&&n.jsxs("div",{className:"px-[18px] py-4",children:[d==="format"&&n.jsx(Hae,{breakdown:e,lockedFormats:a}),d==="deckColors"&&n.jsx(Gae,{events:t,selfReported:s}),d==="manaPips"&&n.jsx(Vae,{events:t,selfReported:s})]}),o&&d!=="collection"&&n.jsxs("div",{className:"pt-2 border-t border-border",children:[n.jsx(HP,{slug:o.slug,setCode:o.setCode,accountId:o.accountId,updatedAt:o.updatedAt}),n.jsx(zc,{onClick:()=>{var f;return(f=u.current)==null?void 0:f.scrollIntoView({behavior:"smooth",block:"start"})},compact:!0})]})]})}function Wae({tracker:e}){const{slug:t,setCode:s,accounts:r,accountId:a,onChangeAccount:o}=e;return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3",children:[n.jsx(qP,{accounts:r,active:a,onChange:o}),n.jsx(VP,{setCode:s,className:"ml-auto"})]}),n.jsx(GP,{slug:t,setCode:s,accountId:a,className:"mx-4 mt-3"}),n.jsx(IP,{slug:t,setCode:s,accountId:a})]})}function cd({active:e,onClick:t,children:s}){return n.jsx("button",{type:"button",onClick:t,className:j("flex-1 py-2.5 px-1.5 bg-transparent cursor-pointer font-display text-[11px] tracking-[0.16em] transition-colors border-b-2 border-solid",e?"text-text border-green":"text-muted border-transparent"),style:e?{marginBottom:-1}:void 0,children:s})}function Hae({breakdown:e,lockedFormats:t}){const s=p.useMemo(()=>[...e].sort((c,d)=>d.scoreContribution-c.scoreContribution),[e]),r=s.reduce((c,d)=>c+d.scoreContribution,0)||1,[a,o]=p.useState(null),i=a??t??null,l=c=>Array.isArray(i)?i.includes(c):i===c;return n.jsxs("div",{className:"flex items-center gap-3.5 min-h-[140px]",children:[n.jsx(li,{pieHole:.5,entries:s.map(c=>({key:c.formatLabel,value:c.scoreContribution/r,color:Ws[c.formatLabel]??"#5c8aff"})),radius:42,strokeWidth:14,size:108,activeKey:i,onHoverEntry:o}),n.jsx("div",{className:"flex-1 flex flex-col",children:s.map((c,d)=>n.jsxs("div",{onMouseEnter:()=>o(c.formatLabel),onMouseLeave:()=>o(null),className:j("grid items-center py-[5px] gap-2 px-1.5 -mx-1.5 rounded transition-colors cursor-default",l(c.formatLabel)&&"bg-surface2"),style:{gridTemplateColumns:"1fr 36px 56px 36px"},children:[n.jsx("span",{className:"font-display text-[11px] tracking-[0.06em]",style:{color:Ws[c.formatLabel]??"#5c8aff"},children:ca(c.formatLabel)}),n.jsx(Co,{count:c.trophies,size:"sm",fixedDigits:2,className:"text-muted justify-self-end"}),n.jsx(ht,{mono:!0,wins:c.wins,losses:c.losses,className:"font-num text-[13px] text-right text-muted"}),n.jsx("span",{className:j("font-display text-[13px] text-right",c.scoreContribution>0?"text-green":"text-muted"),children:ea(c.scoreContribution)})]},c.formatLabel))})]})}function Gae({events:e,selfReported:t}){const{comboCount:s,comboTrophies:r}=pw(e,t),a=Object.entries(s).sort((c,d)=>d[1]-c[1]);a.reduce((c,[,d])=>c+d,0);const[o,i]=p.useState(null),l=p.useRef({});return p.useEffect(()=>{var c;o&&((c=l.current[o])==null||c.scrollIntoView({block:"nearest",behavior:"smooth"}))},[o]),a.length===0?n.jsx("div",{className:"font-display text-[13px] text-muted py-3 min-h-[140px]",children:"NO EVENTS YET"}):n.jsxs("div",{className:"flex items-center gap-3.5 min-h-[140px]",children:[n.jsx(li,{pieHole:.5,entries:a.map(([c,d])=>({key:c,value:d,colors:oO(c)})),radius:42,strokeWidth:14,size:108,activeKey:o,onHoverEntry:i}),n.jsx("div",{className:"flex-1 flex flex-col gap-1 max-h-[126px] overflow-y-auto overflow-x-hidden pr-2 [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-border2 [&::-webkit-scrollbar-thumb]:rounded-full",style:{scrollbarWidth:"thin",scrollbarColor:"#3b4458 transparent"},children:a.map(([c,d])=>n.jsxs("div",{ref:u=>{l.current[c]=u},onMouseEnter:()=>i(c),onMouseLeave:()=>i(null),className:j("grid gap-2 items-center px-1.5 rounded transition-colors cursor-default min-h-[22px]",o===c&&"bg-surface2"),style:{gridTemplateColumns:"auto 1fr 38px 36px"},children:[n.jsx(Be,{colors:c,size:11}),n.jsx("span",{className:"font-display text-[13px] tracking-[0.06em]",children:ys(c)}),n.jsx(Co,{count:r[c]??0,size:"sm",fixedDigits:2,className:"text-muted justify-self-end"}),n.jsxs("span",{className:"font-num text-[13px] text-muted text-right",children:["×",d
515]})]},c))})]})}function Vae({events:e,selfReported:t}){const{colorCount:s}=pw(e,t),r=Object.values(s).reduce((i,l)=>i+l,0)||1,[a,o]=p.useState(null);return n.jsx("div",{className:"flex flex-col gap-3.5",children:n.jsxs("div",{className:"flex items-center gap-6 min-h-[140px]",children:[n.jsx(li,{pieHole:.5,entries:Object.entries(s).filter(([,i])=>i>0).map(([i,l])=>({key:i,value:l,color:uw[i]})),radius:42,strokeWidth:14,size:108,activeKey:a,onHoverEntry:o}),n.jsx("div",{className:"flex-1 flex flex-col gap-1 pr-4",children:rO.map(i=>{const l=s[i]/r*100;return n.jsxs("div",{onMouseEnter:()=>o(i),onMouseLeave:()=>o(null),className:j("grid gap-2 items-center px-1.5 -mx-1.5 rounded transition-colors cursor-default min-h-[22px]",a===i&&"bg-surface2"),style:{gridTemplateColumns:"auto 1fr 40px"},children:[n.jsx(fr,{c:i,size:11}),n.jsx("span",{className:"font-display text-[13px] tracking-[0.06em]",children:aO[i]}),n.jsxs("span",{className:"font-num text-[13px] text-muted text-right",children:[l.toFixed(0),"%"]})]},i)})})]})})}function wO({sibling:e,qs:t="",compact:s=!1}){const r=j("bg-transparent border-none font-display tracking-[0.15em] leading-none flex items-center gap-1.5 transition-colors",s?"text-[13px]":"text-[14px]","cursor-pointer hover:text-text no-underline text-muted"),a="opacity-30 cursor-default pointer-events-none text-muted",o=c=>c?{pathname:Gt(c,e.setCode),search:t}:null,i=o(e.prevSlug),l=o(e.nextSlug);return n.jsxs("div",{"data-popover-keep-open":!0,className:j("flex items-center",s?"gap-3":"gap-5"),children:[i?n.jsxs(te,{to:i,className:r,"aria-label":"Previous player",children:[n.jsx(lo,{size:16,className:"shrink-0"})," PREV"]}):n.jsxs("span",{className:j(r,a),"aria-disabled":"true",children:[n.jsx(lo,{size:16,className:"shrink-0"})," PREV"]}),l?n.jsxs(te,{to:l,className:r,"aria-label":"Next player",children:["NEXT ",n.jsx(co,{size:16,className:"shrink-0"})]}):n.jsxs("span",{className:j(r,a),"aria-disabled":"true",children:["NEXT ",n.jsx(co,{size:16,className:"shrink-0"})]})]})}const Kae=[1,-1,1];function qae(e){var a,o;const t=e.seats.length,s=jO(e),r=e.seats.map(()=>[[],[],[]]);for(let i=0;i<3;i++){let l=e.seats.map((u,f)=>[...e.packs[f+i*t]]);const c=Kae[i],d=Math.floor((((o=(a=e.picks[0])==null?void 0:a[i])==null?void 0:o.length)??0)/s);for(let u=0;u<d;u++){const f=e.seats.map((h,m)=>e.picks[m][i].slice(u*s,u*s+s));for(let h=0;h<t;h++){const m=[...l[h]],y=f[h];r[h][i].push({booster:m,takenPositions:y,takenCards:y.map(b=>m[b])})}for(let h=0;h<t;h++)for(const m of[...f[h]].sort((y,b)=>b-y))l[h].splice(m,1);l=l.map((h,m)=>l[((m-c)%t+t)%t])}}return r}function jO(e){return e.pp??1}function UN(e,t,s,r){const a=[];for(let o=0;o<=s;o++){const i=e[t][o],l=o<s?i.length:r;for(let c=0;c<l;c++)a.push(...i[c].takenCards)}return a}function Zae(e,t,s,r){const a=[];for(let o=0;o<=s;o++){const i=e[t][o],l=o<s?i.length:r;a.push(i.slice(0,l).flatMap(c=>c.takenCards))}return a}function Yae(e){const t=e.indexOf("#");return t===-1?e:e.slice(0,t)}function mc(e,t){var a;const s=(a=e.decks)==null?void 0:a[t];if(!s||s.main.length===0)return null;const r=Qae(e,s.main);return{set:r,cards:zN(e,s.main,r),sideboard:zN(e,s.side,r)}}function Qae(e,t){const s=new Map;for(const o of t){const i=e.cards[o];i!=null&&i.s&&s.set(i.s,(s.get(i.s)??0)+1)}let r=null,a=0;for(const[o,i]of s)i>a&&(a=i,r=o);return r}function zN(e,t,s){const r=new Map;for(const a of t){const o=e.cards[a];if(!o||o.n==null)continue;const i=r.get(o.n);i?i.count+=1:r.set(o.n,{card:o,count:1})}return[...r.values()].sort((a,o)=>(a.card.cmc??99)-(o.card.cmc??99)||a.card.n.localeCompare(o.card.n)).map(({card:a,count:o})=>{const i={name:a.n,cn:a.cn,cmc:a.cmc,type:a.type};return a.s&&a.s!==s&&(i.set=a.s),a.c&&a.c.length&&(i.colors=a.c),o>1&&(i.count=o),i})}const Jae=[1,-1,1];function Xae({artifact:e,meta:t,seat:s,pack:r,pick:a,backHref:o,eventSlug:i,eventId:l,seatInfo:c,soloSeat:d}){var bf,Zc;const u=ln(),f=d!=null,h=`/set-symbols/${t.setCode.toLowerCase()}.png`,m=p.useMemo(()=>km(t.name,t.setCode),[t]),y=e.seats.length,b=p.useMemo(()=>new Map((c??[]).map(le=>[le.seatIndex,le])),[c]),w=p.useMemo(()=>qae(e),[e]),x=p.useMemo(()=>jO(e),[e]),g=p.useMemo(()=>e.cards.map(le=>({name:le.n,set:le.s??e.set})),[e]),v=Mi(g),k=p.useMemo(()=>e.seats.map((le,Pe)=>{const gt=b.get(Pe);return{index:Pe,name:gt?_c(gt.displayName):Yae(le),colors:(gt==null?void 0:gt.deckColors)??"",avatarUrl:(gt==null?void 0:gt.avatarUrl)??null}}),[e,b]),S=Math.min(2,Math.max(0,r)),N=Math.min(w[s][S].length-1,Math.max(0,a)),[C,_]=Rg("draftReviewViewMode",soe()),T=f?"scroll":C,[E,A]=Ag("draftReviewShowTable",!1),[P,M]=Rg("draftReviewDeckLayout","columns"),[U,F]=Rg("draftReviewRevealMode","revealed"),[I,q]=p.useState(null),[O,H]=Ag("draftReviewSplitSideboard",!1),[B,D]=Ag("draftReviewShowGrades",!1),[L,$]=p.useState(null),V=Aoe(),[z,K]=p.useState(0),W=p.useCallback(le=>K(Pe=>le>Pe?le:Pe),[]),J=Poe(V,z);p.useEffect(()=>{const le=document.documentElement;return le.style.scrollbarGutter="auto",()=>{le.style.scrollbarGutter=""}},[]);const Z=w[s][S].length,Y=`${s}/${S}/${N}`,ae=I===Y,pe=()=>q(Y),ye=U==="revealed"||ae,De=U==="click"&&!ae,Fe=(le,Pe,gt)=>{var Bi;const Jn=((Bi=b.get(le))==null?void 0:Bi.playerSlug)??null;return Qre(i,{playerSlug:Jn,seatIndex:le},Pe,gt)},tt=(le,Pe)=>Fe(s,le,Pe),st=(le,Pe)=>u(tt(le,Pe),{replace:!0}),ie=eoe(w,s,S,N),Se=BN(w,s,S,N),Ie=ie?tt(ie.pack,ie.pick):null,_e=Se?tt(Se.pack,Se.pick):null,We=()=>{ie&&st(ie.pack,ie.pick)},we=()=>
515{Se&&st(Se.pack,Se.pick)},He=le=>{F(le),q(null)},ee=le=>Se?Fe(le,S,N):Fe(le,0,0);p.useEffect(()=>{const le=Pe=>{if(L!=null||Pe.metaKey||Pe.ctrlKey||Pe.altKey||Pe.shiftKey)return;const gt=Pe.target;if(gt instanceof HTMLElement&&(gt.tagName==="INPUT"||gt.tagName==="TEXTAREA"||gt.isContentEditable))return;(Pe.key==="ArrowLeft"||Pe.key==="ArrowRight"||Pe.key===" ")&&document.activeElement instanceof HTMLElement&&document.activeElement.blur(),Pe.key==="ArrowLeft"?(Pe.preventDefault(),We()):Pe.key==="ArrowRight"?(Pe.preventDefault(),De?pe():we()):Pe.key===" "&&(Pe.preventDefault(),He(U==="revealed"?"click":"revealed"))};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[We,we,De,He,U,L]),p.useEffect(()=>{const le=BN(w,s,S,N);if(le)for(const Pe of w[s][le.pack][le.pick].booster){const gt=e.cards[Pe],Jn=vr(gt.n,gt.s??e.set,v)[0];Jn&&(new Image().src=Jn)}},[w,s,S,N,e,v]);const Q=w[s][S][N],re=Q.booster.map(le=>e.cards[le]),fe=k[s],Ee=T==="step"&&ye,qe=Ee?re[Q.takenPositions[0]]:null,Qe=(bf=e.decks)==null?void 0:bf[s],X=p.useMemo(()=>new Set((Qe==null?void 0:Qe.side)??[]),[Qe]),ke=(((Zc=Qe==null?void 0:Qe.side)==null?void 0:Zc.length)??0)>0,$e=le=>le.map(Pe=>e.cards[Pe]),Me=UN(w,s,S,N),Ue=Zae(w,s,S,N),Ve=$e(ke?Me.filter(le=>!X.has(le)):Me),ft=(ke?Ue.map(le=>le.filter(Pe=>!X.has(Pe))):Ue).map($e),Rs=ke?$e(Me.filter(le=>X.has(le))):[],zi=FN(Me.slice(-x),ke?X:noe),vs=b.get(s),Gc=!!vs&&(vs.deckScreenshotUrl!=null||((Qe==null?void 0:Qe.main.length)??0)>0),Vc=vs&&Gc?{href:ta(i,vs.displayName,vs.displayName),open:()=>$(s)}:void 0,gf=L==null?null:Kc(L);function Kc(le){const Pe=b.get(le);return Pe?{eventId:l,displayName:Pe.displayName,participantDisplayName:Pe.participantDisplayName,deckColors:Pe.deckColors,deckScreenshotUrl:Pe.deckScreenshotUrl,deckScreenshotCaption:Pe.deckScreenshotCaption,mainboard:mc(e,le),record:Pe.record}:null}const da=(s-1+y)%y,ua=(s+1)%y,To=Jae[S],qc=le=>{var Yc,yf;const Pe=UN(w,le,S,N),gt=new Set(((yf=(Yc=e.decks)==null?void 0:Yc[le])==null?void 0:yf.side)??[]),Jn=$e(Pe.filter(Hs=>!gt.has(Hs))),Bi=$e(Pe.filter(Hs=>gt.has(Hs)));return{main:Jn,board:Bi,lastPicks:FN(Pe.slice(-x),gt)}},mx=qc(da),xx=qc(s),gx=qc(ua);return n.jsx(Ine,{value:e.set,children:n.jsx(rw,{value:v,children:n.jsx(EP,{setCode:t.setCode,followKey:`${Y}/${Ee}`,followCard:qe,children:n.jsxs("div",{className:"fixed inset-0 z-50 flex select-none flex-col bg-bg text-text",children:[n.jsx(roe,{setSymbol
515:h,left:k[da],active:fe,right:k[ua],passRight:To===1,leftHref:ee(da),rightHref:ee(ua),backHref:o,scrollOn:T==="scroll",onToggleScroll:()=>_(C==="scroll"?"step":"scroll"),showGrades:B,onToggleGrades:()=>D(le=>!le),solo:f}),n.jsx(ooe,{left:k[da],active:fe,right:k[ua],passRight:To===1,leftHref:ee(da),rightHref:ee(ua),setSymbol:h,eventTitle:m,backHref:o,pack:S,pick:N,turns:Z,perTurn:x,jumpHref:tt,prevHref:Ie,nextHref:_e,awaitingReveal:De,onReveal:pe,revealMode:U,onRevealMode:He,showGrades:B,onToggleGrades:()=>D(le=>!le),showTable:E,onToggleTable:()=>A(le=>!le),viewMode:T,onViewMode:_,solo:f}),n.jsxs("div",{className:"relative flex min-h-0 flex-1",children:[n.jsx("section",{className:"relative flex min-w-0 flex-1 flex-col",children:T==="scroll"?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"absolute right-2 top-1 z-20 lg:hidden",children:n.jsx(Yp,{label:"PICKS",ariaLabel:"Show picks",on:U==="revealed",onToggle:()=>He(U==="revealed"?"click":"revealed")})}),n.jsx(hoe,{packs:w[s],cards:e.cards,perTurn:x,revealMode:U,showGrades:B,initialPack:S,initialPick:N,onActivePick:(le,Pe)=>{(le!==S||Pe!==N)&&st(le,Pe)}},s)]}):n.jsxs(n.Fragment,{children:[n.jsx(uoe,{cards:re,pickedPositions:ye?Q.takenPositions:[],showGrades:B,fadeKey:`${s}-${S}-${N}`,onNaturalHeight:W}),n.jsx(Ioe,{pack:S,pick:N,perTurn:x,jumpHref:tt,prevHref:Ie,nextHref:_e,awaitingReveal:De,onReveal:pe,revealMode:U,onRevealMode:He}),n.jsx(voe,{cards:Ve,rows:ft,sideboard:Rs,lastPicks:zi,deckLayout:P,onToggleDeckLayout:()=>M(le=>le==="order"?"columns":"order"),canSplit:ke,splitSideboard:O,onToggleSplit:()=>H(le=>!le),deckLink:Vc})]})}),!f&&n.jsx("aside",{className:j("relative hidden shrink-0 overflow-hidden bg-surface/40 transition-[width] duration-200 lg:block",E?"w-[300px] border-l border-border":"w-0"),children:n.jsx("div",{className:"h-full w-[300px]",children:n.jsx(Woe,{seats:k,activeSeat:s,seatHref:ee,passRight:To===1})})})]}),T==="step"&&n.jsx(woe,{defaultHeight:J,activeName:fe.name,activeAvatarUrl:fe.avatarUrl,cards:Ve,rows:ft,sideboard:Rs,lastPicks:zi,deckLayout:P,onToggleDeckLayout:()=>M(le=>le==="order"?"columns":"order"),canSplit:ke,splitSideboard:O,onToggleSplit:()=>H(le=>!le),deckLink:Vc,left:k[da],right:k[ua],passRight:To===1,leftPile:mx,centerPile:xx,rightPile:gx}),gf&&n.jsx(Fc,{participant:gf,hideDraftLog:!0,cardImages:v,onClose:()=>$(null),onPrev:()=>$(le=>le==null?le:(le-1+y)%y),onNext:()=>$(le=>le==null?le:(le+1)%y)})]})})})})}function BN(e,t,s,r){return r+1<e[t][s].length?{pack:s,pick:r+1}:s<2?{pack:s+1,pick:0}:null}const eoe=(e,t,s,r)=>r>0?{pack:s,pick:r-1}:s>0?{pack:s-1,pick:e[t][s-1].length-1}:null,toe=1024;function soe(){return typeof window>"u"?"step":window.innerWidth<toe?"scroll":"step"}function Rg(e,t){const[s,r]=p.useState(()=>typeof window>"u"?t:window.localStorage.getItem(e)??t);return p.useEffect(()=>{window.localStorage.setItem(e,s)},[e,s]),[s,r]}function Ag(e,t){const[s,r]=p.useState(()=>{if(typeof window>"u")return t;const a=window.localStorage.getItem(e);return a==null?t:a==="1"});return p.useEffect(()=>{window.localStorage.setItem(e,s?"1":"0")},[e,s]),[s,r]}const kO={main:0,side:0},noe=new Set;function FN(e,t){let s=0,r=0;for(const a of e)t.has(a)?r+=1:s+=1;return{main:s,side:r}}function Au(e,t){const s=[];for(let r=Math.max(0,e-t);r<e;r++)s.push(r);return s}function mw(e,t){return t===1?String(e+1):`${e*t+1}-${e*t+t}`}function SO({src:e,className:t}){return n.jsx("img",{src:e,alt:"",className:t,onError:s=>{const r=s.currentTarget;r.dataset.fallback!=="1"&&(r.dataset.fallback="1",r.src="/set-symbols/cube.png")}})}function roe({setSymbol:e,left:t,active:s,right:r,passRight:a,leftHref:o,rightHref:i,backHref:l,scrollOn:c,onToggleScroll:d,showGrades:u,onToggleGrades:f,solo:h=!1}){return n.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-border bg-surface px-2 lg:hidden",children:[n.jsxs(te,{to:l,"aria-label":"Back to pod",className:"flex shrink-0 items-center gap-1 text-subtle [-webkit-tap-highlight-color:transparent] active:text-text",children:[n.jsx(Ba,{dir:"left"}),n.jsx(SO,{src:e,className:"h-5 w-5"})]}),n.jsx(NO,{left:t,active:s,right:r,passRight:a,leftHref:o,rightHref:i,solo:h,size:"mobile"}),n.jsx(Yp,{label:"GRADES",ariaLabel:"Show grades",on:u,onToggle:f}),!h&&n.jsx(Yp,{label:"SCROLL",ariaLabel:"Scroll the whole draft",on:c,onToggle:d})]})}const aoe={mobile:{neighbor:"max-w-[78px] text-[13px]",arrow:"text-[13px]",active:"max-w-[96px] text-[15px]"},desktop:{neighbor:"max-w-[180px] text-[16px] hover:text-text",arrow:"text-[16px]",active:"max-w-[240px] text-[19px]"}};function NO({left:e,active:t,right:s,passRight:r,leftHref:a,rightHref:o,solo:i,size:l}){const c=aoe[l],d=n.jsx("span",{className:j("shrink-0 font-mono text-subtle",c.arrow),children:r?"»":"«"}),u=j("truncate font-display tracking-[0.04em] text-subtle no-underline transition-colors","[-webkit-tap-highlight-color:transparent] active:text-text",c.neighbor);return n.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-center gap-1.5",children:[!i&&n.jsxs(n.Fragment,{children:[n.jsx(te,{to:a,replace:!0,className:u,children:e.name}),d]}),n.jsx("span",{className:j("shrink truncate text-center font-display tracking-[0.06em] text-green",c.active),children:t.name}),!i&&n.jsxs(n.Fragment,{children:[d,n.jsx(te,{to:o,replace:!0,className:u,children:s.name})]})]})}function Yp({label:e,on:t,onToggle:s,ariaLabel:r}){return n.jsxs("button",{onClick:s,role:"switch","aria-checked":t,"aria-label":r,className:"flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-border bg-surface2 px-2 [-webkit-tap-highlight-color:transparent] active:bg-white/10",children:[n.jsx("span",{className:j("font-display text-[10px] tracking-[0.1em]",t?"text-green":"text-subtle"),children:e}),n.jsx("span",{className:j("relative h-3.5 w-6 rounded-full transition-colors",t?"bg-green":"bg-border2"),children:n.jsx("span",{className:j("absolute top-[2px] h-2.5 w-2.5 rounded-full bg-white transition-all",t?"left-[11px]":"left-[2px]")})})]})}function ooe({left:e,active:t,right:s,passRight:r,leftHref:a,rightHref:o,setSymbol
515:i,eventTitle:l,backHref:c,pack:d,pick:u,turns:f,perTurn:h,jumpHref:m,prevHref:y,nextHref:b,awaitingReveal:w,onReveal:x,revealMode:g,onRevealMode:v,showGrades:k,onToggleGrades:S,showTable:N,onToggleTable:C,viewMode:_,onViewMode:T,solo:E=!1}){const A=w?n.jsx(Ne,{label:"Reveal picked card",side:"bottom",children:n.jsxs("button",{onClick:x,"aria-label":"Reveal picked card",className:"flex h-9 w-9 items-center justify-center gap-1.5 rounded-md border border-white/40 bg-surface2 font-display min-[1500px]:w-auto min-[1500px]:min-w-[84px] min-[1500px]:px-3 text-[13px] tracking-[0.12em] text-text transition-[transform,background-color,border-color,color] duration-150 ease-out touch-manipulation [-webkit-tap-highlight-color:transparent] hover:border-white/60 hover:bg-white/10 active:scale-90 active:bg-white/20 motion-reduce:active:scale-100",children:[n.jsx("span",{className:"hidden min-[1500px]:inline",children:"REVEAL"}),n.jsx(AO,{off:!1})]})}):n.jsx(ZN,{dir:"next",href:b}),P=p.useRef(null);p.useEffect(()=>{var U,F;(F=(U=P.current)==null?void 0:U.querySelector("[aria-current]"))==null||F.scrollIntoView({block:"nearest",inline:"nearest"})},[d,u,_]);const M=n.jsx(ioe,{showPicks:g==="revealed",onToggle:()=>v(g==="revealed"?"click":"revealed")});return n.jsxs("header",{...TP,className:"hidden h-[60px] shrink-0 items-center gap-3 border-b border-border bg-surface px-5 lg:flex",children:[n.jsx("div",{className:"flex min-w-[54px] flex-1 items-center",children:n.jsxs(te,{to:c,className:"flex min-w-0 items-center gap-2.5 text-left transition-colors hover:text-green","aria-label":"Back to pod",children:[n.jsx(Ba,{dir:"left"}),n.jsx(SO,{src:i,className:"h-7 w-7 shrink-0"}),n.jsx("span",{className:"truncate font-display text-[19px] tracking-[0.08em]",children:Si(l)})]})}),_==="step"&&n.jsxs("div",{className:"flex min-w-0 items-center gap-3 min-[1500px]:gap-5",children:[n.jsx(WN,{label:"PACK",children:[0,1,2].map(U=>n.jsx(HN,{active:U===d,href:m(U,0),children:U+1},U))}),n.jsx(WN,{label:"PICK",chipsRef:P,children:Array.from({length:f},(U,F)=>n.jsx(HN,{active:F===u,href:m(d,F),children:mw(F,h)},F))}),n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(ZN,{dir:"prev",href:y}),A]})]}),_==="scroll"&&n.jsx(NO,{left:e,active:t,right:s,passRight:r,leftHref:a,rightHref:o,solo:E,size:"desktop"}),n.jsxs("div",{className:"flex min-w-max flex-1 items-center justify-end gap-2",children:[M,n.jsx(Pu,{label:"GRADES",on:k,onToggle:S,ariaLabel:"Show grades",tooltip:k?"Hide 17Lands grades on the packs":"Show 17Lands grades on the packs"}),!E&&n.jsx(coe,{on:_==="scroll",onToggle:()=>T(_==="scroll"?"step":"scroll")}),!E&&n.jsx(Pu,{label:"TABLE",on:N,onToggle:C,ariaLabel:"Show table",tooltip:N?"Hide table":"Show table"}),n.jsx(te,{to:c,"aria-label":"Close",className:"flex h-9 w-9 items-center justify-center rounded-md border border-border bg-surface2 text-muted no-underline transition-colors hover:border-white/40 hover:bg-white/10 hover:text-text",children:"✕"})]})]})}function Pu({label:e,on:t,onToggle:s,tooltip:r,ariaLabel:a,block:o=!1,disabled:i=!1}){const[l,c]=p.useState(!1);return n.jsx(Ne,{label:r,side:o?"left":"bottom",open:l&&!i,children:n.jsxs("button",{onClick:s,onPointerEnter:d=>d.pointerType==="mouse"&&c(!0),onPointerLeave:()=>c(!1),disabled:i,role:"switch","aria-checked":t,"aria-label":a,className:j("flex h-9 items-center gap-2 rounded-md border border-border bg-surface2 px-2.5 transition-colors [-webkit-tap-highlight-color:transparent]",i?"cursor-not-allowed opacity-40":"hover:border-white/40 hover:bg-white/10",o?"w-full justify-between":"shrink-0"),children:[n.jsx("span",{className:j("font-display text-[12px] tracking-[0.12em]",t?"text-green":"text-subtle"),children:e}),n.jsx(AA,{on:t})]})})}function ioe({showPicks:e,onToggle:t,block:s=!1}){return n.jsx(Pu,{label:"SHOW PICKS",on:e,onToggle:t,ariaLabel:"Show picks",tooltip:e?"Hide picks to guess before revealing (Space)":"Reveal picks automatically (Space)",block:s})}function loe({on:e,onToggle:t}){return n.jsx(Pu,{label:"SHOW NEIGHBORS",on:e,onToggle:t,ariaLabel:"Show neighbors",tooltip:e?"Hide Left & Right players":"Show Left & Right players"})}function coe({on:e,onToggle:t,block:s=!1}){return n.jsx(Pu,{label:"SCROLL MODE",on:e,onToggle:t,ariaLabel:"Scroll the whole draft",tooltip:e?"Whole draft in one scrollable view":"One pick at a time",block:s})}function WN({label:e,chipsRef:t,children:s}){return n.jsxs("div",{className:j("flex items-center gap-2",t?"min-w-0":"shrink-0"),children:[n.jsx("span",{className:"font-display text-[14px] tracking-[0.18em] text-subtle",children:e}),n.jsx("div",{ref:t,className:"no-scrollbar flex min-w-0 gap-1 overflow-x-auto",children:s})]})}function HN({active:e,href:t,children:s}){return n.jsx(te,{to:t,replace:!0,"aria-current":e||void 0,className:j("flex h-8 min-w-[32px] shrink-0 items-center justify-center rounded border px-2 font-display text-[16px] tracking-[0.04em] tabular-nums no-u
515nderline transition-colors",e?"border-green/60 bg-green/15 text-green":"border-border bg-surface2 text-subtle hover:border-white/40 hover:bg-white/10 hover:text-text"),children:s})}const doe=8,GN=12;function uoe({cards:e,pickedPositions:t,showGrades:s,fadeKey:r,onNaturalHeight:a}){const o=p.useRef(null);return p.useLayoutEffect(()=>{var d;const i=(d=o.current)==null?void 0:d.firstElementChild;if(!i||!a)return;const l=()=>a(i.offsetHeight+GN*2);l();const c=new ResizeObserver(l);return c.observe(i),()=>c.disconnect()},[e,a]),n.jsx("div",{ref:o,className:"themed-scrollbar min-h-0 flex-1 overflow-y-auto",style:{padding:GN},children:n.jsx("div",{className:"animate-fadeUpIn",children:n.jsx(foe,{cards:e,pickedPositions:t,showGrades:s})},r)})}function foe({cards:e,pickedPositions:t,showGrades:s}){return n.jsx("div",{className:"flex flex-wrap content-start justify-center",style:{gap:doe},children:e.map((r,a)=>n.jsx("div",{className:"w-[calc((100%-16px)/3)] sm:w-[calc((100%-24px)/4)] lg:w-[210px]",children:n.jsx(CO,{card:r,picked:t.includes(a),showGrades:s})},a))})}function CO({card:e,picked:t,showGrades:s}){return n.jsxs("div",{className:j(Eu,"relative","transition-transform duration-150 hover:z-10 hover:scale-[1.04]",t&&"p0p1-card-selected z-10 scale-[1.03] hover:scale-[1.05]"),children:[n.jsx(hc,{card:e}),s&&n.jsx(Mne,{card:e})]})}function hoe({packs:e,cards:t,perTurn:s,revealMode:r,showGrades:a,initialPack:o,initialPick:i,onActivePick:l}){const c=p.useRef(null),d=p.useRef(l);return d.current=l,p.useLayoutEffect(()=>
515{const u=c.current,f=u==null?void 0:u.querySelector(`[data-pick="${o}-${i}"]`);if(!u||!(f instanceof HTMLElement))return;const h=f.getBoundingClientRect().top-u.getBoundingClientRect().top;u.scrollTop+=h-parseFloat(getComputedStyle(u).paddingTop)},[]),p.useEffect(()=>{const u=c.current;if(!u)return;const f=new IntersectionObserver(h=>{let m=null;for(const x of h)x.isIntersecting&&(!m||x.boundingClientRect.top<m.boundingClientRect.top)&&(m=x);const y=m&&m.target.dataset.pick;if(!y)return;const[b,w]=y.split("-").map(Number);d.current(b,w)},{root:u,rootMargin:"0px 0px -85% 0px",threshold:0});return u.querySelectorAll("[data-pick]").forEach(h=>f.observe(h)),()=>f.disconnect()},[]),n.jsx("div",{ref:c,className:"themed-scrollbar min-h-0 flex-1 overflow-y-auto px-3 pb-3 pt-1 lg:px-8 lg:pb-6 lg:pt-3",children:e.map((u,f)=>u.map((h,m)=>n.jsx(poe,{pack:f,pick:m,perTurn:s,view:h,cards:t,revealMode:r,showGrades:a},`${f}-${m}`)))})}function poe({pack:e,pick:t,perTurn:s,view:r,cards:a,revealMode:o,showGrades:i}){const[l,c]=p.useState(!1),d=o==="revealed"||l,u=r.booster.map(h=>a[h]),f=r.takenPositions.map(h=>{var m;return moe(((m=u[h])==null?void 0:m.n)??"")}).join(", ");return n.jsxs("section",{"data-pick":`${e}-${t}`,className:"mb-7 lg:mb-9",children:[n.jsxs("div",{className:"mb-2 flex h-9 items-center gap-3 border-b border-border lg:mb-3 lg:h-10",children:[n.jsxs("span",{className:"shrink-0 whitespace-nowrap font-display text-[15px] tracking-[0.16em] text-subtle",children:["PACK ",e+1]}),n.jsxs("span",{className:"shrink-0 whitespace-nowrap font-display text-[15px] tracking-[0.16em] text-subtle",children:["PICK ",mw(t,s)]}),d?n.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[n.jsx(Jt,{size:16,className:"shrink-0 text-subtle","aria-hidden":"true"}),n.jsx("span",{className:"truncate font-display text-[16px] tracking-[0.04em] text-green",children:f})]}):n.jsx("button",{onClick:()=>c(!0),className:"ml-1 rounded border border-border bg-surface2 px-2.5 py-1 font-display text-[12px] tracking-[0.12em] text-subtle transition-colors hover:border-white/40 hover:text-text",children:"REVEAL"})]}),n.jsx("div",{className:"grid gap-2 [grid-template-columns:repeat(auto-fill,minmax(104px,1fr))] lg:[grid-template-columns:repeat(auto-fill,minmax(148px,1fr))]",children:u.map((h,m)=>n.jsx(CO,{card:h,picked:d&&r.takenPositions.includes(m),showGrades:i},m))})]})}const moe=e=>e.split(" // ")[0],xoe=4,fh=64,goe=40;function boe(e,t){const[s,r]=p.useState(null),[a,o]=p.useState(!1);return{height:s??e,beginResize:(c,d)=>{const u=d??s??e;let f=d==null;d!=null&&r(d),o(!0);const h=b=>{const w=u-(b.clientY-c);if(w>=fh&&(f=!0),t&&f&&w<goe){t(),r(null),y();return}const x=f?fh:0;r(Math.min(window.innerHeight*.72,Math.max(x,w)))},m=()=>y();function y(){o(!1),r(b=>b!=null&&b<fh?fh:b),window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",m)}window.addEventListener("pointermove",h),window.addEventListener("pointerup",m)},dragging:a}}function yoe({open:e,canCollapse:t,onToggle:s,onResizeStart:r,children:a}){const o=i=>{if(i.button!==0)return;i.preventDefault();const l=i.clientY;let c=!1;const d=f=>{!c&&Math.abs(f.clientY-l)>xoe&&(c=!0,e?r(l):(s(),r(l,0)))},u=()=>{window.removeEventListener("pointermove",d),window.removeEventListener("pointerup",u),c||s()};window.addEventListener("pointermove",d),window.addEventListener("pointerup",u)};return t?n.jsxs("div",{onPointerDown:o,className:"group relative hidden h-10 w-full shrink-0 cursor-row-resize select-none items-center border-t border-border bg-bg transition-colors hover:bg-surface2 lg:flex",children:[n.jsx("span",{className:"absolute bottom-full left-1/2 flex -translate-x-1/2 translate-y-px items-center justify-center rounded-t-md border border-b-0 border-border bg-bg px-3 text-subtle transition-colors group-hover:bg-surface2 group-hover:text-text",children:n.jsx(Ba,{dir:e?"down":"up"})}),a]}):n.jsx("div",{className:"relative hidden h-10 w-full shrink-0 items-center border-t border-border bg-bg lg:flex",children:a})}function hh({n:e,label:t}){return e===0?null:n.jsxs("span",{className:"flex items-baseline gap-1",children:[n.jsx("span",{className:"tabular-nums text-subtle",children:e}),n.jsx("span",{className:"text-[12px] tracking-[0.1em] text-muted",children:t})]})}function voe({cards:e,rows:t,sideboard:s,lastPicks:r,deckLayout:a,onToggleDeckLayout:o,canSplit:i,splitSideboard:l,onToggleSplit:c,deckLink:d}){const u=a==="order";return n.jsxs("div",{className:"relative shrink-0 border-t border-border bg-surface/60 pb-1 pl-0 pr-1 pt-0 lg:hidden",children:[n.jsx("div",{className:"absolute bottom-2 right-2 z-20",children:n.jsx(EO,{canSplit:i,splitSideboard:l,onToggleSplit:c,deckLink:d,deckLayout:a,onToggleDeckLayout:o})}),n.jsx("div",{className:j("flex gap-1",u?"h-[24dvh]":"h-[32dvh]"),children:n.jsx(_O,{order:u,rows:t,cards:e,lastPicks:r,splitSideboard:l,sideboard:s,cardWidth:104,reveal:u?21:16,sideReveal:14,poolAlign:"right"})})]})}function _O({order:e,rows:t,cards:s,lastPicks:r,splitSideboard:a,sideboard:o,cardWidth:i,reveal:l,sideReveal:c,groupByType:d=!1,poolAlign:u}){const f=a&&o.length>0,h=f?[]:o;return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"relative min-w-0 flex-1",children:e?n.jsx($oe,{rows:t,sideboard:h,lastPicks:r,cardWidth:i,reveal:l}):n.jsx(Wh,{cards:s,sideboard:h,lastPicks:r,groupByType:d,align:u,cardWidth:i,reveal:l})}),f&&n.jsx(Doe,{cards:o,markCount:r.side,cardWidth:Math.round(i*.9),reveal:c})]})}function woe({defaultHeight:e,activeName:t,activeAvatarUrl:s,cards:r,rows:a,sideboard:o,lastPicks:i,deckLayout:l,onToggleDeckLayout:c,canSplit:d,splitSideboard:u,onToggleSplit:f,deckLink:h,left
515:m,right:y,passRight:b,leftPile:w,centerPile:x,rightPile:g}){const[v,k]=p.useState(!0),[S,N]=p.useState("deck"),C=l==="order",_=u&&o.length>0,{height:T,beginResize:E,dragging:A}=boe(e,()=>k(!1)),P=S;let M=0,U=0;for(const I of r){const q=I.type??"";/creature/i.test(q)?M++:/land/i.test(q)&&U++}const F=I=>{N(I),k(!0)};return n.jsxs("div",{className:"hidden shrink-0 flex-col lg:flex",children:[n.jsx(yoe,{open:v,canCollapse:!0,onToggle:()=>k(I=>!I),onResizeStart:E,children:n.jsx(Ooe,{activeName:t,activeAvatarUrl:s,tab:P,onTab:F,total:r.length,creatures:M,lands:U,left:m,right:y,passRight:b})}),n.jsx("div",{className:"relative shrink-0 overflow-hidden bg-surface/60",style:{height:v?T:0,transition:A?"none":"height 200ms ease"},children:P==="deck"?n.jsxs("div",{className:"relative flex h-full py-1 pl-6",children:[n.jsx("div",{className:j("absolute bottom-2 z-20",_?"right-[200px]":"right-6"),children:n.jsx(EO,{canSplit:d,splitSideboard:u,onToggleSplit:f,deckLink:h,deckLayout:l,onToggleDeckLayout:c})}),n.jsx(_O,{order:C,rows:a,cards:r,lastPicks:i,splitSideboard:u,sideboard:o,cardWidth:TO,reveal:C?koe:joe,sideReveal:Soe,groupByType:!0})]}):n.jsx(Loe,{left:w,center:x,right:g})})]})}const TO=176,joe=28,koe=44,Soe=24,Noe=1.4,Coe=.72,_oe=120,Toe=4,Eoe=60,Roe=40;function Aoe(){const[e,t]=p.useState(()=>typeof window>"u"?900:window.innerHeight);return p.useEffect(()=>{const s=()=>t(window.innerHeight);return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),e}function Poe(e,t){const s=Math.ceil(TO*Noe+rb*2+Toe*2),r=Math.min(s,e*Coe),a=e-Eoe-Roe-t;return Math.max(_oe,Math.min(r,a))}function Ooe({activeName:e,activeAvatarUrl:t,tab:s,onTab:r,total:a,creatures:o,lands:i,left:l,right:c,passRight:d}){const u=d?"»":"«";return n.jsxs("div",{className:"relative flex h-full w-full items-center font-display",children:[s==="deck"?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex w-1/2 min-w-0 items-center justify-center gap-2 text-[15px] tracking-[0.08em]",children:[n.jsx(as,{displayName:e,avatarUrl:t,size:22,green:!0}),n.jsx("span",{className:"max-w-[220px] truncate text-green",children:e})]}),n.jsxs("div",{className:"absolute left-1/2 flex -translate-x-1/2 items-center gap-3.5 text-[14px] tracking-[0.08em]",children:[n.jsx("span",{className:"tracking-[0.16em] text-subtle",children:"DECK"}),n.jsx(hh,{n:a,label:"CARDS"}),n.jsx(hh,{n:o,label:"CREATURES"}),n.jsx(hh,{n:i,label:"LANDS"}),n.jsx(hh,{n:a-o-i,label:"SPELLS"})]})]}):n.jsxs("div",{className:"flex w-full items-stretch text-[14px] tracking-[0.08em]",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-end gap-2 pr-3",children:[n.jsx(VN,{seat:l}),n.jsx("span",{className:"font-mono text-muted",children:u})]}),n.jsx("div",{className:"w-0.5 shrink-0"}),n.jsxs("div",{className:"flex min-w-0 flex-[1.7] items-center justify-center gap-2 text-[15px]",children:[n.jsx(as,{displayName:e,avatarUrl:t,size:20,green:!0}),n.jsx("span",{className:"max-w-[220px] truncate text-green",children:e})]}),n.jsx("div",{className:"w-0.5 shrink-0"}),n.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-start gap-2 pl-3",children:[n.jsx("span",{className:"font-mono text-muted",children:u}),n.jsx(VN,{seat:c})]})]}),n.jsx("span",{className:"absolute right-4 top-1/2 -translate-y-1/2",onPointerDown:f=>f.stopPropagation(),children:n.jsx(loe,{on:s==="neighbors",onToggle:()=>r(s==="neighbors"?"deck":"neighbors")})})]})}function VN({seat:e}){return n.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[n.jsx(as,{displayName:e.name,avatarUrl:e.avatarUrl,size:18}),n.jsx("span",{className:"max-w-[150px] truncate text-subtle",children:e.name})]})}function Loe({left:e,center:t,right:s}){return n.jsxs("div",{className:"flex h-full items-stretch",children:[n.jsx("div",{className:"min-w-0 flex-1 pt-2",children:n.jsx(Wh,{cards:e.main,sideboard:e.board,lastPicks:e.lastPicks,cardWidth:140,reveal:22})}),n.jsx("div",{className:"w-0.5 shrink-0 self-stretch bg-border"}),n.jsx("div",{className:"min-w-0 flex-[1.7] pt-2",children:n.jsx(Wh,{cards:t.main,sideboard:t.board,lastPicks:t.lastPicks,cardWidth:166,reveal:26})}),n.jsx("div",{className:"w-0.5 shrink-0 self-stretch bg-border"}),n.jsx("div",{className:"min-w-0 flex-1 pt-2",children:n.jsx(Wh,{cards:s.main,sideboard:s.board,lastPicks:s.lastPicks,cardWidth:140,reveal:22,align:"right"})})]})}function EO({canSplit:e,splitSideboard:t,onToggleSplit:s,deckLink:r,deckLayout:a,onToggleDeckLayout:o}){const i="flex h-7 items-center justify-center gap-1.5 rounded border px-2.5 font-display text-[11px] tracking-[0.12em] transition-colors lg:h-8 lg:rou
515nded-md lg:px-3 lg:text-[13px]",l="border-border bg-surface2 text-subtle hover:border-white/40 hover:text-text";return n.jsxs("div",{className:"flex flex-col items-stretch gap-1.5",children:[(r||e)&&n.jsxs("div",{className:"flex w-full gap-1.5",children:[r&&n.jsxs(te,{to:r.href,onClick:nx(r.open),className:j(i,l,"flex-1 no-underline"),children:["DECK",n.jsx(Gn,{size:14,"aria-hidden":"true"})]}),e&&n.jsx(Ne,{label:t?"Merge the sideboard into the deck column":"Split the sideboard into its own panel",side:"top",children:n.jsxs("button",{onClick:s,"aria-pressed":t,className:j(i,t?"border-green/60 bg-surface2 text-green [background-image:linear-gradient(rgba(46,232,92,0.15),rgba(46,232,92,0.15))]":l,"flex-1"),children:["SIDE",n.jsx(lQ,{size:15,"aria-hidden":"true"})]})})]}),n.jsx(Moe,{layout:a,onToggle:o})]})}function Doe({cards:e,markCount:t,cardWidth:s,reveal:r}){return n.jsx("div",{className:"flex shrink-0 flex-col",children:n.jsx("div",{className:"themed-scrollbar min-h-0 flex-1 overflow-y-auto overflow-x-hidden py-2 pl-0.5 pr-2",children:n.jsx(ex,{count:e.length,reveal:r,width:s,cardClassName:Xm,glowIndexes:Au(e.length,t),cardAt:a=>e[a],renderCard:a=>n.jsx(hc,{card:e[a]})})})})}function Ioe({pack:e,pick:t,perTurn:s,jumpHref:r,prevHref:a,nextHref:o,awaitingReveal:i,onReveal:l,revealMode:c,onRevealMode:d}){const u="flex h-8 w-8 shrink-0 items-center justify-center rounded-md border transition-[transform,background-color,border-color,color] duration-150 ease-out touch-manipulation [-webkit-tap-highlight-color:transparent]",f="border-white/40 bg-surface2 text-text active:scale-90 active:bg-white/20 motion-reduce:active:scale-100",h="border-border text-dim opacity-40";return n.jsxs("div",{...TP,className:"flex h-12 shrink-0 items-center justify-between gap-1.5 border-t border-border bg-surface px-2 lg:hidden",children:[n.jsx("div",{className:"flex gap-1",children:[0,1,2].map(m=>n.jsx(te,{to:r(m,0),replace:!0,"aria-current":m===e||void 0,className:j("flex h-8 min-w-[30px] items-center justify-center rounded border px-1.5 font-display text-[15px] tracking-[0.04em] tabular-nums no-underline transition-colors",m===e?"border-green/60 bg-green/15 text-green":"border-border bg-surface2 text-subtle hover:border-white/40 hover:bg-white/10 hover:text-text"),children:m+1},m))}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[a?n.jsx(te,{to:a,replace:!0,"aria-label":"Previous pick",className:j(u,f),children:n.jsx(Ba,{dir:"left"})}):n.jsx("button",{disabled:!0,"aria-label":"Previous pick",className:j(u,h),children:n.jsx(Ba,{dir:"left"})}),n.jsxs("span",{className:"min-w-[56px] text-center font-display text-[17px] tracking-[0.06em] text-text",children:["P",e+1,"P",mw(t,s)]}),i?n.jsx("button",{onClick:l,"aria-label":"Reveal picked card",className:j(u,f),children:n.jsx(AO,{off:!1})}):o?n.jsx(te,{to:o,replace:!0,"aria-label":"Next pick",className:j(u,f),children:n.jsx(Ba,{dir:"right"})}):n.jsx("button",{disabled:!0,"aria-label":"Next pick",className:j(u,h),children:n.jsx(Ba,{dir:"right"})})]}),n.jsx(Yp,{label:"PICKS",ariaLabel:"Show picks",on:c==="revealed",onToggle:()=>d(c==="revealed"?"click":"revealed")})]})}function Moe({layout:e,onToggle:t}){return n.jsxs("div",{className:"flex w-full rounded border border-border bg-surface2 p-0.5 font-display text-[10px] tracking-[0.1em] lg:rounded-md lg:p-1 lg:text-[13px] lg:tracking-[0.12em]",children:[n.jsx("button",{onClick:()=>e!=="columns"&&t(),className:j("flex-1 rounded px-2 py-1 text-center lg:px-3.5 lg:py-1.5",e==="columns"?"bg-green/15 text-green":"text-muted hover:text-subtle"),children:"CURVE"}),n.jsx("button",{onClick:()=>e!=="order"&&t(),className:j("flex-1 rounded px-2 py-1 text-center lg:px-3.5 lg:py-1.5",e==="order"?"bg-green/15 text-green":"text-muted hover:text-subtle"),children:"ORDER"})]})}function $oe({rows:e,sideboard:t=[],lastPicks:s=kO,cardWidth:r,reveal:a}){const o=e.reduce((d,u)=>Math.max(d,u.length),0);let i=-1;for(let d=0;d<e.length;d++)e[d].length>0&&(i=d);const l=i>=0?Au(e[i].length,s.main):[],c=Au(t.length,s.side);return n.jsxs("div",{className:"themed-scrollbar flex h-full items-start gap-1 overflow-x-auto px-2 py-2",children:[Array.from({length:o},(d,u)=>{const f=e.map((h,m)=>({card:h[u],ri:m})).filter(h=>h.card);return n.jsx("div",{className:"relative shrink-0",style:{width:r,height:Math.max(0,f.length-1)*a+r*1.4}
515,children:f.map(({card:h,ri:m},y)=>n.jsx("div",{className:j("absolute w-full",Eu,m===i&&l.includes(u)&&"review-last-pick z-10"),style:{top:y*a},children:n.jsx(hc,{card:h})},y))},u)}),t.length>0&&n.jsx("div",{className:"shrink-0",style:{width:Math.round(r*RO)}}),t.length>0&&n.jsx("div",{className:"relative shrink-0",style:{width:r,height:Math.max(0,t.length-1)*a+r*1.4},children:t.map((d,u)=>n.jsx("div",{className:j("absolute w-full",Eu,c.includes(u)&&"review-last-pick z-10"),style:{top:u*a},children:n.jsx(hc,{card:d})},u))})]})}const rb=8,KN=4,RO=.1;function Wh({cards:e,sideboard:t=[],lastPicks:s=kO,groupByType:r=!1,align:a="left",cardWidth:o=116,reveal:i=26}){const l=p.useRef(null),[c,d]=p.useState(0);p.useLayoutEffect(()=>{const b=l.current;if(!r||!b)return;const w=()=>d(b.clientWidth);w();const x=new ResizeObserver(w);return x.observe(b),()=>x.disconnect()},[r]);const u=(b,w,x)=>{const g=Uoe(w,x);return n.jsx(ex,{count:g.length,reveal:i,width:o,className:"shrink-0",cardClassName:Xm,glowIndexes:g.flatMap((v,k)=>x.includes(v.idx)?[k]:[]),cardAt:v=>g[v].card,renderCard:v=>n.jsx(hc,{card:g[v].card})},b)},f=e.map((b,w)=>({card:b,idx:w})),h=Au(e.length,s.main),m=Au(t.length,s.side);let y;if(r){const b=T=>/creature/i.test(T.type??""),w=T=>/land/i.test(T.type??""),x=zoe(f.filter(T=>b(T.card))),g=f.filter(T=>!b(T.card)&&w(T.card));let v=qN(f.filter(T=>!b(T.card)&&!w(T.card)));v.length>4&&(v=Boe(v));const k=Math.round(o*RO),S=g.length>0?o:k,N=t.length>0?k+o:0,C=c>0?c-rb*2:1/0,_=()=>{const T=x.length+1+v.length+(t.length>0?2:0);return(x.length+v.length)*o+S+N+Math.max(0,T-1)*KN};for(;v.length>1&&_()>C;){const T=v[v.length-1],E=v[v.length-2];v=[...v.slice(0,-2),[E[0],[...E[1],...T[1]]]]}y=n.jsxs(n.Fragment,{children:[x.map((T,E)=>u(`c${E}`,T,h)),g.length>0?u("lands",g,h):n.jsx("div",{className:"shrink-0",style:{width:k}},"land-gap"),v.map(([,T],E)=>u(`o${E}`,T,h)),t.length>0&&n.jsx("div",{className:"shrink-0",style:{width:k}},"side-gap"),t.length>0&&u("side",t.map((T,E)=>({card:T,idx:E})),m)]})}else y=n.jsxs(n.Fragment,{children:[qN(f).map(([b,w])=>u(`m${b}`,w,h)),t.length>0&&u("side",t.map((b,w)=>({card:b,idx:w})),m)]});return n.jsx("div",{ref:l,className:"themed-scrollbar h-full overflow-auto",style:{padding:rb},children:n.jsx("div",{className:j("flex w-max items-start",a==="right"&&"ml-auto"),style:{gap:KN},children:y})})}function Uoe(e,t){const s=[],r=[];for(const a of e)t.includes(a.idx)?r.push(a):s.push(a);return[...s,...r]}function zoe(e){if(e.length===0)return[];const t=new Map;let s=2,r=2;for(const o of e){const i=Math.max(0,Math.round(o.card.cmc??0));s=Math.min(s,i),r=Math.max(r,i);const l=t.get(i);l?l.push(o):t.set(i,[o])}const a=[];for(let o=s;o<=r;o++)a.push(t.get(o)??[]);return a}function Boe(e){const t=[],s=[];for(const[r,a]of e)r===1||r===2?t.push(...a):s.push([r,a]);return t.length===0?e:[[2,t],...s]}function qN(e){const t=new Map;let s=0;for(const o of e){const i=Math.max(0,Math.round(o.card.cmc??0));s=Math.max(s,i);const l=t.get(i);l?l.push(o):t.set(i,[o])}const r=[];for(let o=1;o<=s;o++){const i=t.get(o)??[];i.length!==0&&r.push([o,i])}const a=t.get(0)??[];return a.length&&r.push([0,a]),r}function Pg({dir:e}){const t={right:"",left:"rotate-180",down:"rotate-90",up:"-rotate-90"}[e];return n.jsx("span",{className:j("inline-block font-mono text-[15px] leading-none text-subtle",t),children:"»"})}function Foe(e){const t=Math.ceil(e/2),s=Math.floor(e/2),r=[];for(let a=0;a<t;a++){const o=a+1<=s?a+1:null;r.push({left:a===0?0:e-a,right:o,top:a===0,bottom:a===t-1})}return r}function Woe({seats:e,activeSeat:t,seatHref:s,passRight:r}){const a=Foe(e.length),o=r?"right":"left",i=r?"left":"right",l=r?"up":"down",c=r?"down":"up",d=20,u=f=>f==null||!e[f]?n.jsx("div",{className:"flex-1"}):n.jsx(Hoe,{seat:e[f],active:f===t,href:s(f)});return n.jsx("div",{className:"flex h-full flex-col px-1.5 py-2",children:a.map((f,h)=>n.jsxs("div",{className:"relative flex flex-1 items-stretch",children:[u(f.left),u(f.right),(f.top||f.bottom&&f.right!=null)&&n.jsx("span",{className:"pointer-events-none absolute left-1/2 top-1/2",style:{transform:`translate(-50%, calc(-50% - ${d}px))`},children:n.jsx(Pg,{dir:f.top?o:i})}),h<a.length-1&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"pointer-events-none absolute bottom-0 left-1/4 -translate-x-1/2 translate-y-1/2",children:n.jsx(Pg,{dir:l})}),a[h+1].right!=null&&n.jsx("span",{className:"pointer-events-none absolute bottom-0 left-3/4 -translate-x-1/2 translate-y-1/2",children:n.jsx(Pg,{dir:c})})]})]},h))})}function Hoe({seat:e,active:t,href:s}){return n.jsxs(te,{to:s,replace:!0,"aria-current":t||void 0,className:j("flex h-full w-full min-w-0 flex-col items-center justify-center gap-1.5 rounded-lg px-2 no-underline transition-colors",t?"bg-white/[0.06]":"hover:bg-white/[0.04]"),children:[n.jsx(as,{displayName:e.n
515ame,avatarUrl:e.avatarUrl,size:58,green:t}),n.jsx("span",{className:j("max-w-full truncate font-display text-[15px] leading-none tracking-[0.04em]",t?"text-green":"text-subtle"),children:e.name}),n.jsx(Be,{colors:e.colors,size:14})]})}function ZN({dir:e,href:t}){const s=e==="next",r=s?"Next Pick":"Previous Pick",a=s?"Next Pick (Arrow Right)":"Previous Pick (Arrow Left)",[o,i]=p.useState(!1),l=j("flex h-9 items-center justify-center rounded-md border bg-surface2",s?"w-9 gap-1.5 font-display text-[13px] tracking-[0.12em] min-[1500px]:w-auto min-[1500px]:min-w-[84px] min-[1500px]:px-3":"w-9","transition-[transform,background-color,border-color,color] duration-150 ease-out","touch-manipulation [-webkit-tap-highlight-color:transparent]",t?"border-white/40 text-text no-underline hover:border-white/60 hover:bg-white/10 active:scale-90 active:bg-white/20 motion-reduce:active:scale-100":"border-border text-dim opacity-40"),c=n.jsxs(n.Fragment,{children:[s&&n.jsx("span",{className:"hidden min-[1500px]:inline",children:"NEXT"}),n.jsx(Ba,{dir:s?"right":"left"})]}),d={onPointerEnter:u=>u.pointerType==="mouse"&&i(!0),onPointerLeave:()=>i(!1)};return n.jsx(Ne,{label:a,side:"bottom",open:o&&!!t,children:t?n.jsx(te,{to:t,replace:!0,...d,"aria-label":r,className:l,children:c}):n.jsx("button",{disabled:!0,...d,"aria-label":r,className:l,children:c})})}function Ba({dir:e}){const t={up:"M6 15l6-6 6 6",down:"M6 9l6 6 6-6",left:"M15 18l-6-6 6-6",right:"M9 6l6 6-6 6"}[e];return n.jsx("svg",{className:"shrink-0",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:t})})}function AO({off:e}){return n.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"}),e&&n.jsx("line",{x1:"3",y1:"3",x2:"21",y2:"21"})]})}const ax="[grid-template-columns:30px_1fr_70px_50px_38px] lg:[grid-template-columns:44px_1fr_80px_70px_150px]",Qp="[grid-template-columns:16px_1fr_70px_50px_38px] lg:[grid-template-columns:16px_1fr_80px_70px_150px]",Wc="pl-3 pr-3 lg:pr-5",Goe=`py-2.5 ${Wc}`,YN="[grid-template-columns:24px_1fr_66px_46px_34px] lg:[grid-template-columns:34px_1fr_74px_62px_40px]",PO={A:{bg:"bg-[#4ade80]",text:"text-[#4ade80]"},B:{bg:"bg-[#5aa9e6]",text:"text-[#5aa9e6]"}};function ho(e){const t=Number((e??"").split("-")[0]||0),s=Number((e??"").split("-")[1]||0);return{wins:t,losses:s,played:e!=null&&t+s>0}}function xw({p:e,rank:t,cols:s=ax,padX:r=Wc,compact:a=!1,dense:o=!1,iconOnly:i=!1,teamSide:l=null,selected:c=!1,trophy:d=!1,nameHref:u,rowHref:f,deckHref:h,logHref:m,onShowDeck:y,onHover:b}){const w=a?26:28,{wins:x,losses:g,played:v}=ho(e.record),k=$s(e),S=h?null:m??null,N=f??h??S,C=nx(y),_=!f&&!!h;return n.jsxs("div",{onMouseEnter:()=>b==null?void 0:b(!0),onMouseLeave:()=>b==null?void 0:b(!1),className:j("group/row relative isolate grid items-center gap-x-2 lg:gap-x-3 transition-colors",o?`py-1.5 ${r}`:a?`py-[7px] ${r}`:`py-2.5 ${r}`,s,c?"bg-green/10":"bg-surface",N&&"cursor-pointer hover:bg-surface2"),children:[N&&n.jsx(te,{to:N,state:_?gi:void 0,onClick:_?C:void 0,"aria-label":k,"aria-current":c||void 0,className:"absolute inset-0 z-10"}),n.jsx("span",{className:"font-num text-center tabular-nums text-muted text-[13px]",children:t??""}),u?n.jsx(Ne,{label:`View ${k}'s Profile`,side:"top",align:"start",delayDuration:0,children:n.jsxs(te,{to:u,className:"group/name peer/name relative z-20 flex items-center gap-2 lg:gap-2.5 min-w-0 max-w-full justify-self-start w-fit no-underline text-text hover:text-green transition-colors",children:[n.jsx(Jp,{name:k,avatarUrl:e.avatarUrl,size:w,teamSide:l}),n.jsx(XN,{name:k,compact:a}),d&&n.jsx(ct,{size:a?12:14,color:"#ffc63a",className:"shrink-0"})]})}):n.jsxs("div",{className:"flex items-center gap-2 lg:gap-2.5 min-w-0",children:[n.jsx(Jp,{name:k,avatarUrl:e.avatarUrl,size:w,teamSide:l}),n.jsx(XN,{name:k,compact:a}),d&&n.jsx(ct,{size:a?12:14,color:"#ffc63a",className:"shrink-0"})]}),n.jsx("div",{className:"flex items-center",children:e.deckColors?n.jsx(Be,{colors:F3(e.deckColors),size:OO(e.deckColors,a?13:14)}):n.jsx("span",{className:"text-dim text-[12px]",children:"—"})}),v?n.jsx(ht,{className:j("font-num text-center","text-[13px]"),wins:x,losses:g}):n.jsx("span",{className:j("font-num text-center text-dim","text-[13px]"),children:"—"}),h?n.jsxs(Ei,{to:h,onClick:C,"aria-label":a||i?"View Deck":void 0,className:j(
515QN,"relative z-20 no-underline",i&&"justify-self-end"),style:{height:o?28:a?30:34},children:[!a&&!i&&n.jsx(JN,{children:"VIEW DECK"}),n.jsx(Gn,{size:a?16:17,"aria-hidden":"true",className:"transition-colors"})]}):S?n.jsxs(te,{to:S,className:j(QN,"relative z-20 no-underline",i&&"justify-self-end"),style:{height:o?28:a?30:34},children:[!a&&!i&&n.jsx(JN,{children:"DRAFT LOG"}),n.jsx(cc,{size:a?15:16,"aria-hidden":"true",className:"transition-colors"})]}):n.jsx("span",{})]})}function Jp({name:e,avatarUrl:t,size:s,teamSide:r}){return n.jsxs("span",{className:"relative isolate shrink-0 flex",children:[r&&n.jsx("span",{"aria-hidden":"true",className:j("absolute -inset-[2px] -z-10",PO[r].bg),style:{clipPath:Xr}}),n.jsx("span",{className:"block bg-surface2",style:{clipPath:Xr},children:n.jsx(as,{displayName:e,avatarUrl:t,size:s})})]})}const QN="group/action inline-flex items-center justify-center gap-2 px-1.5 lg:px-3 whitespace-nowrap transition-colors bg-bg border border-border text-text hover:border-green/60 hover:bg-green/10 hover:text-green group-hover/row:border-green/60 group-hover/row:bg-green/10 group-hover/row:text-green peer-hover/name:!border-border peer-hover/name:!bg-bg peer-hover/name:!text-text cursor-pointer";function JN({children:e}){return n.jsx("span",{className:"hidden lg:inline font-display tracking-[0.16em] transition-colors leading-none",style:{fontSize:14},children:e})}function OO(e,t){return e.length<=3?t:e.length===4?t-2:e.length===5?t-3:t-4}function XN({name:e,compact:t=!1}){return n.jsx("span",{className:"font-display leading-none tracking-[0.04em] whitespace-nowrap overflow-hidden text-ellipsis",style:{fontSize:t?15:16},children:e.toUpperCase()})}function gw({cols:e=ax,compact:t=!1}){const s=t?26:28;return n.jsxs("div",{className:j("grid items-center gap-x-2 lg:gap-x-3 bg-surface",t?`py-[7px] ${Wc}`:Goe,e),children:[n.jsx("div",{className:"h-3 w-3 bg-surface2 animate-pulse mx-auto"}),n.jsxs("div",{className:"flex items-center gap-2 lg:gap-2.5",children:[n.jsx("div",{className:"bg-surface2 shrink-0",style:{width:s,height:s}}),n.jsx("div",{className:"h-3.5 w-32 bg-surface2 animate-pulse"})]}),n.jsx("div",{className:"h-3.5 w-14 bg-surface2 animate-pulse"}),n.jsx("div",{className:"h-3.5 w-10 bg-surface2 animate-pulse mx-auto"}),n.jsx("div",{className:"w-full bg-surface2 animate-pulse",style:{height:t?30:34}})]})}const Voe="0 0 100 122",eC="M 0 0 H 100 V 60 C 100 80, 85 100, 50 122 C 15 100, 0 80, 0 60 Z",Koe="M 3.2 3.2 H 96.8 V 60 C 96.8 77.4, 83.4 96.8, 50 117.2 C 16.6 96.8, 3.2 77.4, 3.2 60 Z",Og="M 5.2 5.2 H 94.8 V 60 C 94.8 76.4, 82.4 94.8, 50 114.2 C 17.6 94.8, 5.2 76.4, 5.2 60 Z",LO={hi:"#f4f7fc",mid:"#c6cedb",low:"#8a93a6",deep:"#535c6e",edge:"#3a4150"},qoe={hi:"#fff3cc",mid:"#ffd96e",low:"#cf9a2c",deep:"#855a12",edge:"#5a3d0c"},DO={WebkitTextStroke:"1px rgba(0,0,0,0.92)",paintOrder:"stroke",textShadow:"0 0 3px rgba(0,0,0,0.85), 0 1px 1px rgba(0,0,0,0.9)"};function ab({metal:e=LO,ring:t=null,elevated:s=!1,layer:r="full"}){const a=p.useId().replace(/:/g,""),o=r!=="border",i=r!=="base";return n.jsxs("svg",{viewBox:Voe,preserveAspectRatio:"none",className:"absolute inset-0 w-full h-full overflow-visible pointer-events-none","aria-hidden":"true",style:{filter:o?s?"drop-shadow(0 8px 14px rgba(0, 0, 0, 0.55))":"drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5))":"none"},children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:`fr-${a}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"0%",stopColor:e.hi}),n.jsx("stop",{offset:"22%",stopColor:e.mid}),n.jsx("stop",{offset:"55%",stopColor:e.low}),n.jsx("stop",{offset:"100%",stopColor:e.deep})]}),n.jsxs("linearGradient",{id:`lip-${a}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"0%",stopColor:e.hi}),n.jsx("stop",{offset:"100%",stopColor:e.low})]}),n.jsxs("linearGradient",{id:`face-${a}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"0%",stopColor:"#181d27"}),n.jsx("stop",{offset:"55%",stopColor:"#10141c"}),n.jsx("stop",{offset:"100%",stopColor:"#06080d"})]})]}),o&&n.jsxs(n.Fragment,{children:[n.jsx("path",{d:eC,fill:`url(#fr-${a})`}),n.jsx("path",{d:eC,fill:"none",stroke:e.edge,strokeWidth:1.2,vectorEffect:"non-scaling-stroke"}
515),n.jsx("path",{d:Koe,fill:"#06080d"}),n.jsx("path",{d:Og,fill:`url(#face-${a})`})]}),i&&n.jsxs(n.Fragment,{children:[n.jsx("path",{d:Og,fill:"none",stroke:`url(#lip-${a})`,strokeWidth:2,strokeOpacity:.85,vectorEffect:"non-scaling-stroke"}),t&&n.jsx("path",{d:Og,fill:"none",stroke:t,strokeWidth:2.4,vectorEffect:"non-scaling-stroke"})]})]})}const ga={w:118,h:144,nameMax:17,nameMin:10,pip:13,rec:20};function Zoe({participant:e,selected:t,highlighted:s=!1,highlightedOutcome:r=null,href:a,replace:o,scale:i=1}){const{wins:l,losses:c,played:d}=ho(e.record),u=Ly(e.record)||e.placement===1,f=Km(),h={w:ga.w*i,h:ga.h*i,nameMax:f?Math.max(ga.nameMax*i,13):ga.nameMax*i,nameMin:f?Math.max(ga.nameMin*i,10):ga.nameMin*i,pip:ga.pip*i,rec:ga.rec*i},m=u?qoe:LO,b=(t||s&&!t)&&r!=null?Qoe(t,r):null;return n.jsxs(te,{to:a,replace:o,"aria-current":t||void 0,"aria-label":`Seat ${e.seatIndex+1}: ${e.discordName}${d?`, ${e.record}`:""}`,className:j("group relative block p-0 m-0 border-0 bg-transparent cursor-pointer outline-none","transition-transform duration-300 ease-out will-change-transform",t?"-translate-y-2.5 scale-[1.04]":"hover:-translate-y-1.5 hover:scale-[1.025]"),style:{width:h.w,height:h.h},children:[n.jsx(ab,{metal:m,elevated:t,layer:"base"}),n.jsxs("div",{className:"absolute inset-0 flex flex-col items-center",style:{paddingTop:h.h*.05,paddingBottom:h.h*.14,paddingLeft:h.w*.06,paddingRight:h.w*.06},children:[n.jsx(Yoe,{displayName:e.discordName,avatarUrl:e.avatarUrl,radius:Math.max(3,6*i)}),e.deckColors&&n.jsx("div",{className:"shrink-0 z-10",style:{marginTop:-h.pip*(f?1.15:.5)},children:n.jsx(Be,{colors:e.deckColors,size:h.pip})}),n.jsx("div",{className:"flex-1 flex items-center justify-center w-full min-h-0 overflow-hidden px-0.5",children:n.jsx(Joe,{text:e.discordName,maxSize:h.nameMax,minSize:h.nameMin,maxLines:2,className:"leading-none uppercase text-text text-center"})}),d&&n.jsx("div",{className:"shrink-0 tabular-nums leading-none text-text",style:{fontSize:h.rec,letterSpacing:"0.04em",fontFamily:"'Bebas Neue', sans-serif",...DO},children:n.jsx(ht,{wins:l,losses:c,mono:!0,separatorMargin:3})})]}),n.jsx(ab,{metal:m,ring:b,layer:"border"})]})}function Yoe({displayName:e,avatarUrl:t,radius:s}){const r=e.split(/[\s\-_().]+/).filter(Boolean).map(a=>a[0]).join("").slice(0,2).toUpperCase();return n.jsx("div",{className:"relative w-full overflow-hidden shrink-0",style:{aspectRatio:"5 / 3",containerType:"inline-size",background:"radial-gradient(circle at 50% 32%, #2a3142 0%, #161b25 55%, #090c12 100%)"},children:t?n.jsx("img",{src:t,alt:e,className:"absolute inset-0 w-full h-full object-cover"}):n.jsx("span",{className:"absolute inset-0 flex items-center justify-center font-display text-muted",style:{fontSize:"44cqw",letterSpacing:"0.04em"},children:r})})}function Qoe(e,t){const s="#2ee85c",r="#ff5e5e",a="#7a849a";if(t==="skip"||t==="pending")return a;const o=t==="win";return e?o?s:r:o?r:s}function Joe({text:e,maxSize:t,minSize:s,maxLines:r=2,className:a}){const o=p.useRef(null);return p.useLayoutEffect(()=>{const i=o.current;if(!i)return;const l=i.parentElement;if(!l)return;const c=/\s/.test(e),d=()=>{const f=l.clientWidth;if(!(f<=0)&&(i.style.setProperty("-webkit-line-clamp",""),i.style.display="block",i.style.whiteSpace="nowrap",i.style.fontSize=`${t}px`,!(i.scrollWidth<=f)))if(c){i.style.whiteSpace="normal",i.style.display="-webkit-box",i.style.setProperty("-webkit-box-orient","vertical"),i.style.setProperty("-webkit-line-clamp",String(r));const h=l.clientHeight;let m=t;for(i.style.fontSize=`${m}px`;(i.scrollHeight>i.clientHeight+.5||i.scrollHeight>h+.5)&&m>s;)m-=.5,i.style.fontSize=`${m}px`}else{let h=t;for(;i.scrollWidth>f&&h>s;)h-=.5,i.style.fontSize=`${h}px`}};d();const u=new ResizeObserver(d);return u.observe(l),()=>u.disconnect()},[e,t,s,r]),n.jsx("span",{ref:o,className:a,style:{letterSpacing:"0.02em",display:"block",overflow:"hidden",textOverflow:"ellipsis",fontFamily:"'Bebas Neue', sans-serif",...DO},children:e})}const po=39,tC=34.5,sC=2*Math.PI/180,Xoe={1:-sC,6:sC},IO=640,nC={w:118,h:144};function eie({participants:e,selectedSeat:t,highlightedSeat:s=null,highlightedRound:r=null,highlightedOutcome:a=null,canViewDeck:o=()=>!0,eventLabel:i,teamDraft:l=!1,eventSlug:c,hasDraftLog:d=!1,setCode:u,formatLabel:f,date:h,maxWidth:m=720}){const y=[...e].sort((g,v)=>g.seatIndex-v.seatIndex),b=p.useRef(null),[w,x]=p.useState(1);return p.useLayoutEffect(()=>{const g=b.current;if(!g)return;const v=()=>{const S=g.clientWidth;S>0&&x(S/IO)};v();const k=new ResizeObserver(v);return k.observe(g),()=>k.disconnect()},[]),n.jsxs("div",{ref:b,className:"relative mx-auto w-full transition-[max-width] duration-500 ease-out",style:{maxWidth:m,aspectRatio:"1 / 1",containerType:"inline-size"},children:[n.jsxs("div",{className:"absolute inset-[15%] overflow-hidden rounded-full",children:[n.jsx("div",{className:"absolute inset-0",style:{background:"radial-gradient(circle at 50% 38%, #232a3a 0%, #181d28 28%, #10141c 58%, #070a0f 100%)"}}),n.jsx("div",{className:"absolute inset-0 pointer-events-none mix-blend-overlay opacity-[0.18]",style:{backgroundImage:`url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='240' height='240' filter='url(%23n)'/></svg>")`}}),n.jsx("div",{className:"absolute inset-0 pointer-events-none rounded-full",style:{boxShadow:"inset 0 0 0 1px #2a3142, inset 0 0 0 5px #0a0c10, inset 0 0 0 6px #2a3142, inset 0 60px 90px -40px rgba(0,0,0,0.85), inset 0 -60px 90px -40px rgba(0,0,0,0.85)"}})]}),n.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:n.jsx(rie,{eventLabel:i,teamDraft:l,setCode:u,formatLabel:f,date:h})}),n.jsx(nie,{seatCount:y.length}),t!=null&&s!=null&&r!=null&&t!==s&&n.jsx(sie,{fromSeat:t,toSeat:s,seatCount:y.length,round:r,outcome:a}),y.map(g=>{const v=g.seatIndex/y.length*Math.PI*2-Math.PI/2,k=50+Math.cos(v)*po,S=50+Math.sin(v)*po,N=t===g.seatIndex;return n.jsxs("div",{children:[n.jsx("div",{className:"absolute",style:{left:`${k}%`,top:`${S}%`,transform:"translate(-50%, -50%)"},children:n.jsx(Zoe,{participant:g,selected:N,highlighted:!N&&s===g.seatIndex,highlightedOutcome:a,href:wr(c,N?null:g.discordName),replace:t!=null,
515scale:w})}),N&&n.jsx(tie,{angle:v,participant:g,eventSlug:c,hasDraftLog:d,canViewDeck:o(g.avatarUrl),scale:w})]},g.displayName)})]})}function tie({angle:e,participant:t,eventSlug:s,hasDraftLog:r,canViewDeck:a,scale:o}){const i=a&&(!!t.deckScreenshotUrl||!!t.hasDeckList),l=r&&a?sa(s,t):null,c=l!==null;if(!i&&!c)return null;const d=50+Math.cos(e)*po,u=50+Math.sin(e)*po,f=14.5,h=-3,m=d+f,y=u+h,b=Math.max(38,44*o);return n.jsx("div",{className:"absolute z-30 animate-fadeIn",style:{left:`${m}%`,top:`${y}%`,transform:"translate(-50%, -50%)"},children:n.jsxs("div",{className:"flex flex-col gap-2",children:[i&&n.jsx(Ne,{label:"View Deck",side:"right",children:n.jsx(Ei,{to:ta(s,t.discordName,t.discordName),"aria-label":"View Deck",className:"group flex items-center justify-center rounded-full bg-bg border border-border hover:border-green/60 hover:bg-green/10 transition-colors cursor-pointer no-underline shadow-[0_4px_10px_rgba(0,0,0,0.55)]",style:{width:b,height:b},children:n.jsx(Gn,{size:Math.round(b*.46),"aria-hidden":"true",className:"text-text group-hover:text-green transition-colors"})})}),c&&n.jsx(Ne,{label:"View Draft Log",side:"right",children:n.jsx(te,{to:l,"aria-label":"View Draft Log",className:"group flex items-center justify-center rounded-full bg-bg border border-border hover:border-green/60 hover:bg-green/10 transition-colors no-underline shadow-[0_4px_10px_rgba(0,0,0,0.55)]",style:{width:b,height:b},children:n.jsx(cc,{size:Math.round(b*.46),"aria-hidden":"true",className:"text-text group-hover:text-green transition-colors"})})})]})})}function sie({fromSeat:e,toSeat:t,seatCount:s,round:r,outcome:a}){const o=f=>{const h=f/s*Math.PI*2-Math.PI/2;return{x:50+Math.cos(h)*po,y:50+Math.sin(h)*po}},i=o(e),l=o(t),c={x:(i.x+l.x)/2,y:(i.y+l.y)/2},d=a==="skip"||a==="pending"?"text-muted":a==="loss"?"text-red":"text-green",u=a==="skip"||a==="pending"?"border-border":a==="loss"?"border-red/60":"border-green/60";return n.jsxs(n.Fragment,{children:[n.jsxs("svg",{className:j("absolute inset-0 w-full h-full pointer-events-none",d),viewBox:"0 0 100 100","aria-hidden":"true",children:[n.jsx("line",{x1:i.x,y1:i.y,x2:l.x,y2:l.y,stroke:"currentColor",strokeOpacity:"0.22",strokeWidth:"2.4",strokeLinecap:"round"}),n.jsx("line",{x1:i.x,y1:i.y,x2:l.x,y2:l.y,stroke:"currentColor",strokeOpacity:"0.95",strokeWidth:"0.55",strokeLinecap:"round"})]}),r!=null&&n.jsxs("div",{className:j("absolute pointer-events-none font-display bg-bg border leading-none",d,u),style:{left:`${c.x}%`,top:`${c.y}%`,transform:"translate(-50%, -50%)",padding:"0.55cqw 0.9cqw",fontSize:"2.2cqw",letterSpacing:"0.18em",zIndex:20},children:["R",r]})]})}function nie({seatCount:e}){return n.jsx(n.Fragment,{children:Array.from({length:e},(t,s)=>{const r=(s+.5)/e*Math.PI*2-Math.PI/2+(Xoe[s]??0),a=50+Math.cos(r)*tC,o=50+Math.sin(r)*tC,i=r*180/Math.PI+90;return n.jsx("div",{className:"absolute pointer-events-none",style:{left:`${a}%`,top:`${o}%`,width:"3.2cqw",height:"3.2cqw",transform:`translate(-50%, -50%) rotate(${i}deg)`}
515,children:n.jsx(YY,{className:"w-full h-full text-[#c4ccdb] opacity-75",strokeWidth:2.5,"aria-hidden":"true"})},s)})})}function rie({eventLabel:e,teamDraft:t=!1,setCode:s,formatLabel:r,date:a}){const{weekday:o,date:i}=iie(a),l=aie(e),c=Qt({code:s,custom:r!=null}),d=oie(r??s);return n.jsxs("div",{className:"flex flex-col items-center justify-center text-center select-none",style:{gap:"2.2cqw"},children:[n.jsxs("div",{className:"flex flex-col items-center",style:{gap:"1cqw"},children:[n.jsx("div",{className:"font-display text-text leading-none px-2",style:{fontSize:l,letterSpacing:"0.02em"},children:Si(e)}),t&&n.jsx("div",{className:"font-display text-muted leading-none",style:{fontSize:"3cqw",letterSpacing:"0.28em"},children:"TEAM DRAFT"})]}),n.jsxs("div",{className:"flex items-center",style:{gap:"2.2cqw"},children:[n.jsx(Ae,{code:c,size:d.glyphSize,className:"text-white"}),n.jsx("span",{className:"font-display text-text",style:{fontSize:d.fontSize,letterSpacing:d.letterSpacing},children:r??s})]}),n.jsxs("div",{className:"flex items-center justify-center font-display text-muted",style:{fontSize:"2.2cqw",letterSpacing:"0.32em",gap:"1.6cqw"},children:[n.jsx("span",{children:o}),n.jsx("span",{children:i})]})]})}function aie(e){const t=e.length;return t<=6?"11cqw":t<=10?"9cqw":t<=14?"7cqw":t<=18?"5.5cqw":"4.5cqw"}function oie(e){const t=e.length;return t<=12?{fontSize:"5.2cqw",letterSpacing:"0.24em",glyphSize:"8cqw"}:t<=18?{fontSize:"4.2cqw",letterSpacing:"0.16em",glyphSize:"6.4cqw"}:{fontSize:"3.4cqw",letterSpacing:"0.12em",glyphSize:"5.2cqw"}}function iie(e){const t=new Date(e+"T00:00:00Z"),s=t.toLocaleString("en-US",{weekday:"short",timeZone:"UTC"}).toUpperCase(),r=t.toLocaleString("en-US",{month:"long",timeZone:"UTC"}).toUpperCase();return{weekday:s,date:`${r} ${t.getUTCDate()}, ${t.getUTCFullYear()}`}}function rC({seatCount:e=8,maxWidth:t=720}){const s=p.useRef(null),[r,a]=p.useState(1);p.useLayoutEffect(()=>{const l=s.current;if(!l)return;const c=()=>{const u=l.clientWidth;u>0&&a(u/IO)};c();const d=new ResizeObserver(c);return d.observe(l),()=>d.disconnect()},[]);const o=nC.w*r,i=nC.h*r;return n.jsxs("div",{ref:s,className:"relative mx-auto w-full",style:{maxWidth:t,aspectRatio:"1 / 1",containerType:"inline-size"},children:[n.jsxs("div",{className:"absolute inset-[15%] overflow-hidden rounded-full",children:[n.jsx("div",{className:"absolute inset-0",style:{background:"radial-gradient(circle at 50% 38%, #232a3a 0%, #181d28 28%, #10141c 58%, #070a0f 100%)"}}),n.jsx("div",{className:"absolute inset-0 pointer-events-none rounded-full",style:{boxShadow:"inset 0 0 0 1px #2a3142, inset 0 0 0 5px #0a0c10, inset 0 0 0 6px #2a3142, inset 0 60px 90px -40px rgba(0,0,0,0.85), inset 0 -60px 90px -40px rgba(0,0,0,0.85)"}})]}),Array.from({length:e},(l,c)=>{const d=c/e*Math.PI*2-Math.PI/2,u=50+Math.cos(d)*po,f=50+Math.sin(d)*po;return n.jsx("div",{className:"absolute animate-pulse",style:{left:`${u}%`,top:`${f}%`,transform:"translate(-50%, -50%)",width:o,height:i},children:n.jsx(ab,{})},c)})]})}const lie="(skipped)",cie="bye";function MO({participant:e,participantsBySeatName:t,matches:s,replays:r,setCode:a,eventSlug:o,hasDraftLog:i,canViewSeat:l=()=>!0,podFinalized:c=!0,onRoundHover:d,isMock:u=!1}){const f=l(e.avatarUrl),h=Dy(e),m=s.filter(x=>x.playerAName===h||x.playerBName===h).sort((x,g)=>x.round-g.round),y=x=>x?Gt(x,a):null,b=i&&f?sa(o,e):null,w=x=>ta(o,e.discordName,x.discordName);return n.jsxs("div",{className:"flex flex-col min-h-0 flex-1",children:[n.jsx(uie,{participant:e,profileHref:y(e.playerSlug),draftLogHref:b,deckHidden:!u&&!f,deckHref:w(e),cardPoolHref:f?ta(o,e.discordName,e.discordName,"decklist"):null,isMock:u}),n.jsx("div",{className:"flex flex-col flex-1 min-h-0 overflow-y-auto themed-scrollbar",children:u?n.jsx(die,{participant:e,deckHref:f?w(e):null}):m.map(x=>{const g=x.playerAName===h?x.playerBName:x.playerAName,v=t.get(g);return n.jsx(hie,{match:x,participant:e,opponentName:g,opponent:v,opponentHref:y(v==null?void 0:v.playerSlug),replays:r,canViewOpponentDeck:l(v==null?void 0:v.avatarUrl),podFinalized:c,onHover:d,opponentDeckHref:v?w(v):null},x.round)})})]})}function die({participant:e,deckHref:t}){const{url:s,resolving:r}=YP({deckScreenshotUrl:e.deckScreenshotUrl,eventId:e.eventId,displayName:e.discordName,participantDisplayName:e.displayName});if(!e.deckScreenshotUrl)return n.jsx("div",{className:"px-4 md:px-5 xl:px-8 py-10 text-muted font-body text-[13px]",children:"No deck screenshot posted yet."});const a=r||!s?n.jsx("div",{className:"w-full min-h-[240px] bg-surface2 animate-pulse"}):n.jsx("img",{src:s,alt:`${e.discordName}'s deck`,className:"block w-full h-auto"});return n.jsxs(n.Fragment,{children:[t?n.jsx(Ei,{to:t,className:"block w-full p-0 m-0 border-0 bg-transparent cursor-zoom-in","aria-label":`${e.discordName}'s deck — click to enlarge`,children:a}):a,e.deckScreenshotCaption&&n.jsx("div",{className:"px-4 md:px-5 xl:px-8 py-3 border-t border-border text-muted font-body text-[13px]",children:e.deckScreenshotCaption})]})}function uie({participant:e,profileHref:t,draftLogHref:s,deckHidden:r=!1,deckHref:a,cardPoolHref:o,isMock:i=!1}
515){const l=Mc(),c=Km(),{wins:d,losses:u,played:f}=ho(e.record),h=Ly(e.record),m=h||e.placement===1,y=e.deckScreenshotUrl!==null||!!e.hasDeckList,b=c?24:l?28:32,w=t?n.jsx(te,{to:t,target:"_blank",rel:"noreferrer noopener",className:"self-start max-w-full no-underline font-display leading-none truncate text-text hover:text-green transition-colors",style:{fontSize:b,letterSpacing:"0.04em"},children:e.discordName}):n.jsx("span",{className:"self-start max-w-full font-display leading-none truncate text-text",style:{fontSize:b,letterSpacing:"0.04em"},children:e.discordName}),x=h?"Champion":e.placement!=null?`${fie(e.placement)} place`:null,g=n.jsxs("div",{className:"flex items-baseline gap-2.5 lg:gap-4 flex-wrap text-muted",style:{fontSize:16},children:[(e.deckColors||f)&&n.jsxs("span",{className:"inline-flex items-center gap-2 self-center",children:[e.deckColors&&n.jsx(Be,{colors:e.deckColors,size:16}),f&&n.jsx("span",{className:"font-display tabular-nums whitespace-nowrap text-text",style:{letterSpacing:"0.08em"},children:n.jsx(ht,{wins:d,losses:u,mono:!0,separatorMargin:3})})]}),x&&n.jsx("span",{className:j("font-display tracking-[0.16em] uppercase whitespace-nowrap",m?"text-green":"text-muted"),children:x})]});return l?n.jsxs("header",{className:j("shrink-0 flex flex-col gap-3 px-4 py-4 md:px-5 md:py-5 border-b border-border",c&&"py-4 md:py-4"),children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx(as,{displayName:e.discordName,avatarUrl:e.avatarUrl,size:c?44:52,green:m}),n.jsx("div",{className:"min-w-0 flex-1 flex items-start justify-between gap-3",children:n.jsxs("div",{className:"min-w-0 flex flex-col gap-2",children:[w,g]})})]}),n.jsx("div",{className:"flex items-center gap-2",children:r?n.jsx(aC,{variant:"mobile"}):n.jsxs(n.Fragment,{children:[!i&&(y?n.jsxs(Ei,{to:a,className:"inline-flex items-center justify-center gap-2 bg-bg border border-border hover:border-green/60 hover:bg-green/10 hover:text-green text-text font-display tracking-[0.14em] px-4 cursor-pointer transition-colors no-underline flex-1",style:{fontSize:14,height:38},children:[n.jsx("span",{children:"VIEW DECK"}),n.jsx(Gn,{size:16,"aria-hidden":"true"})]}):n.jsxs("span",{className:"inline-flex items-center justify-center gap-2 bg-bg border border-border text-dim font-display tracking-[0.14em] px-4 cursor-not-allowed flex-1",style:{fontSize:14,height:38},title:"No deck screenshot available",children:[n.jsx("span",{children:"DECK MISSING"}),n.jsx(Gn,{size:16,"aria-hidden":"true"})]})),n.jsx(oC,{internalHref:s,variant:"mobile"}),i&&e.hasDeckList&&o&&n.jsx(iC,{href:o,variant:"mobile"})]})})]}):n.jsxs("header",{className:"shrink-0 flex items-center gap-4 px-4 md:px-5 xl:px-8 py-5 border-b border-border",children:[n.jsx(as,{displayName:e.discordName,avatarUrl:e.avatarUrl,size:54,green:m}),n.jsxs("div",{className:"min-w-0 flex-1 flex flex-col gap-2",children:[w,g]}),n.jsx("div",{className:"flex flex-col gap-2 shrink-0 min-w-[200px]",children:r?n.jsx(aC,{variant:"desktop"}):n.jsxs(n.Fragment,{children:[!i&&(y?n.jsxs(Ei,{to:a,className:"inline-flex items-center justify-end gap-5 bg-bg border border-border hover:border-green/60 hover:bg-green/10 hover:text-green text-text font-display tracking-[0.12em] px-5 cursor-pointer transition-colors no-underline leading-none",style:{fontSize:17,height:44,paddingTop:2},children:[n.jsx("span",{children:"VIEW DECK"}),n.jsx(Gn,{size:20,"aria-hidden":"true"})]}):n.jsxs("span",{className:"inline-flex items-center justify-end gap-5 bg-bg border border-border text-dim font-display tracking-[0.12em] px-5 cursor-not-allowed leading-none",style:{fontSize:17,height:44,paddingTop:2},title:"No deck screenshot available",children:[n.jsx("span",{children:"DECK MISSING"}),n.jsx(Gn,{size:20,"aria-hidden":"true"})]})),n.jsx(oC,{internalHref:s,variant:"desktop"}),i&&e.hasDeckList&&o&&n.jsx(iC,{href:o,variant:"desktop"})]})})]})}function aC({variant:e}){const t=e==="mobile",s=t?"inline-flex items-center justify-center gap-2 font-display tracking-[0.14em] px-4 flex-1":"inline-flex items-center justify-end gap-3 font-display tracking-[0.12em] px-5 leading-none",r=t?{fontSize:13,height:38}:{fontSize:15,height:44,paddingTop:2};return n.jsxs("span",{className:j(s,"bg-bg border border-border text-dim cursor-not-allowed text-center"),style:r,title:"Decklists open once the pod finishes",children:[n.jsx(JY,{size:t?14:16,"aria-hidden":"true"}),n.jsx("span",{children:t?"HIDDEN":"HIDDEN UNTIL FINISH"})]})}function oC({internalHref:e,variant:t}){const s=t==="mobile",r=s?"inline-flex items-center justify-center gap-2 font-display tracking-[0.14em] px-4 flex-1":"inl
515ine-flex items-center justify-end gap-5 font-display tracking-[0.12em] px-5 leading-none",a="bg-bg border border-border hover:border-green/60 hover:bg-green/10 hover:text-green text-text transition-colors no-underline",o=s?{fontSize:14,height:38}:{fontSize:17,height:44,paddingTop:2},i=s?15:20,l=n.jsx(cc,{size:i,"aria-hidden":"true"});return e?n.jsxs(te,{to:e,className:j(r,a),style:o,children:[n.jsx("span",{children:"VIEW DRAFT LOG"}),l]}):n.jsxs("span",{className:j(r,"bg-bg border border-border text-dim cursor-not-allowed"),style:o,title:"No draft log available",children:[n.jsx("span",{children:"NO DRAFT LOG"}),l]})}function iC({href:e,variant:t}){const s=t==="mobile",r=s?"inline-flex items-center justify-center gap-2 font-display tracking-[0.14em] px-4 flex-1":"inline-flex items-center justify-end gap-5 font-display tracking-[0.12em] px-5 leading-none",a=s?{fontSize:14,height:38}:{fontSize:17,height:44,paddingTop:2};return n.jsxs(Ei,{to:e,className:j(r,"bg-bg border border-border hover:border-green/60 hover:bg-green/10 hover:text-green text-text transition-colors cursor-pointer no-underline"),style:a,children:[n.jsx("span",{children:s?"CARD POOL":"VIEW CARD POOL"}),n.jsx(Gn,{size:s?15:20,"aria-hidden":"true"})]})}function fie(e){const t=e%100,s=t>=11&&t<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${s}`}function hie({match:e,participant:t,opponentName:s,opponent:r,opponentHref:a,replays:o,canViewOpponentDeck:i,podFinalized:l,onHover:c,opponentDeckHref:d}){const u=Mc(),f=e.winnerName===lie,h=e.score===cie,m=!f&&e.winnerName==null,y=!f&&!m&&e.winnerName===Dy(t),b=f||h,w=f||h&&!y?"skip":m?"pending":y?"win":"loss",x=h?null:e.score??null,g=x?y?x.split("-")[0]:x.split("-")[1]:null,v=x?y?x.split("-")[1]:x.split("-")[0]:null,k=t.playerSlug,S=(r==null?void 0:r.playerSlug)??null,N=k&&!b?o.filter(q=>q.playerSlug===k&&q.inferredRound===e.round).sort((q,O)=>new Date(q.gameTime).getTime()-new Date(O.gameTime).getTime()):[],C=S&&!b?o.filter(q=>q.playerSlug===S&&q.inferredRound===e.round).sort((q,O)=>new Date(q.gameTime).getTime()-new Date(O.gameTime).getTime()):[],_=b?null:yie(N,C,e.reportedAt),T=(r==null?void 0:r.discordName)??_c(s),E=()=>{r&&(c==null||c(r.seatIndex,e.round,w))},A=()=>{c==null||c(null,null,null)},P=r&&a?n.jsx(te,{to:a,target:"_blank",rel:"noreferrer noopener",className:"font-display text-text hover:text-green transition-colors no-underline truncate",style:{fontSize:21,letterSpacing:"0.03em"},onClick:q=>q.stopPropagation(),children:T}):n.jsx("span",{className:"font-display text-text truncate",style:{fontSize:21,letterSpacing:"0.03em"},children:T}),M=r?u?n.jsxs("span",{className:"flex flex-col gap-1 min-w-0",children:[P,r.deckColors&&n.jsx(Be,{colors:r.deckColors,size:14})]}):n.jsxs("span",{className:"flex items-center min-w-0 gap-2",children:[r.deckColors&&n.jsx(Be,{colors:r.deckColors,size:14}),P]}):n.jsx("span",{className:"font-display text-text truncate",style:{fontSize:21},children:T}),U=i&&(!!(r!=null&&r.deckScreenshotUrl)||!!(r!=null&&r.hasDeckList)),F=r&&i?U&&d?n.jsxs(Ei,{to:d,title:`View ${T}'s deck`,className:"group/deck inline-flex items-center gap-2 bg-bg border border-border hover:border-green/60 hover:bg-green/10 transition-colors px-3 cursor-pointer no-underline shrink-0",style:{height:34},children:[n.jsx("span",{className:"font-display tracking-[0.16em] text-text group-hover/deck:text-green transition-colors leading-none whitespace-nowrap",style:{fontSize:14},children:"VIEW DECK"}),n.jsx(Gn,{size:17,"aria-hidden":"true",className:"text-text group-hover/deck:text-green transition-colors"})]}):n.jsxs("span",{className:"inline-flex items-center gap-2 bg-bg border border-border text-dim leading-none cursor-not-allowed shrink-0 px-3",style:{fontSize:14,height:34},title:"No deck screenshot available",children:[n.jsx("span",{className:"font-display tracking-[0.16em] whitespace-nowrap",children:"DECK MISSING"}),n.jsx(Gn,{size:17,"aria-hidden":"true"})]}):null,I=_!=null?n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted tabular-nums font-mono",style:{fontSize:13},children:[n.jsx(QY,{size:14,"aria-hidden":"true"}),`${_} min`]}):null;return n.jsxs("section",{className:"border-b border-border last:border-b-0",onMouseEnter:E,onMouseLeave:A,onFocus:E,onBlur:A,children:[n.jsxs("div",{className:j("grid items-center gap-3 px-4 md:px-5 xl:px-8 py-3",u?"grid-cols-[auto_1fr_auto]":"grid-cols-[auto_auto_1fr_auto]"),children:[n.jsx(pie,{outcome:w,yourScore:g,oppScore:v}),!u&&n.jsx("span",{className:"text-text font-display tracking-[0.12em] ml-2",style:{fontSize:16},children:"vs."}),n.jsxs("span",{className:"flex items-center gap-2.5 min-w-0",children:[u&&n.jsx("span",{className:"text-text font-display tracking-[0.12em] shrink-0",style:{fontSize:16},children:"vs."}),M,!u&&F]}),u?n.jsxs("div",{className:"flex flex-col items-end gap-1.5",children:[I??n.jsx("span",{"aria-hidden":"true"}),F]}):I??n.jsx("span",{"aria-hidden":"true"})]}),!f&&n.jsx(mie,{playerGames:N,opponentGames:C,podFinalized:l})]})}function pie({outcome:e,yourScore:t,oppScore:s}){const r=Mc();if(e==="skip"||e==="pending")return n.jsx("span",{className:j("flex items-center justify-center font-display leading-none",r?"px-2":"px-3","bg-surface2/40 border border-border text-muted"),style:{minWidth:r?52:72,height:r?42:56,letterSpacing:"0.08em"},children:n.jsx("span",{style:{fontSize:r?14:18},children:e==="skip"?"DROP":"TBD"})});const a=e==="win",o=t!=null&&s!=null;return n.jsxs("span",{className:j("flex flex-col items-center justify-center font-display leading-none py-2",r?"px-2":"px-3",a?"bg-green/15 border border-green/55 text-green":"bg-red/10 border border-red/45 text-red"),style:{minWidth:r?52:72,letterSpacing:"0.08em"},children:[n.jsx("span",{style:{fontSize:r?16:20},children:a?"WIN":"LOSS"}),o&&n.jsxs("span",{className:"tabular-nums opacity-90 mt-1.5",style:{fontSize:r?13:16},children:[t,"–",s]})]})}function mie({playerGames:e,opponentGames:t,podFinalized:s}){const r=Mc();if(e.length===0&&t.length===0)return s?n.jsx("div",{className:"px-4 md:px-5 xl:px-8 py-4 text-muted text-[13px] font-body",children:"No replays were captured for either seat this round"}):null;const a=Math.max(e.length,t.length);return n.jsx("div",{className:"px-4 md:px-5 xl:px-8 pb-4 flex flex-col gap-2",children:Array.from({length:a},(o,i)=>{const l=e[i]??null,c=l?bie(l,t):t[i]??null,d=r&&!c;return n.jsxs("div",{className:j("grid items-stretch",d?"grid-cols-1":"grid-cols-[1fr_auto] gap-2"),children:[n.jsx(xie,{row:l}),!d&&n.jsx(gie,{row:c})]},i)})})}function $O({label:e,title:t,className:s}){return n.jsx("div",{className:j("flex items-center bg-transparent border border-dashed border-border/70 text-dim cursor-default px-3",s),style:{height:38},title:t,children:n.jsx("span",{className:"font-display tracking-[0.16em] leading-none whitespace-nowrap",style:{fontSize:13},children:e})})}function xie({row:e}){const t=Mc();return e?n.jsxs("a",{href:e.link,target:"_blank",rel:"noreferrer noopener",onClick:s=>s.stopPropagation(),style:{height:38},className:"group grid grid-cols-[auto_1fr_auto_auto] items-center gap-3 bg-bg border border-border hover:border-green/60 hover:bg-green/10 transition-colors px-3 no-underline",children:[n.jsx("span",{className:j("font-display tabular-nums leading-none",e.won?"text-green":"text-red"),style:{fontSize:20,letterSpacing:"0.12em"},children:e.won?"W":"L"}),n.jsxs("span",{className:"text-subtle font-mono tabular-nums truncate leading-none",style:{fontSize:13},children:[e.turns!=null?`${e.turns} turns`:"—",e.onPlay!=null&&n.jsx("span",{className:"text-dim ml-2",children:e.onPlay?"Play":"Draw"})]}),n.jsx("span",{className:"font-display tracking-[0.16em] text-text group-hover:text-green transition-colors leading-none whitespace-nowrap",style:{fontSize:14},children:t?"REPLAY":"VIEW REPLAY"}),n.jsx(en,{size:13,"aria-hidden":"true",className:"text-text group-hover:text-green transition-colors"})]}):n.jsx($O,{label:t?"NO REPLAY":"NO REPLAY CAPTURED",title:"No replay was captured for this game"})}const lC="lg:w-[186px] lg:justify-center";function gie({row:e}){const t=Mc();return e?n.jsxs("a",{href:e.link,target:"_blank",rel:"noreferrer noopener",onClick:s=>s.stopPropagation(),style:{height:38},className:j("group inline-flex items-center gap-1.5 bg-bg border border-border hover:border-green/60 hover:bg-green/10 transition-colors px-3 no-underline",lC),children:[n.jsx("span",{className:"font-display tracking-[0.16em] text-text group-hover:text-green transition-colors leading-none whitespace-nowrap",style:{fontSize:14},children:t?"OPP REPLAY":"OPPONENT'S REPLAY"}),n.jsx(en,{size:13,"aria-hidden":"true",className:"text-text group-hover:text-green transition-colors"})]}):t?null:n.jsx($O,{label:"NO OPPONENT REPLAY",title:"The opponent did not capture a replay for this game",className:lC})}function bie(e,t){const s=new Date(e.gameTime).getTime();for(const r of t){if(r.turns!==e.turns||r.won===e.won)continue;const a=new Date(r.gameTime).getTime();if(Math.abs(a-s)<=2*6e4)return r}return null}function yie(e,t,s){if(!s)return null;const r=[...e.map(u=>
515new Date(u.gameTime).getTime()),...t.map(u=>new Date(u.gameTime).getTime())].sort((u,f)=>u-f);if(r.length===0)return null;const a=r[0],i=(new Date(s).getTime()-a)/6e4,l=Math.max(e.length,t.length),c=l>=2?i/Math.max(1,l-1):0,d=Math.max(0,Math.round(i+c));return d>0?d:null}function UO({className:e,style:t,children:s}){return n.jsx("section",{className:j("border-b border-border",e),style:{background:"linear-gradient(180deg, #14181f 0%, #0a0c10 100%)",...t},children:s})}function ff(e,t){const s=e.placement??Number.MAX_SAFE_INTEGER,r=t.placement??Number.MAX_SAFE_INTEGER;if(s!==r)return s-r;const a=ho(e.record).wins,o=ho(t.record).wins;return a!==o?o-a:$s(e).localeCompare($s(t))}function vie(e){return e.some(t=>t.placement!=null||ho(t.record).played)}function zO({seats:e,teamDraft:t=!1,finalized:s,selectedSeat:r,onHover:a,actions:o}){const i=(c,d,u)=>{const f=o.canViewSeat(c.avatarUrl),h=f&&(!!c.deckScreenshotUrl||!!c.hasDeckList);return n.jsx(xw,{p:c,rank:d,cols:u,selected:c.seatIndex===r,rowHref:wr(o.eventSlug,c.discordName),deckHref:h?ta(o.eventSlug,null,c.discordName):null,logHref:o.hasDraftLog&&f?sa(o.eventSlug,c):null,onHover:m=>a==null?void 0:a(m?c.seatIndex:null)},c.seatIndex)};if(t)return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(ob,{finalized:s,cols:Qp}),n.jsx("div",{className:"flex flex-col gap-[1px] pb-[1px] bg-bg",children:VO(e).map(({team:c,members:d,wins:u,won:f})=>n.jsxs("div",{className:"flex flex-col gap-[1px]",children:[n.jsx(kie,{team:c,wins:u,won:f}),d.map(h=>i(h,null,Qp))]},c))})]});const l=[...e].sort(ff);return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(ob,{finalized:s}),n.jsx("div",{className:"flex flex-col gap-[1px] pb-[1px] bg-bg",children:l.map((c,d)=>i(c,c.placement??d+1))})]})}function BO({rows:e=8,finalized:t=!0,teamDraft:s=!1}){const r=s?Qp:ax;return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(ob,{finalized:t,cols:r}),n.jsx("div",{className:"flex flex-col gap-[1px] pb-[1px] bg-bg",children:Array.from({length:e},(a,o)=>n.jsx(gw,{cols:r},o))})]})}const bw=40,FO="shrink-0 bg-surface2 border-b border-border",yw="font-display tracking-[0.14em] leading-none",WO=16,wie=22,jie="pl-[22px]";function HO({to:e}){return n.jsxs(te,{to:e,replace:!0,className:j(FO,Wc,"flex items-center w-full text-left text-muted hover:text-text transition-colors cursor-pointer no-underline"),style:{height:bw},children:[n.jsx(lo,{size:16,className:"shrink-0"}),n.jsx("span",{className:j(yw,"ml-1.5"),style:{fontSize:WO},children:"BACK TO STANDINGS"})]})}function ob({finalized:e,cols:t=ax}){return n.jsxs("div",{className:j("grid items-center gap-x-2 lg:gap-x-3",FO,Wc,t),style:{height:bw},children:[n.jsx("span",{className:j("col-span-2 text-text",yw,jie),style:{fontSize:WO},children:e?"FINAL STANDINGS":"STANDINGS"}),n.jsx(cC,{children:"COLORS"}),n.jsx(cC,{className:"text-center",children:"RESULT"}),n.jsx("span",{})]})}function cC({children:e,className:t}){return n.jsx("span",{className:j("font-display text-muted tracking-[0.16em] leading-none whitespace-nowrap",t),style:{fontSize:12},children:e})}function GO(e){return e==null?null:e%2===0?"A":"B"}function VO(e){const t=["A","B"].map(a=>{const o=e.filter(l=>GO(l.seatIndex)===a).sort(ff),i=o.reduce((l,c)=>l+ho(c.record).wins,0);return{team:a,members:o,wins:i,won:!1}}),[s,r]=t;return t.map(a=>({...a,won:s.wins!==r.wins&&a.wins===Math.max(s.wins,r.wins)}))}function kie({team:e,wins:t,won:s}){const r=PO[e==="A"?"A":"B"].text;return n.jsxs("div",{className:j("grid items-center gap-x-2 lg:gap-x-3 bg-surface2/60",Wc,Qp),style:{height:bw},children:[n.jsxs("span",{className:j("col-span-2 flex items-center text-[15px]",yw,r),children:[n.jsx("span",{className:"inline-flex justify-center shrink-0",style:{width:wie},children:s&&n.jsx(ct,{size:14,color:"#ffc63a"})}),e==="A"?"GREEN TEAM":"BLUE TEAM",n.jsx("span",{className:"font-num text-[14px] ml-2.5",children:t})]}),n.jsx("span",{}),n.jsx("span",{}),n.jsx("span",{})]})}const KO=380,qO=560,Ou={w:74,h:64},ZO=16;function Sie({seatCount:e=8,variant:t="standings",finalized:s=!0,teamDraft:r=!1}){const a=p.useRef(null),[o,i]=p.useState(1);p.useLayoutEffect(()=>{const h=a.current;if(!h)return;const m=()=>{const b=h.clientWidth;b>0&&i(b/KO)};m();const y=new ResizeObserver(m);return y.observe(h),()=>y.disconnect()},[]);const l=Math.ceil(e/2),c=l,d=e-l,u=Ou.w*o,f=Ou.h*o;return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(UO,{className:"px-[18px] pt-5 pb-5",children:n.jsxs("div",{ref:a,className:"w-full mx-auto",style:{maxWidth:qO},children:[n.jsx(dC,{count:c,tileW:u,tileH:f,scale:o}),n.jsxs("div",{className:"flex items-center justify-between gap-2",style:{paddingTop:10*o,paddingBottom:10*o},children:[n.jsx("div",{style:{width:u}}),n.jsx("div",{className:"h-3 bg-surface2 animate-pulse",style:{width:120*o}}),n.jsx("div",{style:{width:u}})]}),n.jsx(dC,{count:d,tileW:u,tileH:f,scale:o})]})}),t==="standings"?n.jsx("div",{className:"bg-surface",children:n.jsx(BO,{rows:e,finalized:s,teamDraft:r})}):n.jsxs("div",{className:"bg-surface border-b border-border px-4 py-4 flex flex-col gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-[52px] h-[52px] bg-surface2 animate-pulse shrink-0"}),n.jsxs("div",{className:"flex flex-col gap-2 min-w-0 flex-1",children:[n.jsx("div",{className:"h-6 w-2/3 bg-surface2 animate-pulse"}),n.jsx("div",{className:"h-3 w-1/3 bg-surface2 animate-pulse"})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"h-[38px] flex-1 bg-surface2 animate-pulse"}),n.jsx("div",{className:"h-[38px] flex-1 bg-surface2 animate-pulse"})]})]})]})}function dC({count:e,tileW:t,tileH:s,scale:r}){return n.jsx("div",{className:"flex items-center justify-between",children:Array.from({length:e},(a,o)=>n.jsxs(p.Fragment,{children:[n.jsx("div",{className:"bg-surface2 border border-border animate-pulse",style:{width:t,height:s}}),o<e-1&&n.jsx("div",{className:"bg-surface2 animate-pulse",style:{width:ZO*r,height:2*r}})]},o))})}function Nie({participants:e,participantsBySeatName:t,matches:s,replays:r,selectedSeat:a,canViewSeat:o=()=>!0,podFinalized:i=!0,eventLabel:l,setCode:c,eventSlug:d,hasDraftLog:u,formatLabel:f,isMock:h=!1,standingsAvailable:m=!1,teamDraft:y=!1,standingsActions:b}){const w=[...e].sort((v,k)=>v.seatIndex-k.seatIndex),x=a==null?null:e.find(v=>v.seatIndex===a)??null,g=m&&!!b&&x==null;return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(UO,{className:"px-[18px] pt-5 pb-5",children:n.jsx(Cie,{participants:w,selectedSeat:a,eventSlug:d,eventLabel:l,setCode:c,formatLabel:f})}),m&&b&&n.jsx("div",{className:"grid transition-[grid-template-rows] duration-300 ease-out motion-reduce:transition-none",style:{gridTemplateRows:g?"1fr":"0fr"}
515,children:n.jsx("div",{className:"overflow-hidden",children:n.jsx("div",{className:"bg-surface",children:n.jsx(zO,{seats:e,teamDraft:y,finalized:i,selectedSeat:a,actions:b})})})}),n.jsx("div",{className:"grid transition-[grid-template-rows] duration-300 ease-out motion-reduce:transition-none",style:{gridTemplateRows:x?"1fr":"0fr"},children:n.jsx("div",{className:"overflow-hidden",children:x&&n.jsxs("div",{className:"bg-surface",children:[m&&n.jsx(HO,{to:wr(d,null)}),n.jsx(MO,{participant:x,participantsBySeatName:t,matches:s,replays:r,setCode:c,eventSlug:d,hasDraftLog:u,canViewSeat:o,podFinalized:i,isMock:h},x.displayName)]})})})]})}function Cie({participants:e,selectedSeat:t,eventSlug:s,eventLabel:r,setCode:a,formatLabel:o}){const i=p.useRef(null),[l,c]=p.useState(1);p.useLayoutEffect(()=>{const y=i.current;if(!y)return;const b=()=>{const x=y.clientWidth;x>0&&c(x/KO)};b();const w=new ResizeObserver(b);return w.observe(y),()=>w.disconnect()},[]);const d=e.length,u=Math.ceil(d/2),f=e.slice(0,u),h=e.slice(u).reverse(),m=Ou.w*l;return n.jsxs("div",{ref:i,className:"w-full mx-auto",style:{maxWidth:qO},children:[n.jsx(uC,{tiles:f,arrowDir:"right",selectedSeat:t,eventSlug:s,scale:l}),n.jsxs("div",{className:"flex items-center justify-between gap-2",style:{paddingTop:10*l,paddingBottom:10*l},children:[n.jsx("div",{style:{width:m,display:"flex",justifyContent:"center"},children:n.jsx(ib,{direction:"up",scale:l})}),n.jsxs("div",{className:"flex items-center text-text font-display min-w-0 px-1",style:{gap:6*l,fontSize:Math.round(Tie(r)*l)},children:[n.jsx(Ae,{code:Qt({code:a,custom:o!=null}),size:Math.round(20*l),className:"text-text"}),n.jsx("span",{className:"truncate",children:Si(r)})]}),n.jsx("div",{style:{width:m,display:"flex",justifyContent:"center"},children:n.jsx(ib,{direction:"down",scale:l})})]}),n.jsx(uC,{tiles:h,arrowDir:"left",selectedSeat:t,eventSlug:s,scale:l})]})}function uC({tiles:e,arrowDir:t,selectedSeat:s,eventSlug:r,scale:a}){return n.jsx("div",{className:"flex items-center justify-between",children:e.map((o,i)=>n.jsxs(p.Fragment,{children:[n.jsx(_ie,{participant:o,selected:s===o.seatIndex,href:wr(r,o.discordName),replace:s!=null,scale:a}),i<e.length-1&&n.jsx(ib,{direction:t,scale:a})]},o.displayName))})}function ib({direction:e,scale:t}){const s=e==="right"?0:e==="down"?90:e==="left"?180:270,r=ZO*t;return n.jsx("div",{className:"pointer-events-none",style:{width:r,height:r,transform:`rotate(${s}deg)`},"aria-hidden":!0,children:n.jsx("svg",{viewBox:"0 0 24 24",className:"w-full h-full",children:n.jsx("path",{d:"M 4 7 L 11 12 L 4 17 M 13 7 L 20 12 L 13 17",fill:"none",stroke:"#c4ccdb",strokeOpacity:"0.75",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"})})})}function _ie({participant:e,selected:t,href:s,replace:r,scale:a}){const{wins:o,losses:i,played:l}=ho(e.record),c=Ly(e.record)||e.placement===1,d=Ou.w*a,u=Ou.h*a;return n.jsx(te,{to:s,replace:r,"aria-current":t||void 0,"aria-label":`Seat ${e.seatIndex+1}: ${e.discordName}${l?`, ${e.record}`:""}`,className:j("block p-0 m-0 bg-surface border transition-colors text-left no-underline",t?"border-green bg-surface2":c?"border-border2":"border-border hover:border-border2"),style:{width:d,height:u,boxShadow:t?"0 0 12px -2px rgba(46, 232, 92, 0.35)":void 0},children:n.jsxs("div",{className:"h-full flex flex-col items-center justify-between",style:{paddingTop:5*a,paddingBottom:5*a},children:[e.deckColors?n.jsx(Be,{colors:e.deckColors,size:Math.round(10*a)}):n.jsx("div",{style:{height:Math.round(10*a)}}),n.jsxs("div",{className:"flex items-center justify-center gap-1 w-full px-1 min-w-0",children:[c&&n.jsx(ct,{size:Math.round(10*a),color:"#ffc63a",className:"shrink-0"}),n.jsx("span",{className:"font-display leading-none uppercase truncate text-text",style:{fontSize:Math.round(12*a),letterSpacing:"0.02em",fontFamily:"'Bebas Neue', sans-serif"},children:e.discordName})]}),l?n.jsx("div",{className:"tabular-nums leading-none text-text",style:{fontSize:Math.round(12*a),letterSpacing:"0.06em",fontFamily:"'Bebas Neue', sans-serif"},children:n.jsx(ht,{wins:o,losses:i,mono:!0,separatorMargin:2})}):n.jsx("div",{style:{height:Math.round(12*a)}})]})})}function Tie(e){const t=e.length;return t<=8?18:t<=14?16:t<=20?14:12}function Eie(e,t){return!t||!e?!1:e.includes(`/avatars/${t}/`)}function Rie(e){const t=!!e.closedDecklist&&!e.isFinalized,s=!t||e.isOrganizer;return{locked:t,canViewAll:s,canViewSeat:a=>s||Eie(a,e.viewerDiscordId)}}function ox(e){const{user:t}=Qn(),s=(t==null?void 0:t.discordId)??null,r=e==null?void 0:e.closedDecklist,a=(e==null?void 0:e.isFinalized)??!1;return p.useMemo(()=>Rie({closedDecklist:r,isFinalized:a,isOrganizer:LA(s),viewerDiscordId:s}),[r,a,s])}const fC=720,hC=700,ph=500,Aie=200,Pie=220,Oie=84,YO=360,Lie=280;function QO(e){return e.some(r=>r.seatIndex!=null)?e.slice().filter(r=>r.seatIndex!=null).sort((r,a)=>r.seatIndex-a.seatIndex).map(r=>
515({...r,seatIndex:r.seatIndex,discordName:$s(r)})):e.slice().sort(ff).map((r,a)=>({...r,seatIndex:a,discordName:$s(r)}))}function JO(e,t){const s=t.toLowerCase();return e.find(r=>r.discordName===t)??e.find(r=>r.displayName===t)??e.find(r=>r.discordName.toLowerCase()===s)??e.find(r=>r.displayName.toLowerCase()===s)}function Die(){const{slug:e}=cn(),t=ln(),s=Rt(),[r]=Rn(),a=r.get("player"),{deckOwnerName:o,deckTab:i}=Iie(r,a),l=ut(),c=Km(),[d,u]=p.useState(null),[f,h]=p.useState(null),[m,y]=p.useState(null),[b,w]=p.useState(!1),x=Ju(wr(e??"",a)),g=(Ue,Ve,ft)=>{u(Ue),h(Ve),y(ft)},{data:v,isLoading:k}=$R(e),S=v==null?void 0:v.eventId,{data:N,isLoading:C}=Ic(S),{data:_}=of(S),T=p.useMemo(()=>_?_.cards.map(Ue=>({name:Ue.n,set:Ue.s??_.set})):[],[_]),E=Mi(T),{data:A,isLoading:P}=UR(S),{data:M,isLoading:U}=oY(S),{data:F}=af(v==null?void 0:v.setCode),I=ox(v),q=p.useMemo(()=>N?QO(N).map(Ue=>({...Ue,deckColors:I.canViewSeat(Ue.avatarUrl)?Ue.deckColors:null,..._?{hasDeckList:mc(_,Ue.seatIndex)!==null}:{}})):[],[N,_,I]),O=p.useMemo(()=>{const Ue=new Map;for(const Ve of q)Ue.set(Dy(Ve),Ve);return Ue},[q]),H=vie(q),B=p.useMemo(()=>$ie(q,a,l&&!H),[q,a,l,H]),D=(B==null?void 0:B.seatIndex)??null,L=o?JO(q,o):void 0,$=L&&I.canViewSeat(L.avatarUrl)?L:null,V=p.useMemo(()=>_&&$?mc(_,$.seatIndex):null,[_,$]),z=Ue=>{if(!$)return null;const Ve=q.findIndex(ft=>ft.seatIndex===$.seatIndex);if(Ve===-1)return null;for(let ft=1;ft<=q.length;ft++){const Rs=q[((Ve+Ue*ft)%q.length+q.length)%q.length];if(I.canViewSeat(Rs.avatarUrl))return Rs}return null},{prevSlug:K,nextSlug:W}=p.useMemo(()=>{if(!F||!v)return{prevSlug:null,nextSlug:null};const Ue=Date.now(),Ve=F.filter(Rs=>Rs.championDisplayName||new Date(Rs.eventTime).getTime()<=Ue),ft=Ve.findIndex(Rs=>Rs.eventId===v.eventId);return ft<0?{prevSlug:null,nextSlug:null}:{prevSlug:ft>0?Ve[ft-1].slug:null,nextSlug:ft<Ve.length-1?Ve[ft+1].slug:null}},[F,v]),J=K?`/pods/${K}`:null,Z=W?`/pods/${W}`:null,Y=c?Oie:Aie,ae=c?Lie:YO,pe=`flex-1 flex flex-col px-3 min-h-0 ${c?"pb-2":"md:px-6 pb-5"}`,ye=c?"py-1 pr-2":"py-3 md:py-4 pr-5 md:pr-7",De=c?"py-1":"py-2",Fe=c?n.jsx(Bd,{backTo:"/pods",prevTo:J,nextTo:Z,prevAriaLabel:"Previous pod",nextAriaLabel:"Next pod"}):n.jsx(St,{subtitle:"POD DRAFT BREAKDOWN"});p.useEffect(()=>{window.scrollTo(0,0)},[e]),p.useEffect(()=>{const Ue=Ve=>{if($||Ve.metaKey||Ve.ctrlKey||Ve.altKey||Ve.shiftKey)return;const ft=Ve.target;ft instanceof HTMLElement&&(ft.tagName==="INPUT"||ft.tagName==="TEXTAREA"||ft.isContentEditable)||(Ve.key==="ArrowLeft"&&J?(Ve.preventDefault(),t(J)):Ve.key==="ArrowRight"&&Z&&(Ve.preventDefault(),t(Z)))};return window.addEventListener("keydown",Ue),()=>window.removeEventListener("keydown",Ue)},[J,Z,t,$]);const[tt,st]=p.useState(B),ie=B??tt;p.useEffect(()=>{if(B){st(B);return}const Ue=setTimeout(()=>st(null),ph);return()=>clearTimeout(Ue)},[B]),p.useEffect(()=>{if(!v||b)return;const Ue=window.requestAnimationFrame(()=>w(!0));return()=>window.cancelAnimationFrame(Ue)},[v,b]);const Se=v?v.kind==="mock":Mie(e),Ie=!Se||a!==null;if(k||v&&C)return l?n.jsxs("div",{className:"bg-bg text-text min-h-screen flex flex-col",children:[n.jsx(Bd,{backTo:"/pods",prevTo:null,nextTo:null,prevAriaLabel:"Previous pod",nextAriaLabel:"Next pod"}),n.jsx(Sie,{variant:a||Se?"player":"standings",finalized:(v==null?void 0:v.isFinalized)??!0,teamDraft:(v==null?void 0:v.isTeamDraft)??!1})]}):n.jsxs("div",{className:"bg-bg text-text h-screen flex flex-col overflow-hidden",children:[Fe,n.jsxs("main",{className:pe,children:[!c&&n.jsx("div",{className:"pt-5 pb-2 flex items-center justify-between gap-4 shrink-0",children:n.jsx(pc,{to:"/pods",label:"BACK TO POD DRAFTS",inline:!0})}),Ie?n.jsxs("div",{className:`flex-1 flex items-stretch min-h-0 ${De}`,children:[n.jsx("div",{className:`flex items-center min-w-0 shrink-0 justify-end ${ye}`,style:{width:"55%"},children:n.jsx(rC,{maxWidth:`min(${hC}px, calc(100vh - ${Y}px))`})}),n.jsx("div",{className:"min-w-0 shrink-0 self-start max-h-full",style:{width:"45%"},children:n.jsx(zie,{minWidth:ae,variant:a?"player":"standings",finalized:(v==null?void 0:v.isFinalized)??!0})})]}):n.jsx("div",{className:`flex-1 flex items-center justify-center min-h-0 ${De}`,children:n.jsx(rC,{maxWidth:`min(${fC}px, calc(100vh - ${Y}px))`})})]})]});if(!v)return n.jsxs("div",{className:"bg-bg text-text min-h-screen",children:[n.jsx(St,{subtitle:"POD DRAFTS"}),n.jsxs("main",{className:"px-6 md:px-10 py-16 max-w-[720px]",children:[n.jsx(Xe,{className:"mb-3",children:"Not found"}),n.jsxs("h1",{className:"font-display text-text",style:{fontSize:36,letterSpacing:"0.04em"},children:["No pod matched ",n.jsxs("span",{className:"text-muted",children:['"',e,'"']}),"."]}),n.jsx("p",{className:"text-muted mt-4",children:n.jsx(te,{to:"/pods",className:"text-green hover:underline",children:"Back to pod drafts"})})]})]});const _e=n9(v).toUpperCase(),We=B!==null||H,we=B!==null,He=We?hC:fC,ee=A??[],Q=M??[],re=P||U,fe={eventSlug:v.slug,hasDraftLog:!!_,canViewSeat:I.canViewSeat},Ee=(Ue,Ve)=>ta(v.slug,a,Ue.discordName,Ve),qe=Ue=>t(Ue,{replace:!0,state:s.state}),Qe=z(-1),X=z(1),ke=Qe?Ee(Qe,i):void 0,$e=X?Ee(X,i):void 0,Me=$&&n.jsx(Fc,{participant:{eventId:$.eventId,displayName:$.discordName,participantDisplayName:$.displayName,deckColors:$.deckColors,deckScreenshotUrl:$.deckScreenshotUrl,deckScreenshotCaption:$.deckScreenshotCaption,mainboard:V,record:$.record},tab:i,onTabChange:Ue=>qe(Ee($,Ue)),draftLogHref:_?sa(v.slug,$):null,cardImages:E,onClose:x,onPrev:ke?()=>qe(ke):void 0,onNext:$e?()=>qe($e):void 0,prevHref:ke,nextHref:$e});return l?n.jsxs("div",{className:"bg-bg text-text min-h-screen flex flex-col",children:[n.jsx(Bd,{backTo:"/pods",prevTo:J,nextTo:Z,prevAriaLabel:"Previous pod",nextAriaLabel:"Next pod"}),n.jsx(Nie,{participants:q,participantsBySeatName:O,matches:ee,replays:Q,selectedSeat:D,canViewSeat:I.canViewSeat,podFinalized:v.isFinalized,eventLabel:_e,setCode:v.setCode,eventSlug:v.slug,hasDraftLog:!!_,formatLabel:v.formatLabel,isMock:Se,standingsAvailable:H,teamDraft:v.isTeamDraft??!1,standingsActions:fe}),Me]}):n.jsxs("div",{className:"bg-bg text-text h-screen flex flex-col overflow-hidden",children:[Fe,n.jsxs("main",{className:pe,children:[!c&&n.jsxs("div",{className:"pt-5 pb-2 flex items-center justify-between gap-4 shrink-0",children:[n.jsx(pc,{to:"/pods",label:"BACK TO POD DRAFTS",inline:!0}),n.jsx(sO,{prevTo:J,nextTo:Z,prevAriaLabel:"Previous pod",nextAriaLabel:"Next pod"})]}),n.jsxs("div",{className:`flex-1 flex items-stretch min-h-0 ${De}`,children:[n.jsx("div",{className:`flex items-center min-w-0 shrink-0 ${ye} ${We?"justify-end":"justify-center"}`,style:{width:We?"55%":"100%",transition:b?`width ${ph}ms ease-out`:"none"},children:n.jsx(eie,{participants:q,selectedSeat:D,highlightedSeat:d,highlightedRound:f,highlightedOutcome:m,canViewDeck:I.canViewSeat,eventLabel:_e,teamDraft:v.isTeamDraft??!1,eventSlug:v.slug,hasDraftLog:!!_,setCode:v.setCode,formatLabel:v.formatLabel,date:v.eventDate,maxWidth:`min(${He}px, calc(100vh - ${Y}px))`})}),n.jsx("div",{className:"min-w-0 shrink-0 self-start max-h-full flex flex-col min-h-0",style:{width:We?"45%":"0%",opacity:We?1:0,transition:b?`width ${ph}ms ease-out, opacity ${ph-80}ms ease-out`:"none"},children:n.jsx("div",{className:"pod-panel-shell bg-surface border border-border flex flex-col min-h-0 flex-1 overflow-hidden",children:n.jsxs("div",{className:"relative flex flex-col min-h-0 flex-1",style:{minWidth:ae},children:[H&&n.jsx(mC,{shown:!we,hiddenShift:"-translate-x-4",className:"overflow-y-auto themed-scrollbar",children:n.jsx(zO,{seats:q,teamDraft:v.isTeamDraft??!1,finalized:v.isFinalized,selectedSeat:D,onHover:Ue=>g(Ue,null,null),actions:fe})}),n.jsxs(mC,{shown:we||!H,hiddenShift:"translate-x-6",children:[H&&n.jsx(HO,{to:wr(v.slug,null)}),ie&&n.jsx(MO,{participant:ie,participantsBySeatName:O,matches:ee,replays:Q,setCode:v.setCode,eventSlug:v.slug,hasDraftLog:!!_,canViewSeat:I.canViewSeat,podFinalized:v.isFinalized,onRoundHover:g,isMock:Se},ie.displayName),ie&&re&&n.jsx("div",{className:"px-5 py-2 text-muted text-[12px] font-body",children:"Loading matches & replays…"})]})]})})})]})]}),Me]})}const Iie=(e,t)=>{const s=e.get("deck"),r=e.get("view")==="pool";return{deckOwnerName:s==="screenshot"||s==="decklist"?t:s,deckTab:r||s==="decklist"?"decklist":"screenshot"}},Mie=e=>(e==null?void 0:e.includes("-mock-draft-"))??!1,$ie=(e,t,s)=>{const r=t?JO(e,t):void 0;return r||(s?e.find(a=>a.placement===1)??e[0]??null:null)};function pC(){const{slug:e,who:t,pack:s,pick:r}=cn(),{data:a,isLoading:o}=$R(e),i=a==null?void 0:a.eventId,{data:l,isLoading:c}=Ic(i),{data:d,isLoading:u}=of(i),f=ox(a),h=p.useMemo(()=>l?QO(l):[],[l]);if(o||a&&(c||u))return n.jsx("div",{className:"fixed inset-0 z-50 bg-bg"});if(!a||!d)return n.jsx(wn,{to:`/pods/${e??""}`,replace:!0});if(!t)return n.jsx(wn,{to:`/pods/${e}`,replace:!0});const m=Uie(h,t),y=m!=null&&m<d.seats.length?m:0,b=h.map(v=>({seatIndex:v.seatIndex,playerSlug:v.playerSlug,displayName:v.discordName,participantDisplayName:v.displayName,avatarUrl:v.avatarUrl,deckColors:v.deckColors,deckScreenshotUrl:v.deckScreenshotUrl,deckScreenshotCaption:v.deckScreenshotCaption,record:v.record})),w=m!=null?h.find(v=>v.seatIndex===m):null,x=wr(a.slug,(w==null?void 0:w.discordName)??null),g=!f.canViewAll;return g&&!(w&&f.canViewSeat(w.avatarUrl))?n.jsx(wn,{to:`/pods/${e}`,replace:!0}):n.jsx(Xae,{artifact:d,meta:{setCode:a.setCode,name:a.name},seat:y,pack:s?Number(s)-1:0,pick:r?Number(r)-1:0,backHref:x,eventSlug:a.slug,eventId:a.eventId,seatInfo:b,soloSeat:g?y:void 0})}function Uie(e,t){const s=e.find(a=>a.playerSlug===t);if(s)return s.seatIndex;const r=Number(t);return Number.isInteger(r)&&e.some(a=>a.seatIndex===r)?r:null}function mC({shown:e,hiddenShift:t,className:s,children:r}){return n.jsx("div",{"aria-hidden":!e,className:j("flex flex-col ease-out motion-reduce:transition-none transition-[transform,opacity]",e?"relative flex-1 min-h-0 translate-x-0 opacity-100":`absolute inset-0 ${t} opacity-0 pointer-events-none`,s),style:{transitionDuration:`${Pie}ms`},children:r})}function zie({minWidth:e=YO,variant:t="player",finalized:s=!0}){return t==="standings"?n.jsx("div",{className:"pod-panel-shell bg-surface border border-border max-h-full overflow-hidden",children:n.jsx("div",{style:{minWidth:e},children:n.jsx(BO,{finalized:s})})}):n.jsx("div",{className:"pod-panel-shell bg-surface border border-border max-h-full overflow-hidden",children:n.jsxs("div",{style:{minWidth:e},children:[n.jsxs("div",{className:"flex items-center gap-4 px-4 md:px-5 xl:px-8 py-5 border-b border-border",children:[n.jsx("div",{className:"w-[54px] h-[54px] bg-surface2 animate-pulse shrink-0"}),n.jsxs("div",{className:"min-w-0 flex-1 flex flex-col gap-2",children:[n.jsx("div",{className:"h-7 w-2/3 bg-surface2 animate-pulse"}),n.jsx("div",{className:"h-4 w-1/3 bg-surface2 animate-pulse"})]}),n.jsxs("div",{className:"flex flex-col gap-2 shrink-0",children:[n.jsx("div",{className:"h-[44px] w-[200px] bg-surface2 animate-pulse"}),n.jsx("div",{className:"h-[44px] w-[200px] bg-surface2 animate-pulse"})]})]}),Array.from({length:3},(r,a)=>n.jsxs("div",{className:"border-b border-border last:border-b-0 px-4 md:px-5 xl:px-8 py-3 flex items-center gap-3",children:[n.jsx("div",{className:"h-[52px] w-[72px] bg-surface2 animate-pulse"}),n.jsx("div",{className:"h-5 w-8 bg-surface2 animate-pulse"}),n.jsx("div",{className:"h-5 flex-1 bg-surface2 animate-pulse"}),n.jsx("div",{className:"h-[34px] w-[120px] bg-surface2 animate-pulse"})]},a))]})})}function Lu({className:e,updated:t}){return n.jsx("footer",{className:j("flex items-center text-[11px] md:text-[12px] text-muted",e),children:n.jsx("span",{className:"font-mono",children:t?n.jsxs(n.Fragment,{children:["UPDATED ",t]}):null})})}function Ui({label:e,count:t,unit:s,compact:r,meta:a,controls:o,center:i,padLeftClass:l="pl-2"}){return r?n.jsxs("div",{className:"flex items-baseline justify-between gap-3 py-2 pl-5 pr-3 border-b border-border",children:[n.jsx("span",{className:"font-display text-text text-[14px] tracking-[0.16em] leading-none",children:e}),a&&n.jsx("span",{className:"font-display text-[12px] tracking-[0.14em] leading-none text-muted",children:a})]}):n.jsxs("div",{className:j("relative flex items-center justify-between h-[50px] pr-5 border-b border-border gap-4",l),children:[n.jsxs("div",{className:j("min-w-0 flex items-center gap-3",!i&&"flex-1 basis-0"),children:[n.jsx("span",{className:"shrink-0 font-display text-text tracking-[0.18em] leading-none",style:{fontSize:17},children:e}),o]}),i&&n.jsx("div",{className:"min-w-0 flex-1 flex justify-center",children:i}),a?n.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center",children:a}):n.jsx("div",{className:j("min-w-0 flex justify-end",!i&&"flex-1 basis-0"),children:s?t===void 0?n.jsx("span",{className:"inline-block h-3.5 w-24 bg-surface2 animate-pulse"}):t===0?null:n.jsxs("span",{className:"font-display tracking-[0.18em] leading-none flex items-baseline gap-1.5 whitespace-nowrap",style:{fontSize:17},children:[n.jsx("span",{className:"tabular-nums text-subtle",children:t}),n.jsx("span",{className:"text-muted",children:s})]}):null})]})}function Xp({active:e,onClick:t,children:s}){return n.jsx("button",{type:"button",onClick:t,className:j("flex-1 py-2 px-1.5 bg-transparent cursor-pointer font-display text-[14px] tracking-[0.16em] leading-none transition-colors border-b-2 border-solid inline-flex items-center justify-center gap-1.5",e?"text-text border-green":"text-muted border-transparent"),style:e?{marginBottom:-1}:void 0,children:s})}const em=[{label:"EARLY POD",easternHour:14}
515,{label:"LATE POD",easternHour:21}];function lb(e){return Hie(cb(e).toISOString())}function Bie(){var t;return((t=new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(new Date).find(s=>s.type==="timeZoneName"))==null?void 0:t.value)??""}function cb(e,t=new Date){const s=Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),e);return new Date(s+Gie(s))}function Fie(e){const t=cb(e);if(t.getTime()>Date.now())return t;const s=new Date;return s.setUTCDate(s.getUTCDate()+1),cb(e,s)}const Wie=new Intl.DateTimeFormat("en-US",{timeZone:"America/New_York",hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});function Hie(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return"";const s=t.getMinutes()===0?void 0:"2-digit";return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:s}).format(t)}function Gie(e){const t=Wie.formatToParts(new Date(e)),s=a=>{var o;return Number((o=t.find(i=>i.type===a))==null?void 0:o.value)},r=Date.UTC(s("year"),s("month")-1,s("day"),s("hour"),s("minute"));return e-r}const Vie=[{code:"PEASANT",label:"Peasant Cube",cubeId:"DaneeliusPeasantAllStars"},{code:"MEMA",label:"Middle-Earth Masters",cubeId:"MEMA"},{code:"SAMP",label:"samp Cube",cubeId:"samp"}],Kie=new Map(Vie.map(e=>[e.code,e]));function qie(e){return e?Kie.get(e.toUpperCase()):void 0}function vw(e){const t=qie(e);return t?`https://cubecobra.com/cube/list/${t.cubeId}`:null}const Zie="2026-04-21";function xc(e){return e?e.filter(t=>t.startDate>=Zie&&t.endDate).slice().sort((t,s)=>t.startDate<s.startDate?1:t.startDate>s.startDate?-1:0):[]}function ix(e,t){for(const s of xc(e))if(t>=s.startDate&&t<=s.endDate)return s}function Sd(e){return ix(e,Xie())}function xC(e,t){return t>=e.startDate&&t<=e.endDate}function XO(e){if(!e)return;const t=new Map,s=new Map;for(const r of e){let a=t.get(r.slug);a||(a={setCode:r.setCode,rank:0,slug:r.slug,displayName:r.displayName,avatarUrl:r.avatarUrl,events:0,wins:0,losses:0,trophies:0,points:0,lastFinishedAt:null},t.set(r.slug,a),s.set(r.slug,{twoWins:0,oneWins:0}));const o=s.get(r.slug);a.events+=1,a.wins+=r.wins,a.losses+=r.losses,r.wins>=Sc?a.trophies+=1:r.wins===2?o.twoWins+=1:r.wins===1&&(o.oneWins+=1),(!a.lastFinishedAt||r.eventTime>a.lastFinishedAt)&&(a.lastFinishedAt=r.eventTime)}for(const r of t.values()){const a=s.get(r.slug);r.points=jm(r.trophies,a.twoWins,a.oneWins)}return Array.from(t.values()).sort((r,a)=>(a.points??0)!==(r.points??0)?(a.points??0)-(r.points??0):a.trophies!==r.trophies?a.trophies-r.trophies:a.wins-r.wins).map((r,a)=>({...r,rank:a+1}))}const e8=["set","flashback","cube","mock"],Hn="season";function t8(e,t){return e.kind==="mock"?"mock":e.formatLabel||ds(e.setCode)?"cube":e.setCode===t?"set":"flashback"}function Yie(e,t){var s;return t8(e,((s=ix(t,e.eventDate))==null?void 0:s.code)??"")}function Qie(e,t){const s=new Map;for(const a of e??[]){if(a.kind==="mock")continue;const o=ix(t,a.eventDate);o&&s.set(o.code,(s.get(o.code)??0)+1)}const r=[];for(const a of xc(t)){const o=s.get(a.code);o&&r.push({season:a,count:o})}return r}function Jie(e,t){const s=new Map;for(const r of e??[]){const a=t(r);s.set(a,(s.get(a)??0)+1)}return e8.filter(r=>(s.get(r)??0)>0).map(r=>({key:r,count:s.get(r)}))}function Xie(){const e=new Date,t=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${e.getFullYear()}-${t}-${s}`}const ele=2,tle=4;function gC(e){const t=e.label!=null;return{code:e.code,name:e.label??e.code,startDate:"",endDate:"",isActive:!1,early:!t&&e.mocks>0,custom:t,shortCode:t&&e.code.length>tle?rs:void 0}}const sle=2,nle=2,_r="all",bC="format",rle="set",mh="set:";function yC(e,t){return e==="set"?t?`${t.code} Only`:"Live Sets":e==="flashback"?"Flashbacks":e==="cube"?"Peasant Cube":"Mock Drafts"}const ale=900,ole=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];function ww(e){const t=parseInt(e.slice(5,7),10),s=parseInt(e.slice(8,10),10);return{month:ole[t-1]??"",day:s}}function ile(e){return{setCode:e.setCode,slug:e.slug,displayName:e.displayName,avatarUrl:e.avatarUrl,rank:e.rank,trophies:e.trophies,score:e.points??0,events:e.events,wins:e.wins,losses:e.losses,lastCalculatedAt:e.lastFinishedAt??""}}function vC(){const{slug:e}=cn(),[t]=Rn(),{data:s}=zR(),{data:r}=un(),a=t.get(rle);if(!e&&a)return n.jsx(wn,{to:_w(a),replace:!0});if(!e)return n.jsx(wC,{});if(s===void 0||r===void 0)return n.jsx("div",{className:"bg-bg text-text min-h-screen flex flex-col",children:n.jsx(St,{subtitle:"POD DRAFTS"})});const o=s.find(c=>c.code.toLowerCase()===e.toLowerCase());if(o)return e!==o.code?n.jsx(wn,{to:`/pods/${o.code}`,replace:!0}):n.jsx(wC,{setCode:o.code});const i=xc(r).find(c=>c.code.toLowerCase()===e.toLowerCase());if(i)return n.jsx(wn,{to:`/pods?${Hn}=${i.code}`,replace:!0});const l=lle(e,s,r);return l?n.jsx(wn,{to:`/pods/${l.board}?${Hn}=${l.season}`,replace:!0}):n.jsx(Die,{})}
515function lle(e,t,s){const r=e.lastIndexOf("-");if(r<=0)return null;const a=t.find(i=>i.code.toLowerCase()===e.slice(0,r).toLowerCase()),o=xc(s).find(i=>i.code.toLowerCase()===e.slice(r+1).toLowerCase());return a&&o?{board:a.code,season:o.code}:null}function wC({setCode:e}={}){var Qe;const t=ut(ale),[s]=Rn(),{data:r}=un(),{data:a}=zR(),{data:o}=rY(!0),{data:i}=aY(!0);p.useEffect(()=>{window.scrollTo(0,0)},[e]);const l=p.useMemo(()=>{if(!r||!o||!a)return[];const X=new Set(a.map(ke=>ke.code));for(const ke of o){const $e=ix(r,ke.eventDate);$e&&X.add($e.code)}return xc(r).filter(ke=>X.has(ke.code))},[r,o,a]),c=s.get(Hn),d=!e&&c===_r,u=p.useMemo(()=>e||d?void 0:xc(r).find(ke=>ke.code===c)??Sd(r)??l[0],[e,d,c,l,r]),f=p.useMemo(()=>{if(!r||!a)return[];const X=new Map(r.map(Me=>[Me.code,Me])),ke=r.filter(Me=>a.some(Ue=>Ue.code===Me.code)),$e=a.filter(Me=>!X.has(Me.code)&&(Me.label==null||Me.events>=ele)).map(gC);return[...ke,...$e]},[r,a]),h=p.useMemo(()=>{var ke;const X=Sd(r);return X&&l.some($e=>$e.code===X.code)?X.code:((ke=l[0])==null?void 0:ke.code)??_s},[r,l]),m=(u==null?void 0:u.code)??e??h,y=p.useMemo(()=>e?o==null?void 0:o.filter(X=>X.setCode===e):void 0,[e,o]),b=p.useMemo(()=>{if(o)return d?o:e?y:u?o.filter(X=>X.kind==="mock"?X.setCode===u.code:xC(u,X.eventDate)):o},[o,d,e,y,u]),w=i,x=a==null?void 0:a.find(X=>X.code===m),g=u??f.find(X=>X.code===m)??(x?gC(x):void 0),v=p.useMemo(()=>Qie(y,r),[y,r]),k=p.useMemo(()=>{if(!e)return u?X=>t8(X,u.code):X=>Yie(X,r)},[e,u,r]),S=p.useMemo(()=>k?Jie(b,k):[],[b,k]),N=e8.find(X=>X===s.get(bC)),C=!!e&&!!(b!=null&&b.some(X=>X.kind==="mock")),_=S.some(X=>X.key===N),E=!b||(e?C&&N==="mock":_)?N:void 0,A=p.useMemo(()=>{var X;return e?(X=v.find(({season:ke})=>ke.code===c))==null?void 0:X.season:void 0},[e,c,v]),P=Bc(_r),M=p.useMemo(()=>{if(b){if(e){if(E==="mock")return b.filter(ke=>ke.kind==="mock");const X=g!=null&&g.early?b:b.filter(ke=>ke.kind!=="mock");return A?X.filter(ke=>xC(A,ke.eventDate)):X}return E&&k?b.filter(X=>k(X)===E):b.filter(X=>X.kind!=="mock")}},[b,e,g,A,E,k]),U=p.useMemo(()=>M&&new Set(M.map(X=>X.eventId)),[M]),F=p.useMemo(()=>{if(!(!w||!U))return XO(w.filter(X=>U.has(X.eventId)))},[w,U]),{switcherSets:I,switcherPins:q}=p.useMemo(()=>{var $e;if(!o||!a)return{switcherSets:[],switcherPins:[]};const X=f.filter(Me=>Me.early).map(Me=>Me.code);X.push("PEASANT");const ke=($e=Sd(r))==null?void 0:$e.code;return ke&&X.push(ke),{switcherSets:Cse(f,X),switcherPins:X}},[o,a,r,f]),[O,H]=p.useState(V6("pod")),B=p.useMemo(()=>{if(!F)return;const X=F.map(ile);return K6(X,O)},[F,O]),D=X=>{H(ke=>ke.key===X?{key:X,dir:ke.dir==="desc"?"asc":"desc"}:{key:X,dir:"desc"})},L=nf(6e4),{played:$,mock:V}=p.useMemo(()=>{const X=[],ke=[];for(const $e of M??[])$e.kind==="mock"?ke.push($e):($e.championDisplayName||new Date($e.eventTime).getTime()<=L)&&X.push($e);return{played:X,mock:ke}},[M,L]);Ic((Qe=$[0])==null?void 0:Qe.eventId);const z=E==="mock",K=Sd(r),W=K==null?void 0:K.code,J=p.useMemo(()=>{const X=!!(g!=null&&g.endDate)&&(!!g.early||g.code===W),ke=u??A??(e&&X?g:void 0);if(ke)return Ld(ke.startDate,ke.endDate);const $e=(M??[]).filter(Me=>Me.kind!=="mock").map(Me=>Me.eventDate).sort();return $e.length>0?Ld($e[0],$e[$e.length-1]):null},[u,A,e,g,W,M]),Z=t?16:18,Y=p.useMemo(()=>{const X={value:_r,label:"All Seasons",triggerLabel:"All Seasons",icon:n.jsx(gr,{size:20,className:"text-white shrink-0"})},ke=Me=>{const Ue=`${Me.code} Season`,Ve=Me.code===W?n.jsx("span",{className:"font-mono text-[10px] tracking-[0.18em] text-green shrink-0",children:"LIVE"}):void 0;return{value:Me.code,label:Ue,triggerLabel:Ue,glyphCode:Qt(Me),meta:Ve}},$e=Me=>({value:`${mh}${Me.code}`,label:Me.name,triggerLabel:Me.name,code:Me.code,glyphCode:Qt(Me),section:"By Set"});return[X,...l.map(ke),...I.map($e)]},[l,I,W]),ae=X=>{if(X.startsWith(mh))return _w(X.slice(mh.length));const ke=new URLSearchParams(e?"":s);return X===W?ke.delete(Hn):ke.set(Hn,X),{pathname:Cw,search:ke.toString()}},pe=p.useMemo(()=>{if(!e||v.length<sle)return[];const X={value:_r,label:"All Seasons",triggerLabel:"All Seasons",icon:n.jsx(gr,{size:20,className:"text-white shrink-0"})},ke=({season:$e})=>{const Me=`${$e.code} Season`;return{value:$e.code,label:Me,triggerLabel:Me,glyphCode:Qt($e)}};
515return[X,...v.map(ke)]},[e,v]),ye=p.useMemo(()=>C?[{value:_r,label:"Pod Drafts",icon:n.jsx(gr,{size:Z+2,className:"text-white shrink-0"})},{value:"mock",label:yC("mock",void 0),icon:n.jsx(TC,{bucket:"mock",seasonMeta:g,className:"text-white shrink-0",size:Z})}]:!k||S.length<nle?[]:[{value:_r,label:"All Formats",icon:n.jsx(uo,{size:Z-3,className:"text-white shrink-0"})},...S.map(({key:X})=>({value:X,label:yC(X,u),icon:n.jsx(TC,{bucket:X,seasonMeta:u??K,className:"text-white shrink-0",size:Z})}))],[C,g,k,S,u,K,Z]),De=t?"mobile":"desktop",Fe=X=>{var $e;const ke=($e=ye.find(Me=>Me.value===X.value))==null?void 0:$e.icon;return n.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:"flex justify-center shrink-0",style:{width:Z},children:ke}),n.jsx("span",{className:"truncate",children:X.label})]})},tt=e?`${mh}${e}`:d?_r:m,st=I.length>0?n.jsx(X1,{value:tt,options:Y,hrefFor:ae,variant:De,triggerClassName:t?void 0:"!min-w-0",searchable:!0}):null,ie=ye.length>0?n.jsx(yt,{value:E??_r,options:ye,hrefFor:X=>P(bC,X),variant:De,triggerClassName:t?void 0:"!min-w-0",renderValue:Fe,renderOption:Fe}):null,Se=pe.length>0?n.jsx(X1,{value:(A==null?void 0:A.code)??_r,options:pe,hrefFor:X=>P(Hn,X),variant:De,triggerClassName:t?void 0:"!min-w-0"}):null,Ie=n.jsxs("div",{className:"flex items-center gap-3 ml-4",children:[st,Se,ie]}),_e=A?`?${Hn}=${A.code}`:"",We=pY(m)?`/pods/${m}/data${_e}`:null,we=e?vw(e):null,He=X=>e?Gt(X.slug,e):E==="cube"?Gt(X.slug,X.setCode):`${wp}/${X.slug}?format=Pod`,{user:ee}=Qn(),{data:Q}=rf(ee==null?void 0:ee.discordId),re=p.useRef(null),fe=jC(re,t),Ee=p.useRef(null),qe=jC(Ee,t);return n.jsxs("div",{className:"bg-bg text-text min-h-screen flex flex-col page-fade",children:[t?n.jsxs("div",{ref:re,className:"page-chrome sticky top-0 z-10 bg-bg",children:[n.jsx(St,{subtitle:"POD DRAFTS"}),n.jsx(Tle,{scopeSelector:st,formatSelector:ie,windowSelector:Se,cardDataLink:We?n.jsx(_C,{href:We,variant:"mobile"}):void 0})]}):n.jsxs(n.Fragment,{children:[n.jsx(St,{subtitle:"POD DRAFTS"}),n.jsx(Rle,{board:e,boardMeta:g,season:u,liveSeasonCode:W,sets:I,pins:q,range:J})]}),n.jsx("main",{className:"flex-1 lg:pl-5 lg:pr-8 lg:pb-10",children:n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[3fr_2fr] gap-x-6 lg:gap-y-8",children:[n.jsx("section",{className:"order-1 lg:order-2 min-w-0 flex flex-col",children:z?t?n.jsx(xh,{events:V,stacked:!0}):n.jsx(NC,{}):t?n.jsx(_le,{played:$,loading:M===void 0,nowMs:L,activeSet:m,cubeCobraHref:we}):n.jsxs(n.Fragment,{children:[n.jsx(NC,{}),M===void 0?n.jsx(Cle,{}):$.length>0?n.jsx(dle,{events:$,nowMs:L}):n.jsxs("div",{children:[n.jsx(Ui,{label:"EVENTS",count:0,unit:"EVENTS"}),n.jsx(f8,{children:d?"No pod drafts recorded yet":`No pod drafts recorded yet for ${m}`})]}),V.length>0&&n.jsx(xh,{events:V})]})}),z?!t&&n.jsx("section",{className:"order-2 lg:order-1 min-w-0",children:n.jsx(xh,{events:V,controls:Ie})}):n.jsxs("section",{className:"order-2 lg:order-1 min-w-0",children:[t?n.jsxs("div",{ref:Ee,className:"sticky z-[9] bg-bg",style:{top:fe},children:[n.jsx(kC,{leaderboard:F,events:M&&$,compact:!0}),F!==void 0&&F.length>0&&n.jsx(Bv,{variant:"mobile",mode:"pod",sort:O,onSort:D})]}):n.jsx(kC,{leaderboard:F,events:M,center:We?n.jsx(_C,{href:We,variant:"center"}):void 0,controls:Ie}),n.jsx(zv,{rows:B,loading:F===void 0,variant:t?"mobile":"desktop",mode:"pod",showHeader:!t,sort:O,onSort:D,stickyTop:fe+qe,highlightSlug:Q??void 0,emptyMessage:d?"No player stats yet":`No player stats yet for ${m}`,playerHref:He})]}),t&&!z&&V.length>0&&n.jsx("section",{className:"order-3",children:n.jsx(xh,{events:V,stacked:!0})})]})}),n.jsx(Lu,{className:"mt-auto px-5 py-4 md:pt-5 md:pb-3 shrink-0"})]})}function jC(e,t){const[s,r]=p.useState(0);return p.useEffect(()=>{const a=e.current;if(!a){r(0);return}const o=()=>r(a.getBoundingClientRect().height);o();const i=new ResizeObserver(o);return i.observe(a),()=>i.disconnect()},[e,t]),s}function kC({leaderboard:e,events:t,controls:s,center:r,compact:a=!1}){return n.jsx(Ui,{label:"STANDINGS",count:e?e.length:void 0,unit:((e==null?void 0:e.length)??0)===1?"PLAYER":"PLAYERS",controls:s,center:r,compact:a,padLeftClass:"pl-5",meta:a?e&&t?n.jsxs("span",{className:"inline-flex items-baseline gap-2.5",children:[n.jsxs("span",{children:[n.jsx("span",{className:"tabular-nums text-subtle",children:e.length})," ",e.length===1?"PLAYER":"PLAYERS"]}),n.jsxs("span",{children:[n.jsx("span",{className:"tabular-nums text-subtle",children:t.length})," ",t.length===1?"EVENT":"EVENTS"]})]}):n.jsx("span",{className:"inline-block h-2.5 w-28 bg-surface2 animate-pulse"}):void 0})}function s8(e){const[t,s]=p.useState({}),r=o=>t[o]??o===e;return{isOpen:r,toggle:o=>s(i=>({...i,[o]:!r(o)}
515))}}const SC=20,cle=20;function n8(e){const[t,s]=p.useState(SC),r=p.useRef(null);p.useEffect(()=>s(SC),[e]);const a=p.useCallback(o=>{var i;(i=r.current)==null||i.disconnect(),o&&(r.current=new IntersectionObserver(l=>{l[0].isIntersecting&&s(c=>Math.min(c+cle,e))},{rootMargin:"600px"}),r.current.observe(o))},[e]);return{count:t,sentinelRef:a}}function dle({events:e,nowMs:t}){var o;const s=s8((o=e[0])==null?void 0:o.eventId),{count:r,sentinelRef:a}=n8(e.length);return n.jsxs("div",{children:[n.jsx(Ui,{label:"EVENTS",count:e.length,unit:e.length===1?"EVENT":"EVENTS"}),n.jsxs("div",{className:"flex flex-col lg:gap-2",children:[e.slice(0,r).map((i,l)=>n.jsx(db,{event:i,index:l,nowMs:t,open:s.isOpen(i.eventId),onToggle:()=>s.toggle(i.eventId)},i.eventId)),r<e.length&&n.jsx("div",{ref:a,className:"h-1","aria-hidden":!0})]})]})}const ule=1400;function NC(){const e=ut(ule);return n.jsxs("div",{children:[n.jsx(Ui,{label:"UPCOMING",meta:n.jsx(a8,{})}),n.jsxs("div",{className:"flex flex-col lg:gap-2",children:[n.jsx(o8,{}),n.jsx(r8,{iconsOnly:e})]})]})}const fle=["MON","TUE","WED","THU","FRI","SAT","SUN"],CC=2;function r8({iconsOnly:e=!1,mobile:t=!1}){const{data:s}=iY(),r=p.useMemo(()=>hle(s),[s]),[a,o]=p.useState(!1);if(r.length===0)return null;const i=new Date().toISOString().slice(0,10),l=(new Date().getDay()+6)%7,c=r.length>CC,d=a?r:r.slice(0,CC);return n.jsxs("div",{className:"relative bg-surface border-b border-border px-3 pt-2 pb-3 lg:px-4 lg:pt-2.5 lg:pb-5",children:[n.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:fle.map((u,f)=>n.jsx("div",{className:j("text-center font-display tracking-[0.12em] leading-none text-[12px]",f===l?"text-green":"text-muted"),children:u},u))}),n.jsx("div",{className:"flex flex-col gap-1",children:d.map(u=>n.jsx("div",{className:"grid grid-cols-7 gap-1",children:u.map(f=>n.jsx(mle,{day:f,today:f.day===i,past:f.day<i,iconsOnly:e},f.day))},u[0].day))}),c&&n.jsx(Ne,{label:a?"Collapse Calendar":"Expand Calendar",side:"top",delayDuration:hf,children:n.jsx("button",{type:"button",onClick:()=>o(u=>!u),"aria-label":a?"Collapse calendar":"Expand calendar",className:j("group absolute inset-x-0 bottom-0 flex items-end justify-center text-muted hover:text-green transition-colors",t?"translate-y-1.5":"translate-y-1"),children:n.jsx(fs,{size:18,className:j("transition-transform group-hover:translate-y-0.5",a&&"rotate-180 group-hover:-translate-y-0.5")})})})]})}function hle(e){if(!e)return[];const t=[];for(let s=0;s<e.length;s+=7)t.push(e.slice(s,s+7));return t}const ple={arrival:"bg-green/20 text-green",championship:"bg-gold/20 text-gold"};function mle({day:e,today:t,past:s,iconsOnly:r}){const{month:a,day:o}=ww(e.day),i=o===1?`${a} 1`:String(o),l=e.band?ple[e.band]:s?"bg-surface2/30 text-dim":"bg-surface2/60 text-text";return n.jsxs("div",{className:j("flex flex-col bg-bg border",r?"min-h-[58px]":"min-h-[76px]",t?"border-green":"border-border"),children:[n.jsx("div",{className:j("text-center font-display tabular-nums tracking-[0.04em] leading-none py-1",r?"text-[13px]":"text-[15px]",l),children:i}),n.jsx("div",{className:"flex-1 flex flex-col items-center justify-evenly px-1 py-0.5",children:e.entries.map((c,d)=>n.jsx(gle,{entry:c,past:s,iconsOnly:r},`${c.label}-${d}`))})]})}const xle={latest:"text-text",cube:"text-text",flashback:"text-blue",arrival:"text-green",championship:"text-gold"};function gle({entry:e,past:t,iconsOnly:s}){const r=e.glyph==="FLASHBACK"?"FLASHBACK":Qt({code:e.glyph,custom:!!vw(e.glyph)}),a=t?"text-dim":e.role==="championship"?"text-gold":e.role==="flashback"?"text-blue":"text-white";return n.jsxs("span",{className:j("flex items-center gap-1.5 min-w-0 max-w-full",t&&"opacity-60"),children:[n.jsx(Ae,{code:r,size:s?26:22,className:j("shrink-0",a)}),!s&&n.jsx("span",{className:j("font-display tracking-[0.02em] leading-none text-[15px] truncate",t?"text-dim":xle[e.role]),children:e.label})]})}function a8(){const e=Bie();return n.jsxs("span",{className:"flex items-center gap-3 whitespace-nowrap",children:[n.jsxs("span",{className:"flex items-center gap-2 font-display text-text tracking-[0.16em] leading-none",style:{fontSize:12},children:[n.jsx(Ov,{size:15,className:"text-subtle"}),"EVERY DAY"]}),em.map(t=>n.jsxs("span",{className:"flex items-baseline gap-2 border border-border2 bg-surface2/40 px-2.5 py-1.5",children:[n.jsx("span",{className:"font-display text-text tracking-[0.14em] leading-none",style:{fontSize:13},children:t.label}),n.jsx("span",{className:"font-display text-green tabular-nums tracking-[0.04em] leading-none",style:{fontSize:13},children:lb(t.easternHour)}),e&&n.jsx("span",{className:"font-display text-subtle tracking-[0.08em] leading-none",style:{fontSize:13},children:e})]},t.label))]})}function o8(){const e="flex flex-1 items-center justify-center gap-2.5 min-h-[46px] bg-green/10 no-underline text-green hover:bg-green/20 transition-colors font-display tracking-[0.14em] leading-none";return n.jsxs("div",{className:"flex items-stretch border-b border-border",children:[n.jsxs("a",{href:Zt.discordPods,target:"_blank",rel:"noreferrer",className:e,style:{fontSize:15},children:[n.jsx(la,{size:18}),"SIGN UP ON DISCORD"]}),n.jsxs(te,{to:"/pods/guide",className:j(e,"border-l border-green/30"),style:{fontSize:15},children:[n.jsx(Am,{size:16,strokeWidth:2}),"HOW TO PLAY",n.jsx(Jt,{size:14})]})]})}const jw="bg-surface border-b lg:border border-border first:lg:border-t-0 animate-fadeUpIn",hf=500;function kw(e){return{animationDelay:`${Math.min(e,6)*45}ms`}}function Sw(e){return e?"min-h-[44px]":"min-h-[52px]"}function Nw(e){return j("flex-1 min-w-0 flex items-center",e?"gap-2.5 py-2 pl-5 pr-2":"gap-4 py-2.5 px-4")}function i8({event:e,stacked:t,children:s}
515){const r=Qt({code:e.setCode,custom:e.formatLabel!=null});return n.jsxs("span",{className:j("flex items-center min-w-0 flex-1",t?"gap-2":"gap-2.5"),children:[n.jsx(Ae,{code:r,size:t?18:22,className:"text-white shrink-0"}),s]})}function l8({stacked:e,children:t}){return n.jsx("span",{className:"font-display text-text min-w-0 flex-1 truncate",style:{fontSize:e?16:18,letterSpacing:"0.04em",lineHeight:1.15},children:t})}function xh({events:e,stacked:t=!1,controls:s}){return n.jsxs("div",{children:[n.jsx(Ui,{label:"MOCK DRAFTS",count:e.length,unit:e.length===1?"DRAFT":"DRAFTS",compact:t,controls:s}),n.jsx("div",{className:"flex flex-col lg:gap-2",children:e.map((r,a)=>n.jsx(ble,{event:r,index:a,stacked:t},r.eventId))})]})}function ble({event:e,index:t,stacked:s=!1}){return n.jsxs("div",{className:j(jw,"flex items-stretch"),style:kw(t),children:[n.jsxs(te,{to:`/pods/${e.slug}`,className:j("group flex-1 min-w-0 flex items-stretch no-underline hover:bg-surface2/30 transition-colors",Sw(s)),children:[!s&&n.jsx(d8,{date:e.eventDate,highlighted:!1}),n.jsxs("div",{className:Nw(s),children:[n.jsx(i8,{event:e,stacked:s,children:n.jsx(l8,{stacked:s,children:Si(km(e.name,e.setCode).toUpperCase())})}),s&&n.jsx(u8,{event:e})]}),s&&n.jsx("div",{className:"flex items-center pl-2 pr-3 shrink-0 self-center",children:n.jsx(Jt,{size:14,className:"text-muted transition-colors group-hover:text-text"})})]}),!s&&n.jsx(c8,{slug:e.slug})]})}function db({event:e,index:t,nowMs:s,stacked:r=!1,open:a=!1,onToggle:o}){const i=a&&!!o,[l,c]=p.useState(!1),d=o&&!r?`/pods/${e.slug}`:null,u=j("group flex-1 min-w-0 flex items-stretch text-left bg-transparent border-0 no-underline transition-colors",Sw(r),o?"cursor-pointer":"cursor-default",i?"bg-surface2/40":"hover:bg-surface2/30"),f=n.jsxs(n.Fragment,{children:[!r&&n.jsx(d8,{date:e.eventDate,highlighted:i}),n.jsx(wle,{event:e,nowMs:s,stacked:r,titleLinkTo:d,onTitleHover:c}),n.jsx("div",{className:"flex items-center pl-2 pr-2.5 shrink-0 self-center",children:n.jsx(fs,{size:15,className:j("text-muted transition-all duration-200 group-hover:text-text",i&&"rotate-180 text-text")})})]});return n.jsxs("div",{className:j(jw,"transition-colors",i&&"bg-surface2/40"),style:kw(t),children:[n.jsxs("div",{className:"flex items-stretch",children:[o?n.jsxs("div",{className:j(u,"relative"),children:[n.jsx(Ne,{label:i?"Hide Standings":"Show Standings",side:"top",delayDuration:hf,children:n.jsx("button",{type:"button",onClick:o,"aria-expanded":i,"aria-label":i?"Hide standings":"Show standings",className:"absolute inset-0 bg-transparent border-0 cursor-pointer"})}),n.jsx("div",{className:"relative flex-1 min-w-0 flex items-stretch pointer-events-none",children:f})]}):n.jsx(te,{to:`/pods/${e.slug}`,className:u,children:f}),!r&&n.jsx(c8,{slug:e.slug,highlighted:l})]}),n.jsx("div",{className:j("grid transition-[grid-template-rows] duration-200 ease-out",i?"grid-rows-[1fr]":"grid-rows-[0fr]"),"aria-hidden":!i,children:n.jsx("div",{className:"overflow-hidden",children:i&&n.jsxs(n.Fragment,{children:[n.jsx(Nle,{event:e}),r&&n.jsx(vle,{slug:e.slug})]})})})]})}function yle({event:e,stacked:t}){const{data:s}=Ic(t?void 0:e.eventId),r=p.useMemo(()=>{const a=(s??[]).filter(o=>o.seatIndex!=null);return a.length===0?null:VO(a).find(o=>o.won)??null},[s]);return r?n.jsxs("div",{className:"flex items-center gap-2.5 shrink-0 min-w-0",children:[n.jsx(ct,{size:15,color:"#ffc63a"}),r.members.map(a=>n.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[n.jsx(Jp,{name:$s(a),avatarUrl:a.avatarUrl,size:t?20:22,teamSide:r.team==="A"?"A":"B"}),n.jsx(Be,{colors:Bt(a.deckColors),size:12})]},a.displayName))]}):n.jsx("span",{className:"shrink-0 font-display tracking-[0.16em] leading-none text-muted",style:{fontSize:13},children:"TEAM DRAFT"})}function c8({slug:e,highlighted:t=!1}){return n.jsx(Ne,{label:"View Pod Breakdown",side:"top",align:"end",delayDuration:hf,children:n.jsxs(te,{to:`/pods/${e}`,"aria-label":"View pod breakdown",className:j(`group/details flex shrink-0 items-center justify-center gap-1.5 self-stretch pl-4 pr-2.5 bg-bg
516            border-l border-border text-subtle no-underline transition-colors
517            hover:border-green/60 hover:bg-green/10 hover:text-green`,t&&"border-green/60 bg-green/10 text-green"),children:[n.jsx(gr,{size:22,className:"shrink-0"}),n.jsx(Jt,{size:13,className:j("shrink-0 transition-transform group-hover/detail
517s:translate-x-0.5",t&&"translate-x-0.5")})]})})}function vle({slug:e}){return n.jsxs(te,{to:`/pods/${e}`,className:`group/footer relative flex items-center justify-center gap-2 px-10 min-h-[40px] bg-surface2/20
518        border-t border-dashed border-border2 no-underline text-subtle hover:text-green hover:bg-green/10 transition-colors`,children:[n.jsx(gr,{size:18,className:"shrink-0"}),n.jsx("span",{className:"font-display tracking-[0.14em] leading-none",style:{fontSize:12},children:"VIEW POD BREAKDOWN"}),n.jsx(Jt,{size:13,className:"absolute right-3 shrink-0 transition-transform group-hover/footer:translate-x-0.5"})]})}function d8({date:e,highlighted:t}){const{month:s,day:r}=ww(e);return n.jsxs("div",{className:j("flex flex-col items-center justify-center border-r transition-colors px-2.5 min-w-[64px]",t?"bg-surface2 border-border2":"bg-surface2/40 border-border group-hover:bg-surface2/70"),children:[n.jsx("span",{className:"font-display text-muted leading-none tracking-[0.06em] text-[14px]",children:s}),n.jsx("span",{className:"font-display text-text leading-none tabular-nums mt-1 text-[21px]",children:String(r).padStart(2,"0")})]})}function u8({event:e}){const{month:t,day:s}=ww(e.eventDate);return n.jsxs("span",{className:"font-display text-subtle tabular-nums leading-none tracking-[0.08em] shrink-0 ml-1.5",style:{fontSize:13},children:[t," ",String(s).padStart(2,"0")]})}function wle({event:e,nowMs:t,stacked:s=!1,titleLinkTo:r=null,onTitleHover:a}){const o=!e.isFinalized&&new Date(e.eventTime).getTime()<=t,{data:i}=UR(o?e.eventId:void 0),l=p.useMemo(()=>{if(!i||i.length===0)return null;let f=null,h=1;for(const y of i)y.round>h&&(h=y.round),y.reportedAt==null&&(f==null||y.round<f)&&(f=y.round);return Math.min(f??h,e.totalRounds)},[i,e.totalRounds]),c=n.jsx(BJ,{event:e}),d=n.jsx(l8,{stacked:s,children:r?n.jsx(Ne,{label:"View Pod Breakdown",side:"top",align:"start",delayDuration:hf,children:n.jsx(te,{to:r,onMouseEnter:()=>a==null?void 0:a(!0),onMouseLeave:()=>a==null?void 0:a(!1),onFocus:()=>a==null?void 0:a(!0),onBlur:()=>a==null?void 0:a(!1),className:"pointer-events-auto no-underline text-inherit transition-colors hover:text-green",children:c})}):c}),u=n.jsxs(n.Fragment,{children:[e.isTeamDraft&&n.jsx(yle,{event:e,stacked:s}),e.championDisplayName&&n.jsx(jle,{event:e,stacked:s}),o&&l!=null&&n.jsx(kle,{round:l,stacked:s})]});return n.jsxs("div",{className:Nw(s),children:[n.jsx(i8,{event:e,stacked:s,children:d}),u,s&&n.jsx(u8,{event:e})]})}function jle({event:e,stacked:t}){return n.jsxs("div",{className:j("flex items-center min-w-0 shrink",t?"gap-1.5 max-w-[52%]":"max-w-[60%] gap-2.5"),children:[!t&&n.jsx("span",{className:"hidden xl:block",children:n.jsx(as,{displayName:e.championDisplayName??"",avatarUrl:e.championAvatarUrl,size:22})}),n.jsx("span",{className:"font-display text-text tracking-[0.04em] truncate",style:{fontSize:t?14:16,lineHeight:1},children:_c(e.championDisplayName??"").toUpperCase()}),e.championDeckColors&&n.jsx("span",{className:"shrink-0 flex",children:n.jsx(Be,{colors:F3(e.championDeckColors),size:OO(e.championDeckColors,t?12:13)})}),n.jsx(ct,{size:t?14:15,color:"#ffc63a"})]})}function kle({round:e,stacked:t}){return n.jsxs("span",{className:"shrink-0 font-display text-subtle tracking-[0.18em] leading-none",style:{fontSize:t?11:12},children:["ROUND ",e]})}const Sle=8;function Nle({event:e}){const{data:t,isLoading:s}=Ic(e.eventId),[r,a]=p.useState(null),{data:o}=of(e.eventId),i=ox(e),l=p.useMemo(()=>o&&(r==null?void 0:r.seatIndex)!=null?mc(o,r.seatIndex):null,[o,r]),c=p.useMemo(()=>t?[...t].sort(ff):[],[t]),d=u=>{if(!r||c.length===0)return;const f=c.indexOf(r);if(f!==-1)for(let h=1;h<=c.length;h++){const m=c[((f+u*h)%c.length+c.length)%c.length];if(i.canViewSeat(m.avatarUrl)){a(m);return}}};return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"border-t border-dashed border-border2",children:n.jsx("div",{className:"flex flex-col gap-[1px] pb-[1px] bg-bg",children:s?Array.from({length:Sle}).map((u,f)=>n.jsx(gw,{cols:YN,compact:!0},f)):c.map((u,f)=>n.jsx(xw,{p:i.canViewSeat(u.avatarUrl)?u:{...u,deckColors:null},rank:u.placement??f+1,cols:YN,compact:!0,teamSide:e.isTeamDraft?GO(u.seatIndex):null,nameHref:u.playerSlug?Gt(u.playerSlug,e.setCode):null,logHref:o&&i.canViewSeat(u.avatarUrl)?sa(e.slug,u):null,deckHref:u.deckScreenshotUrl&&i.canViewSeat(u.avatarUrl)?ta(e.slug,$s(u),$s(u)):null,onShowDeck:()=>a(u)},`${u.eventId}-${u.displayName}`))})}),r&&n.jsx(Fc,{participant:{eventId:r.eventId,displayName:$s(r),participantDisplayName:r.displayName,deckColors:r.deckColors,deckScreenshotUrl:r.deckScreenshotUrl,deckScreenshotCaption:r.deckScreenshotCaption,mainboard:l,record:r.record},draftLogHref:o&&i.canViewSeat(r.avatarUrl)?sa(e.slug,r):null,breakdownHref:wr(e.slug,$s(r)),onClose:()=>a(null),onPrev:()=>d(-1),onNext:()=>d(1)})]})}function ub({index:e,stacked:t=!1}){return n.jsxs("div",{className:j(jw,"flex items-stretch",Sw(t)),style:kw(e),children:[!t&&n.jsxs("div",{className:"px-3 min-w-[64px] bg-surface2/40 border-r border-border flex flex-col items-center justify-center gap-1.5",children:[n.jsx("div",{className:"h-3.5 w-9 bg-surface2 animate-pulse"}),n.jsx("div",{className:"h-4 w-7 bg-surface2 animate-pulse"})]}),n.jsxs("div",{className:Nw(t),children:[n.jsx("div",{className:"h-4 w-1/2 bg-surface2 animate-pulse"}),t&&n.jsx("div",{className:"h-3 w-12 bg-surface2 animate-pulse ml-auto"})]})]})}function Cle(){return n.jsxs("div",{children:[n.jsx(Ui,{label:"EVENTS",unit:"EVENTS"}),n.jsx("div",{className:"flex flex-col lg:gap-2",children:[0,1,2].map(e=>n.jsx(ub,{index:e},e))})]})}function _le({played:e,loading:t,nowMs:s,activeSet:r,cubeCobraHref:a}){const[o,i]=p.useState("upcoming"),l=s8(void 0),{count:c,sentinelRef:d}=n8(e.length);return n.jsxs("div",{children:[n.jsxs("div",{className:"flex border-b border-border",children:[n.jsx(Xp,{active:o==="upcoming",onClick:()=>i("upcoming"),children:"UPCOMING"}),n.jsx(Xp,{active:o==="all",onClick:()=>i("all"),children:"PAST EVENTS"})]}),o==="upcoming"?n.jsxs(n.Fragment,{children:[n.jsx(o8,{}),n.jsx("div",{className:"px-3 py-2.5 border-b border-border bg-surface flex justify-center",children:n.jsx(a8,{})}),n.jsx(r8,{iconsOnly:!0,mobile:!0}),(t||e[0])&&n.jsx(Ui,{label:"LAST EVENT",compact:!0,meta:a?n.jsx(Ele,{href:a}):void 0}),t?n.jsx(ub,{index:0,stacked:!0}):e[0]&&n.jsx(db,{event:e[0],index:0,nowMs:s,stacked:!0,open:l.isOpen(e[0].eventId),onToggle:()=>l.toggle(e[0].eventId)})]}):t?n.jsx("div",{className:"flex flex-col",children:[0,1,2,3].map(u=>n.jsx(ub,{index:u,stacked:!0},u))}):e.length===0?n.jsxs(f8,{children:["No pod drafts recorded yet for ",r]}):n.jsxs("div",{className:"flex flex-col",children:[e.slice(0,c).map((u,f)=>n.jsx(db,{event:u,index:f,nowMs:s,stacked:!0,open:l.isOpen(u.eventId),onToggle:()=>l.toggle(u.eventId)},u.eventId)),c<e.length&&n.jsx("div",{ref:d,className:"h-1","aria-hidden":!0})]})]})}function f8({children:e}){return n.jsx("div",{className:"text-muted text-[13px] py-4 px-2 bg-surface border border-border",children:e})}function Tle({scopeSelector:e,formatSelector:t,windowSelector:s,cardDataLink:r}){return e?n.jsxs("div",{className:"px-3 py-2 border-b border-border bg-surface flex items-stretch gap-2",children:[n.jsx("div",{className:"flex-1 min-w-0 flex",children:e}),s&&n.jsx("div",{className:"flex-1 min-w-0 flex",children:s}),t&&n.jsx("div",{className:"flex-1 min-w-0 flex",children:t}),r&&n.jsx("div",{className:"flex-1 min-w-0 flex",children:r})]}):n.jsx("div",{className:"px-3 py-2 border-b border-border bg-surface flex items-stretch gap-2",children:[0,1].map(a=>n.jsx("div",{className:"basis-1/2 min-w-0 border border-border2 px-2.5 py-1.5",children:n.jsx("div",{className:"h-[21px] bg-surface2 animate-pulse"})},a))})}function Ele({href:e}){return n.jsxs("a",{href:e,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 no-underline text-green transition-colors hover:text-green/70 font-display text-[12px] tracking-[0.14em] leading-none",children:["VIEW CUBECOBRA LIST",n.jsx(LT,{size:14,className:"shrink-0"})]})}function _C({href:e,variant:t}){return t==="mobile"?n.jsxs(te,{to:e,className:"w-full flex items-center justify-center gap-2 border border-green/40 text-green transition-colors hover:bg-green/10 no-underline font-display text-[13px] tracking-[0.14em] leading-none",children:[n.jsx(o6,{size:16}),"VIEW CARD DATA",n.jsx(Jt,{size:14,className:"shrink-0"})]}):n.jsxs(te,{to:e,className:"group inline-flex items-center gap-2 font-display text-[15px] tracking-[0.14em] leading-none text-subtle transition-colors hover:text-green",children:["VIEW CARD DATA",n.jsx(Jt,{size:14,className:"shrink-0 transition-transform group-hover:translate-x-0.5"})]})}function TC({bucket:e,seasonMeta:t,className:s,size:r=16}){return e==="mock"?n.jsx(iQ,{size:Math.round(r*1.15),className:s}):e==="set"?t?n.jsx(Ae,{code:Qt(t),size:r,className:s}):n.jsx(i6,{size:r,className:s}):e==="flashback"?n.jsx(Ae,{code:"FLASHBACK",size:Math.round(r*1.22),className:s}):n.jsx(Ae,{code:rs,size:r,className:s})}function Rle({board:e,boardMeta:t,season:s,liveSeasonCode:r,sets:a,pins:o,range:i}){var u;const l=s?W3(s):null,c=(e??(s==null?void 0:s.code))===r,d=s?`${s.code} SEASON`:"ALL SEASONS";return n.jsxs("div",{className:"relative px-10 py-5 border-b border-border bg-surface flex items-center gap-6",children:[e?n.jsx(Ae,{code:t?Qt(t):e,size:84}):n.jsx(gr,{size:84,className:"text-text"}),n.jsxs("div",{children:[n.jsx(Xe,{size:13,className:j("text-green",!c&&"invisible"),children:"LIVE"}),n.jsxs("div",{className:"flex items-baseline gap-3.5 mt-0.5",children:[n.jsx("span",{className:"font-display tracking-[0.04em]",style:{fontSize:56,lineHeight:.9},children:e??"POD DRAFTS"}),n.jsx(Ale,{label:e?((u=t==null?void 0:t.name)==null?void 0:u.toUpperCase())??"":d,cubeHref:e?vw(e):null})]}),n.jsx("div",{className:"font-mono text-[11px] text-muted mt-1 flex items-center justify-between gap-4 h-4",children:(e||s)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:i||" "}),l&&n.jsx("span",{children:l})]})})]}),n.jsx("div",{className:"flex-1"}),a.length>0&&n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx(rP,{icon:n.jsx(gr,{size:22}),label:"ALL",active:!e,href:Cw}),n.jsx(sw,{sets:a,pins:o,activeCode:e??"",hrefFor:_w,extraHide:1})]})]})}const Cw="/pods",_w=e=>`${Cw}/${e}`;function Ale({label:e,cubeHref:t}){const s="font-display text-[22px] text-muted tracking-[0.06em]";return t?n.jsx(Ne,{label:"View in CubeCobra",side:"top",delayDuration:hf,children:n.jsxs("a",{href:t,target:"_blank",rel:"noreferrer",className:j(s,"group inline-flex items-center gap-1 no-underline transition-colors hover:text-green"),children:[e,n.jsx(LT,{size:18,className:"shrink-0 transition-transform group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]})}):n.jsx("span",{className:s,children:e})}const gc=[{id:"how",label:"How to play",icon:Am},{id:"signup",label:"Signing up",icon:Tz},{id:"draft",label:"Drafting",icon:sB}
518,{id:"rounds",label:"Round Pairings",tabLabel:"Pairings",icon:aB},{id:"podium",label:"Podium",icon:ev},{id:"seasons",label:"Seasons",icon:DT,iconClassName:"relative -top-[2px]"},{id:"organizers",label:"Organizers",icon:Jz}],Ple="organizers",h8="rounded-xl border border-border bg-surface",Ole="https://draftmancer.com",Lle="how-to-draft-for-free-with-the-llu-community",Dle=new Map(gc.map(e=>[e.id,e]));function Ile(){const[e,t]=p.useState(gc[0].id),s=Rt(),r=p.useRef(!1),a=p.useRef(0);p.useEffect(()=>{const i=new IntersectionObserver(l=>{if(!r.current)for(const c of l)c.isIntersecting&&t(c.target.id)},{rootMargin:"-15% 0px -75% 0px"});for(const l of gc){const c=document.getElementById(l.id);c&&i.observe(c)}return()=>i.disconnect()},[]),p.useEffect(()=>{const i=s.hash.slice(1);if(!i)return;const l=document.getElementById(i);if(!l)return;const c=requestAnimationFrame(()=>l.scrollIntoView({block:"start"}));return()=>cancelAnimationFrame(c)},[s.hash]);const o=i=>l=>{if(!No(l))return;l.preventDefault();const c=document.getElementById(i);if(!c)return;t(i),history.replaceState(null,"",`#${i}`),r.current=!0;const d=++a.current;c.scrollIntoView({behavior:"smooth",block:"start"});const u=performance.now();let f=window.scrollY,h=0;const m=()=>{if(a.current!==d)return;const y=window.scrollY;h=Math.abs(y-f)>=1?0:h+1,f=y;const b=performance.now()-u;if(h>4&&b>140||b>1600){r.current=!1;return}requestAnimationFrame(m)};requestAnimationFrame(m)};return n.jsx($c,{subtitle:"POD DRAFTS",children:n.jsxs("div",{className:"flex min-h-full flex-1",children:[n.jsx("aside",{className:"hidden lg:block shrink-0 self-stretch w-[clamp(200px,15vw,220px)] border-r border-border bg-surface",children:n.jsx("div",{className:"sticky top-0 max-h-screen overflow-y-auto overflow-x-hidden",children:n.jsx($le,{active:e,onNavigate:o})})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx(Mle,{active:e,onNavigate:o}),n.jsx(Ule,{})]})]})})}function Mle({active:e,onNavigate:t}){const s=p.useRef(null);return p.useEffect(()=>{var a;const r=(a=s.current)==null?void 0:a.querySelector(`[data-tab="${e}"]`);r==null||r.scrollIntoView({inline:"center",block:"nearest",behavior:"smooth"})},[e]),n.jsx("nav",{"aria-label":"Guide sections",className:"lg:hidden sticky top-0 z-10 border-b border-border bg-surface",children:n.jsx("div",{ref:s,className:"flex h-11 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:gc.map(r=>{const a=r.icon,o=e===r.id;return n.jsxs("a",{"data-tab":r.id,href:`#${r.id}`,onClick:t(r.id),className:j("relative flex h-full shrink-0 items-center gap-1.5 px-3 font-display text-[15px] tracking-[0.09em] whitespace-nowrap no-underline transition-colors","after:absolute after:inset-x-0 after:-bottom-px after:h-[3px] after:content-['']",o?"text-green after:bg-green":"text-muted after:bg-transparent hover:text-text"),children:[n.jsx(a,{size:15,strokeWidth:2,className:j("shrink-0",r.iconClassName)}),r.tabLabel??r.label]},r.id)})})})}function $le({active:e,onNavigate:t}){return n.jsxs("nav",{"aria-label":"On this page",children:[n.jsx(PA,{icon:Hm,iconSize:27,label:"POD GUIDE"}),n.jsx("div",{children:gc.map(s=>n.jsxs("div",{children:[s.id===Ple?n.jsx("div",{className:"mx-4 my-2 border-t border-border"}):null,n.jsx($o,{label:s.label,icon:s.icon,active:e===s.id,href:`#${s.id}`,onClick:t(s.id)})]},s.id))})]})}function Ule(){const e=lb(em[0].easternHour),t=lb(em[1].easternHour);return n.jsx(Fp,{className:"py-5 md:py-7",children:n.jsxs("div",{className:"flex flex-col gap-4 md:gap-5",children:[n.jsx(Uo,{id:"how",titleOnDesktop:!1,watermark:!0,maxWidthClass:"lg:max-w-[1600px]",children:n.jsxs("div",{className:"grid lg:grid-cols-[4fr_5fr_5fr]",children:[n.jsxs(Lg,{n:1,title:"Sign up on Discord",href:Zt.discordPods,icon:n.jsx(la,{size:18,className:"shrink-0"}),children:[n.jsxs(at,{children:[n.jsx(bce,{})," posts the daily schedule in ",n.jsx(yce,{})]}),n.jsxs(at,{children:["Choose ",n.jsx(mt,{children:"Early"})," (",e,") or ",n.jsx(mt,{children:"Late"})," (",t,")"]}),n.jsx(at,{children:"Pod event thread opens at 5 players"})]}),n.jsxs(Lg,{n:2,title:"Draft on Draftmancer",href:Ole,hideArrow:!0,icon:n.jsx(RC,{src:"draftmancer.png",size:24,style:{filter:Hle}}),children:[n.jsxs(at,{children:["Link is posted in the Discord thread ",n.jsx(mt,{children:"10 minutes before"})," start"]}),n.jsxs(at,{children:["Set your"," ",n.jsx(Ne,{label:"ArenaID#12345",children:n.jsx("strong",{className:"cursor-default font-medium text-text",children:"Arena name"})})," ","in Draftmancer"]}),n.jsxs(at,{children:["Press ",n.jsx(mt,{children:"Export"})," to copy your decklist into Arena"]})]}),n.jsxs(Lg,{n:3,title:"Play on MTG Arena",icon:n.jsx(RC,{src:"mtga.png",size:20}),children:[n.jsx(at,{children:"Bot posts pairings at the start of each round"}),n.jsxs(at,{children:["Challenge your opponent to a ",n.jsx(mt,{children:"Limited Tournament Match"})]}),n.jsx(at,{children:"Report your result in Discord after each match"})]})]})}),n.jsx(xce,{}),n.jsx(Uo,{id:"signup",aside:n.jsx(Qle,{}),children:n.jsxs(dd,{className:"mt-2 lg:mt-6",children:[n.jsx(at,{children:"Press a Pod Format button to sign up"}),n.jsxs(at,{children:[n.jsx(mt,{children:"Early"})," aimed at Europe, ",n.jsx(mt,{children:"Late"})," at America"]}),n.jsx(at,{children:"Pods need at least 6 players to draft"}),n.jsx(at,{children:"Notifications are sent when the lobby is ready"}),n.jsx(at,{children:"Press Leave if you can no longer attend"})]})}),n.jsx(Uo,{id:"draft",aside:n.jsx(ece,{}),children:n.jsxs(dd,{className:"mt-2 lg:mt-6",children:[n.jsx(at,{children:"Ready Check starts when everyone is in Draftmancer"}
518),n.jsxs(at,{children:["Finish deckbuilding after the draft, then press ",n.jsx(mt,{children:"Export"})]}),n.jsxs(at,{children:[n.jsx(mt,{children:"Import"})," your deck on Arena and adjust your lands"]}),n.jsx(at,{children:"Drop unwanted cards from your sideboard"}),n.jsx(at,{children:"Craft any cards you don't own"})]})}),n.jsx(Uo,{id:"rounds",aside:n.jsx(nce,{}),children:n.jsxs(dd,{children:[n.jsx(at,{children:"Pods of 6 play Team Draft, 8~10 play Swiss"}),n.jsx(at,{children:"If there's more than 10 players, the bot creates separate tables"}),n.jsx(at,{children:"Report your match from the thread or your DMs"}),n.jsx(at,{children:"The next round starts as soon as a match can be played"})]})}),n.jsx(Uo,{id:"podium",aside:n.jsx(hce,{}),children:n.jsxs(dd,{children:[n.jsx(at,{children:"Post your deck screenshot and submit colors in the thread"}),n.jsx(at,{children:"Decks, standings, draft logs and replays are all tracked"}),n.jsx(at,{children:"Match wins earn Points on the Leaderboard"})]})}),n.jsx(Uo,{id:"seasons",aside:n.jsx(mce,{}),children:n.jsxs(dd,{children:[n.jsx(at,{children:"Latest Set pods run every day of the season"}),n.jsx(at,{children:"Flashbacks and Cube are added to the schedule later on"}),n.jsx(at,{children:"Every draft counts towards the Leaderboard"}),n.jsxs(at,{children:["Top of the Leaderboard gets a seat at the ",n.jsx(mt,{children:"Set Champion"})," 👑 event, streamed live the weekend before the next set's prerelease"]}),n.jsxs(at,{children:["The top drafter of the season earns the ",n.jsx(mt,{children:"Pod Champion"})," ⚜️ role to wear until the next set"]})]})}),n.jsx(Fle,{})]})})}function Uo({id:e,titleOnDesktop:t=!0,maxWidthClass:s,watermark:r,aside:a,belowAside:o,headingAside:i,children:l}){const c=Dle.get(e)??gc[0],d=c.icon,u=s??(a?"lg:max-w-[1260px]":"lg:max-w-[820px]"),f=n.jsxs("div",{className:j(t?"relative mb-5 flex items-center":"hidden"),children:[n.jsxs("h2",{className:"relative flex items-center gap-3 font-display text-text text-[22px] md:text-[26px] xl:text-[30px] leading-[0.95] tracking-[0.03em]",children:[n.jsx(d,{size:26,strokeWidth:2,className:j("-ml-[3px] shrink-0 text-green",c.iconClassName)}),c.label]}),i]});return n.jsxs("section",{id:e,className:j(h8,"group relative scroll-mt-[52px] lg:scroll-mt-4 overflow-hidden p-5 md:p-6",u),children:[r?n.jsx(d,{size:96,strokeWidth:1.25,className:"pointer-events-none absolute right-4 top-3 hidden md:block text-border2/40 opacity-30 transition-[opacity,color] duration-300 group-hover:opacity-100 group-hover:text-green/[0.14]"}):null,a?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"relative flex flex-col gap-5 min-[1180px]:flex-row min-[1180px]:items-start min-[1180px]:gap-6 min-[1520px]:gap-8",children:[n.jsxs("div",{className:"w-full max-w-[720px] min-w-0 min-[1180px]:max-w-none min-[1180px]:flex-1 min-[1520px]:flex-none min-[1520px]:w-[580px] min-[1520px]:shrink-0",children:[f,l]}),n.jsx("div",{className:"w-full max-w-[600px] min-[1180px]:w-[500px] min-[1180px]:max-w-none min-[1180px]:shrink-0 min-[1520px]:w-[600px]",children:a})]}),o?n.jsx("div",{className:"relative",children:o}):null]}):n.jsxs(n.Fragment,{children:[f,n.jsx("div",{className:"relative",children:l})]})]})}function dd({children:e,className:t}){return n.jsx("ul",{className:j("flex flex-col gap-2.5 pl-1",t),children:e})}function at({children:e,className:t}){return n.jsxs("li",{className:j("flex gap-3 text-subtle text-[14px] md:text-[15px] xl:text-[16px] leading-[1.55]",t),children:[n.jsx("span",{className:"flex h-[1.55em] w-3 shrink-0 items-center justify-center",children:n.jsx("span",{className:"h-[5px] w-[5px] rotate-45 bg-green"})}),n.jsx("span",{className:"flex-1",children:e})]})}const zle=[{title:"Scheduling Pods",body:n.jsxs(n.Fragment,{children:[n.jsxs("li",{children:["Use ",n.jsx(ud,{children:"/draft"})," to create a pod for now or at a specific time"]}),n.jsxs("li",{children:["Select an existing format or ",n.jsx(mt,{children:"Write-In"})," for a set or cube not covered by the list"]}),n.jsxs("li",{children:["Turn on ",n.jsx(mt,{children:"Notifications"})," wisely if you must"]})]}),preview:n.jsx(lce,{})},{title:"Format Schedule Vote",body:n.jsxs(n.Fragment,{children:[n.jsx("li",{children:"Flashback formats are scheduled for the season based on community votes"}),n.jsxs("li",{children:["Run ",n.jsx(ud,{children:"/pod-schedule"})," to view the set calendar"]})]})},{title:"10+ Player Pods",body:n.jsxs(n.Fragment,{children:[n.jsx("li",{children:"Bot handles this by holding the lobby link while people confirm attendance, then splits into different tables after 10 min"}),n.jsxs("li",{children:["Organizers can 🚀 ",n.jsx(mt,{children:"Open Tables"})," as soon as everyone is accounted for"]}),n.jsxs("li",{children:["Run ",n.jsx(ud,{children:"/pod-table"})," to add another table manually"]})]})},{title:"Looking For More",body:n.jsxs(n.Fragment,{children:[n.jsxs("li",{children:["When a pod needs more players, write ",n.jsx(ud,{children:"!pod"})," in any channel to post a quick link to it"]}),n.jsxs("li",{children:["🪑 ",n.jsx(mt,{children:"Waitlist"})," indicates the last to sign up and decides who would have to drop if there's only 7 or 9 players"]})]})},{title:"Pod Settings",body:n.jsxs(n.Fragment,{children:[n.jsxs("li",{children:["Open ⚙️ ",n.jsx(mt,{children:"Settings"})," to see the configuration options"]}),n.jsxs("li",{children:["Set ",n.jsx(mt,{children:"Max Players"})," if you need to increase table size"]}),n.jsxs("li",{children:["Use 📝 ",n.jsx(mt,{children:"Details"})," to rename or provide extra info"]})]}),preview:n.jsx(cce,{})},{title:"Team Drafts",body:n.jsxs(n.Fragment,{children:[n.jsx("li",{children:"Recommended for 6 player pods for easier pairings"}),n.jsx("li",{children:"No communication during the draft"}),n.jsx("li",{children:"Each team gets its own private thread and voice room"})]})},{title:"Pick 2 Drafts",body:n.jsxs(n.Fragment,{children:[n.jsx("li",{children:"When a Pod has only 4 players, you can choose to play Pick 2 if everyone agrees"}),n.jsx("li",{children:"1 hour before start, the bot opens a thread with 4 players to give them time to organize"})]})},{title:"Restarting or Canceling",body:n.jsxs(n.Fragment,{children:[n.jsxs("li",{children:["♻️ ",n.jsx(mt,{children:"Restart Draft"})," discards an ongoing draft and allows to start over"]}),n.jsxs("li",{children:["🕐 ",n.jsx(mt,{children:"Reschedule"})," to move the starting time"]}),n.jsxs("li",{children:["🗑️ ",n.jsx(mt,{children:"Cancel Draft"})," if the pod is no longer happening"]})]})},{title:"Fixing Incorrect Results",body:n.jsx(n.Fragment,{children:n.jsxs("li",{children:["🔧 ",n.jsx(mt,{children:"Manage Rounds"})," if a match was incorrectly reported and the round has already advanced"]})})},{title:"Removing Players",body:n.jsxs(n.Fragment,{children:[n.jsxs("li",{children:["🏳️ ",n.jsx(mt,{children:"Drop Player"})," if someone has to leave and can't continue playing, remaining matches become a ",n.jsx("em",{children:"bye"})," for their opponent"]}),n.jsxs("li",{children:["🔨 ",n.jsx(mt,{children:"Kick Player"})," before the draft starts if needed"]})]})},{title:"Disconnects",body:n.jsxs(n.Fragment,{children:[n.jsx("li",{children:"Wait up to 2 minutes in case of a temporary disconnect"}),n.jsxs("li",{children:["♻️ ",n.jsx(mt,{children:"Restart Draft"})," to find someone to take their spot"]}),n.jsxs("li",{children:["🤖 ",n.jsx(mt,{children:"Replace With Bot"})," to play on with a ",n.jsx("em",{children:"bye"})," each round"]}
518)]})},{title:"Mock Drafts",body:n.jsxs(n.Fragment,{children:[n.jsxs("li",{children:["Run ",n.jsx(ud,{children:"/mock-draft"})," to practice a set before it hits Arena"]}),n.jsxs("li",{children:["No matches expected, but you can challenge willing opponents on"," ",n.jsx(gce,{href:"https://moxgate.com",children:"moxgate.com"})]})]})}];function Ble(e,t){const s=Math.ceil(e.length/t),r=[];for(let a=0;a<t;a+=1)r.push(e.slice(a*s,(a+1)*s));return r}function Fle(){const e=iJ(),t=Ble(zle,e),s=e>1,r=p.useRef(null),[a,o]=p.useState(!1);p.useEffect(()=>{const c=r.current;if(!c)return;const d=()=>o(c.querySelectorAll("details[open]").length>0);return c.addEventListener("toggle",d,!0),d(),()=>c.removeEventListener("toggle",d,!0)},[]);const i=()=>{var u;const c=!a,d=window.scrollY;(u=r.current)==null||u.querySelectorAll("details").forEach(f=>{f.open=c}),requestAnimationFrame(()=>{var f;c?(f=document.getElementById("organizers"))==null||f.scrollIntoView({block:"start"}):window.scrollTo(0,d)})},l=n.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center lg:justify-start lg:pl-[calc(33.3333%_+_14px)]",children:n.jsxs("button",{type:"button",onClick:i,className:"pointer-events-auto inline-flex shrink-0 items-center gap-1.5 font-display text-[14px] md:text-[15px] tracking-[0.04em] text-text transition-colors hover:text-green",children:[n.jsx(fs,{size:16,strokeWidth:2.5,className:j("text-green transition-transform",a?"rotate-0":"-rotate-90")}),a?"Collapse All":"Expand All"]})});return n.jsx(Uo,{id:"organizers",maxWidthClass:"lg:max-w-[1600px]",headingAside:l,children:n.jsx("div",{ref:r,className:j("-mt-2 -mb-2",s?"flex":null),children:t.map((c,d)=>n.jsx("div",{className:j("min-w-0",s?"flex-1 px-6 first:pl-0 last:pr-0":null,s&&d>0?"border-l border-border":null),children:c.map((u,f)=>n.jsx(Wle,{title:u.title,divider:!s&&f>0,preview:u.preview,children:u.body},u.title))},d))})})}function Wle({title:e,divider:t,preview:s,children:r}){return n.jsxs("details",{className:j("group/acc",t?"border-t border-border":null),children:[n.jsxs("summary",{className:"flex items-center gap-1.5 py-3 cursor-pointer list-none [&::-webkit-details-marker]:hidden",children:[n.jsx(fs,{size:17,strokeWidth:2.5,className:"-mt-[2px] shrink-0 text-green -rotate-90 transition-transform group-open/acc:rotate-0"}),n.jsx("span",{className:"text-[17px] font-semibold text-text transition-colors group-hover/acc:text-green",children:e})]}),n.jsx("ul",{className:"mb-4 flex flex-col gap-1.5 text-subtle text-[14px] leading-[1.45] [&_strong]:font-semibold [&>li]:relative [&>li]:pl-[19px] [&>li]:before:absolute [&>li]:before:left-[6px] [&>li]:before:top-[8px] [&>li]:before:h-[4px] [&>li]:before:w-[4px] [&>li]:before:rotate-45 [&>li]:before:bg-green [&>li]:before:content-['']",children:r}),s?n.jsx("div",{className:"mb-4",children:s}):null]})}const EC="inline-flex flex-wrap items-center gap-x-2 gap-y-1 font-display text-text text-[19px] md:text-[21px] tracking-[0.04em] leading-none";function Lg({n:e,title:t,href:s,hideArrow:r,icon:a,children:o}){const i=s?n.jsxs("a",{href:s,target:"_blank",rel:"noreferrer",className:j(EC,"no-underline transition-colors hover:text-green"),children:[t,a,r?null:n.jsx(nc,{size:16,strokeWidth:2,className:"shrink-0"})]}):n.jsxs("span",{className:EC,children:[t,a]});return n.jsxs("div",{className:"flex min-w-0 flex-col gap-3 border-border py-2.5 first:pt-0 last:pb-0 [&:not(:first-child)]:border-t lg:px-6 lg:py-0 lg:first:pl-0 lg:last:pr-0 lg:[&:not(:first-child)]:border-l lg:[&:not(:first-child)]:border-t-0",children:[n.jsxs("div",{className:"flex items-center gap-3 pl-[3.5px]",children:[n.jsx("span",{className:"font-display text-green text-[28px] leading-none",children:e}),i]}),n.jsx("ul",{className:"flex flex-col gap-2 pl-[3.5px]",children:o})]})}const Hle="drop-shadow(0.5px 0 0 #f0f0f0) drop-shadow(-0.5px 0 0 #f0f0f0) drop-shadow(0 0.5px 0 #f0f0f0) drop-shadow(0 -0.5px 0 #f0f0f0)";function RC({src:e,size:t,style:s}){return n.jsx("img",{src:`/platforms/${e}`,alt:"",width:t,height:t,className:"shrink-0",style:s})}const lx="'gg sans', 'Noto Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif",Tw="#248046",Ew="#2ecc71",Gle="rgba(114,118,125,0.3)",Vle=[{short:"Early",label:"Early Pod",emoji:"💫",color:"#5CA8E0",pillBg:"rgba(92,168,224,0.16)",roster:["Nassif","Finkel","LSV","JED"]},{short:"Late",label:"Late Pod",emoji:"☄️",color:"#9B8AE6",pillBg:"rgba(155,138,230,0.16)",roster:["Paolo","Shota","Reid","Chapin"]}],Kle=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}),qle=new Intl.DateTimeFormat(void 0,{weekday:"long",month:"short",day:"numeric"}),Zle=new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric"}),Yle=new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"});function Qle(){const e=XV,t=_s,s=_s,r=Vle.map((a,o)=>({...a,when:Fie(em[o].easternHour)}));return n.jsxs("div",{style:{fontFamily:lx},children:[n.jsx("div",{className:"overflow-hidden rounded-md bg-[#2b2d31]",style:{borderLeft:`4px solid ${Ew}`},children:n.jsxs("div",{className:"p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 text-white font-bold text-[17px]",children:[n.jsx("span",{"aria-hidden":!0,
518children:"🚀"}),n.jsxs("span",{children:["Daily Pod Launcher - ",Kle.format(r[0].when)]})]}),n.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[#dbdee1] text-[14px]",children:[n.jsx("span",{className:"font-semibold",children:"Choose a time to draft"}),n.jsx(Ae,{code:s,size:16,className:"text-white"}),n.jsx("span",{className:"font-semibold text-white",children:e})]}),n.jsx("div",{className:"mt-3 grid grid-cols-2 gap-x-4 gap-y-2",children:r.map(a=>n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"inline-flex items-center gap-1 text-[14px] font-medium",children:[n.jsx("span",{"aria-hidden":!0,children:a.emoji}),n.jsxs("span",{className:"rounded px-1",style:{backgroundColor:a.pillBg,color:a.color},children:["@",a.label]})]}),n.jsx("div",{className:"mt-1",children:n.jsxs("span",{className:"rounded-sm px-1 text-[#dbdee1] text-[13px]",style:{backgroundColor:Gle},children:[n.jsx("span",{className:"sm:hidden",children:Zle.format(a.when)}),n.jsx("span",{className:"hidden sm:inline",children:qle.format(a.when)})," at ",Yle.format(a.when)]})}),n.jsxs("div",{className:"mt-1.5 flex items-center gap-1 text-[#f2f3f5] text-[14px] font-semibold",children:[n.jsx(Ae,{code:s,size:20,className:"text-white"}),n.jsxs("span",{children:[a.short," ",t," (",a.roster.length,")"]})]}),n.jsxs("div",{className:"mt-1 ml-1.5 flex gap-2",children:[n.jsx("span",{className:"w-1 shrink-0 self-stretch rounded-full bg-[#4e5058]"}),n.jsx("div",{className:"text-[#dbdee1] text-[14px] leading-[1.45]",children:a.roster.map(o=>n.jsx("div",{children:o},o))})]})]},a.short))})]})}),n.jsxs("div",{className:"mt-2 flex items-center gap-1.5 sm:gap-2",children:[r.map(a=>n.jsxs("span",{className:"inline-flex items-center gap-1 rounded-lg px-2.5 sm:px-4 py-2 text-white text-[14px] font-semibold",style:{backgroundColor:Tw},children:[n.jsx(Ae,{code:s,size:19,className:"text-white"}),a.short," ",t]},a.short)),n.jsxs("span",{className:"ml-auto inline-flex items-center gap-1.5 rounded-lg px-2.5 sm:px-4 py-2 text-white text-[14px]",style:{backgroundColor:p8},children:[n.jsx("span",{"aria-hidden":!0,children:"❌"})," Leave"]})]})]})}const p8="#4e5058",AC=[{name:"Finkel",handle:"JonnyMagic#40129",ready:!0},{name:"Nassif",handle:"yellowhat#61023",ready:!0},{name:"Reid",handle:"reiderrabit#75540",ready:!0},{name:"JED",handle:"JiRock#31337",ready:!0},{name:"Paolo",handle:"PVDDR#00777"},{name:"Shota",handle:"yaya3"},{name:"LSV",handle:"LSV#00420"},{name:"Chapin",handle:"Chapin#13000"}],Jle=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"});function Xle(){const e=new Date;return e.setDate(e.getDate()+1),e}function PC({marker:e,label:t,rows:s,showHandles:r=!0}){return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-1.5 whitespace-nowrap text-white text-[15px] font-semibold",children:[n.jsx("span",{"aria-hidden":!0,children:e}),t," (",s.length,")"]}),n.jsxs("div",{className:"mt-1 ml-1.5 flex gap-2",children:[n.jsx("span",{className:"w-1 shrink-0 self-stretch rounded-full",style:{backgroundColor:p8}}),r?n.jsx("div",{className:"grid grid-cols-[auto_auto] items-center gap-x-2.5 gap-y-1",children:s.map(a=>n.jsxs(p.Fragment,{children:[n.jsx("span",{className:"text-[#dbdee1] text-[14px]",children:a.name}),n.jsx("span",{className:"font-mono justify-self-start rounded border px-1.5 text-[12px]",style:{backgroundColor:"#2d2f33",borderColor:"#4e5058",color:"#b5bac1"},children:a.handle})]},a.name))}):n.jsx("div",{className:"flex flex-col gap-1 text-[#dbdee1] text-[14px]",children:s.map(a=>n.jsx("span",{children:a.name},a.name))})]})]})}function ece(){const e=_s,t=_s,s=AC.filter(a=>a.ready),r=AC.filter(a=>!a.ready);return n.jsxs("div",{style:{fontFamily:lx},children:[n.jsx("div",{className:"overflow-hidden rounded-md bg-[#2b2d31]",style:{borderLeft:`4px solid ${Ew}`},children:n.jsxs("div",{className:"p-4",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-white font-bold text-[17px]",children:[n.jsx(Ae,{code:t,size:20,className:"text-white"}),n.jsxs("span",{children:[e," ",Jle.format(Xle())," Early Pod"]})]}),n.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-white font-semibold text-[15px]",children:[n.jsx("span",{"aria-hidden":!0,
518children:"🔔"}),n.jsx("span",{children:"Ready Check initiated"})]}),n.jsxs("div",{className:"mt-3 flex justify-between lg:grid lg:grid-cols-2 lg:gap-x-4",children:[n.jsx(PC,{marker:"✅",label:"Ready",rows:s}),n.jsx(PC,{marker:"⏳",label:"Pending",rows:r,showHandles:!1})]})]})}),n.jsx("div",{className:"mt-2 flex flex-wrap gap-2 text-[14px] text-white",children:n.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-lg px-4 py-2 font-semibold",style:{backgroundColor:Tw},children:[n.jsx("span",{className:"text-[17px] leading-none",children:"✅"})," I'm Ready"]})})]})}const tce=[{a:"PlayerName",b:"Paolo"},{a:"Finkel",b:"Shota"},{a:"LSV",b:"Reid"},{a:"JED",b:"Chapin"}];function sce({children:e}){return n.jsx("span",{className:"font-mono rounded border px-1.5 text-[12px]",style:{backgroundColor:"#2d2f33",borderColor:"#4e5058",color:"#b5bac1"},children:e})}function nce(){return n.jsxs("div",{style:{fontFamily:lx},children:[n.jsx("div",{className:"overflow-hidden rounded-md bg-[#2b2d31]",style:{borderLeft:`4px solid ${Ew}`},children:n.jsxs("div",{className:"p-4",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-white font-bold text-[17px]",children:[n.jsx("span",{"aria-hidden":!0,children:"⚔️"}),n.jsx("span",{children:"Round 1 Pairings"}),n.jsx("span",{"aria-hidden":!0,children:"⚔️"})]}),n.jsx("div",{className:"mt-3 grid grid-cols-2 gap-x-4 gap-y-2",children:tce.map(e=>n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[14px] text-[#dbdee1]",children:[n.jsx("span",{"aria-hidden":!0,children:"⚔️"}),n.jsx("span",{className:j(e.a==="PlayerName"&&"italic"),children:e.a}),n.jsx("span",{className:"text-[#949ba4]",children:"vs"}),n.jsx("span",{children:e.b})]},e.a))}),n.jsxs("div",{className:"mt-4 flex gap-1.5 text-[14px] text-[#dbdee1]",children:[n.jsx("span",{"aria-hidden":!0,children:"🎯"}),n.jsxs("span",{children:["Opponent DM'd. Use ",n.jsx(sce,{children:"/report-results"})," or the menu below after your match"]})]})]})}),n.jsxs("div",{className:"mt-2 flex w-fit items-center gap-8 rounded border border-[#232428] bg-[#1e1f22] px-3 py-2 text-[14px] text-[#dbdee1]",children:[n.jsxs("span",{children:["⚔️ ",n.jsx("span",{className:"italic",children:"PlayerName"})," vs Paolo"]}),n.jsx(fs,{size:18,className:"text-[#949ba4]"})]})]})}const rce="#2b2d31",ace="#1e1f22",oce={grey:"#4e5058",red:"#da373c",green:Tw},ice="#5865f2";function Pl({icon:e,label:t}){return n.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-2.5 py-2 text-[14px]",style:{backgroundColor:rce,border:`1px solid ${ace}`},children:[n.jsx("span",{className:"flex w-4 shrink-0 items-center justify-center","aria-hidden":!0,children:e}),n.jsx("span",{className:"truncate font-medium text-[#f2f3f5]",children:t}),n.jsx(fs,{size:16,className:"ml-auto shrink-0 text-[#b5bac1]"})]})}function Pr({icon:e,label:t,variant:s="grey"}){return n.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-[8px] px-2.5 py-1.5 text-[13px] font-medium text-white",style:{backgroundColor:oce[s]},children:[e?n.jsx("span",{className:"inline-flex shrink-0 items-center","aria-hidden":!0,children:e}):null,t]})}function m8({children:e}){return n.jsx("div",{className:"flex flex-wrap gap-1.5",children:e})}function x8({children:e}){return n.jsxs("div",{style:{fontFamily:lx},className:"rounded-lg bg-[#313338] p-2.5",children:[n.jsxs("div",{className:"mb-2 flex items-center gap-1",children:[n.jsx("img",{src:"/llu-bot-avatar-transparent.png",alt:"",className:"h-[26px] w-[26px] shrink-0 -translate-y-[2px] rounded-full object-contain"}),n.jsx("span",{className:"font-medium text-[14px] text-green",children:"DisChordBot"}),n.jsx("span",{className:"rounded px-1 text-[10px] font-semibold uppercase text-white",style:{backgroundColor:ice},children:"App"})]}),n.jsx("div",{className:"flex flex-col gap-1.5",children:e})]})}function lce(){return n.jsxs(x8,{children:[n.jsx(Pl,{icon:n.jsx(Ae,{code:"FIN",size:15,className:"text-white"}),label:"Format: FIN"}),n.jsx(Pl,{icon:n.jsx("span",{className:"text-[14px]",children:"⚡"}),label:"When: Late Pod"}),n.jsx(Pl,{icon:n.jsx("span",{className:"text-[14px]",children:"👥"}),label:"Pairings: Swiss Tournament"}),n.jsxs(m8,{children:[n.jsx(Pr,{icon:n.jsx("span",{className:"text-[14px]",children:"🔔"}),label:"Notify: On"}),n.jsx(Pr,{icon:n.jsx("span",{className:"text-[14px]",children:"🗓️"}),label:"Confirm Draft",variant:"green"})]})]})}function cce(){return n.jsxs(x8,{children:[n.jsx(Pl,{icon:n.jsx(Ae,{code:"TLA",size:15,className:"text-white"}),label:"Format: TLA"}),n.jsx(Pl,{icon:n.jsx("span",{className:"text-[14px]",children:"👥"}),label:"Pairings: Fast Bracket"}),n.jsx(Pl,{icon:n.jsx("span",{className:"text-[14px]",children:"🪑"}),label:"Seats: Random"}),n.jsxs(m8,{children:[n.jsx(Pr,{icon:n.jsx("span",{className:"text-[14px]",children:"⏱️"}),label:"Pick Timer: 60s"}),n.jsx(Pr,{icon:n.jsx("i",{className:"ms ms-8 ms-cost",style:{fontSize:14,letterSpacing:0,margin:0}}),label:"Max Players"}),n.jsx(Pr,{icon:n.jsx("span",{className:"text-[14px]",children:"🃏"}),label:"Mode: Pick One"}),n.jsx(Pr,{icon:n.jsx("span",{className:"text-[14px]",children:"🔓"}),label:"Decklist: Off"}),n.jsx(Pr,{icon:n.jsx("span",{className:"text-[14px]",children:"🕐"}),label:"Reschedule"}),n.jsx(Pr,{icon:n.jsx("span",{className:"text-[14px]",children:"📝"}),label:"Details"}),n.jsx(Pr,{icon:n.jsx("span",{className:"text-[14px]",children:"🗑️"}),label:"Cancel Draft",variant:"red"})]})]})}const dce="mt-3 inline-flex items-center gap-1.5 font-display text-[13px] tracking-[0.04em] text-green no-underline hover:underline",OC=4,Dg="[grid-template-columns:16px_1fr_46p
518x_32px_34px] lg:[grid-template-columns:22px_1fr_80px_70px_86px]",LC="pl-2 pr-1.5 lg:pr-2";function uce(e){return e&&e.replace(/[a-z]/g,"")}function fce(e){let t,s;for(const r of e??[])!r.isFinalized||r.isTeamDraft||((!s||r.eventDate>s.eventDate)&&(s=r),r.participantCount===8&&(!t||r.eventDate>t.eventDate)&&(t=r));return t??s}function hce(){const{data:e}=af(_s),t=fce(e),{data:s}=Ic(t==null?void 0:t.eventId),{data:r}=of(t==null?void 0:t.eventId),a=ox(t),[o,i]=p.useState(null),l=p.useMemo(()=>s?[...s].sort(ff).slice(0,OC):void 0,[s]),c=p.useMemo(()=>r&&(o==null?void 0:o.seatIndex)!=null?mc(r,o.seatIndex):null,[r,o]),d=u=>{const f=l??[];if(!o||f.length===0)return;const h=f.indexOf(o);if(h!==-1)for(let m=1;m<=f.length;m++){const y=f[((h+u*m)%f.length+f.length)%f.length];if(a.canViewSeat(y.avatarUrl)){i(y);return}}};return t?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"overflow-hidden border border-border bg-surface",children:[n.jsxs("div",{className:j("grid items-center gap-x-2 lg:gap-x-3 border-b border-border bg-surface2",LC,Dg),style:{height:34},children:[n.jsxs("div",{className:"col-span-2 flex items-center gap-2 min-w-0",children:[n.jsx(Ae,{code:t.setCode,size:17,className:"shrink-0 text-white"}),n.jsx("span",{className:"truncate font-display tracking-[0.04em] text-white text-[15px] min-w-0",children:t.name})]}),n.jsx("span",{className:"font-display text-muted tracking-[0.16em] text-[11px] whitespace-nowrap",children:n.jsx("span",{className:"hidden min-[1180px]:inline",children:"COLORS"})}),n.jsx("span",{className:"font-display text-muted tracking-[0.16em] text-[11px] text-center whitespace-nowrap",children:n.jsx("span",{className:"hidden min-[1180px]:inline",children:"RESULT"})}),n.jsxs(te,{to:`/pods/${t.slug}`,className:"inline-flex items-center justify-end gap-1 font-display tracking-[0.05em] text-[13px] text-white no-underline hover:underline",children:["RECAP",n.jsx(nc,{size:14,strokeWidth:2,className:"shrink-0"})]})]}),n.jsx("div",{className:"flex flex-col gap-[1px] bg-bg pb-[1px]",children:l?l.map((u,f)=>{const h=u.placement??f+1;return n.jsx(xw,{p:{...u,deckColors:uce(u.deckColors)},rank:h,trophy:h===1,dense:!0,iconOnly:!0,cols:Dg,padX:LC,deckHref:ta(t.slug,$s(u),$s(u)),onShowDeck:()=>i(u)},`${u.eventId}-${u.displayName}`)}):Array.from({length:OC}).map((u,f)=>n.jsx(gw,{cols:Dg},f))})]}),o&&n.jsx(Fc,{participant:{eventId:o.eventId,displayName:$s(o),participantDisplayName:o.displayName,deckColors:o.deckColors,deckScreenshotUrl:o.deckScreenshotUrl,deckScreenshotCaption:o.deckScreenshotCaption,mainboard:c,record:o.record},draftLogHref:r&&a.canViewSeat(o.avatarUrl)?sa(t.slug,o):null,breakdownHref:wr(t.slug,$s(o)),onClose:()=>i(null),onPrev:()=>d(-1),onNext:()=>d(1)})]}):n.jsxs(te,{to:"/pods",className:dce,children:[n.jsx(fz,{size:14,strokeWidth:2,className:"shrink-0"}),"Open the pod board",n.jsx(nc,{size:14,strokeWidth:2,className:"shrink-0"})]})}const DC=6,fb="grid items-center gap-x-2 lg:gap-x-3 [grid-template-columns:16px_1fr_58px_56px] lg:[grid-template-columns:22px_1fr_72px_66px]",hb="pl-2 pr-3 lg:pr-4",IC="font-display text-[11px] tracking-[0.2em] text-muted text-center whitespace-nowrap",MC="font-display text-[16px] tabular-nums text-text text-center";function pce({row:e}){return n.jsxs("div",{className:j(fb,"bg-surface py-1.5",hb),children:[n.jsx("span",{className:"font-num text-center tabular-nums text-muted text-[14px]",children:e.rank}),n.jsxs(te,{to:Gt(e.slug,_s),className:"flex items-center gap-2 lg:gap-2.5 min-w-0 justify-self-start w-fit max-w-full no-underline text-text transition-colors hover:text-green",children:[n.jsx(Jp,{name:e.displayName,avatarUrl:e.avatarUrl,size:28,teamSide:null}),n.jsx("span",{className:"font-display leading-none tracking-[0.04em] text-[16px] truncate",children:e.displayName.toUpperCase()})]}),n.jsxs("span",{className:j(MC,"flex items-center justify-center gap-1"),children:[n.jsx(ct,{size:14,color:"#ffc63a"}),e.trophies]}),n.jsx("span",{className:MC,children:ea(e.points??0)})]})}function mce(){var o;const{data:e}=un(),t=Sd(e),{data:s}=nY(t),r=(o=XO(s))==null?void 0:o.slice(0,DC),a=s===void 0;return n.jsxs("div",{className:"overflow-hidden border border-border bg-surface",children:[n.jsxs("div",{className:j(fb,"border-b border-border bg-surface2",hb),style:{height:34},children:[n.jsxs(te,{to:"/pods",className:"group/season col-span-2 flex items-center gap-2 min-w-0 no-underline text-white transition-colors hover:text-green",children:[n.jsx(Ae,{code:_s,size:17,className:"shrink-0 text-white transition-colors group-hover/season:text-green"}),n.jsx("span",{className:"font-display tracking-[0.04em] text-[15px]",children:"SEASON LEADERBOARD"}),n.jsx(nc,{size:14,strokeWidth:2,className:"shrink-0"})]}),n.jsx("span",{className:IC,children:"TROPHIES"}),n.jsx("span",{className:IC,children:"POINTS"})]}),n.jsx("div",{className:"flex flex-col gap-[1px] bg-bg pb-[1px]",children:a?Array.from({length:DC}).map((i,l)=>n.jsxs("div",{className:j(fb,"bg-surface py-1.5",hb),children:[n.jsx("span",{className:"h-3 w-3 bg-surface2 animate-pulse mx-auto"}),n.jsxs("div",{className:"flex items-center gap-2 lg:gap-2.5",children:[n.jsx("div",{className:"h-[28px] w-[28px] bg-surface2 shrink-0"}),n.jsx("div",{className:"h-3.5 w-28 bg-surface2 animate-pulse"})]}),n.jsx("div",{className:"h-3.5 w-8 bg-surface2 animate-pulse justify-self-end"}),n.jsx("div",{className:"h-3.5 w-8 bg-surface2 animate-pulse justify-self-end"})]},l)):(r??[]).map(i=>n.jsx(pce,{row:i},i.slug))})]})}function xce(){const{data:e}=OR(),t=e?vd(e,Lle):null;return t?n.jsxs(te,{to:`/episodes/${En(t.category)}/${t.slug}`,"aria-label":t.title,className:j(h8,"group/cta flex flex-col overflow-hidden p-3 no-underline md:p-4","lg:flex-row lg:items-stretch lg:pl-6","transition-[border-color,box-shadow] duration-150 hover:border-green hover:shadow-[0_0_8px_1px_rgba(46,232,92,0.32)]","lg:max-w-[1260px]"),children:[n.jsxs("div",{className:"relative aspect-video w-full shrink-0 overflow-hidden rounded-lg border border-border bg-surface2 lg:w-[40%] lg:max-w-[320px]",children:[n.jsx(ki,{src:t.image,className:"transition-transform duration-300 group-hover/cta:scale-[1.07]"}),t.durationLabel?n.jsx("span",{className:"absolute bottom-2 right-2 roun
518ded bg-black/60 px-1.5 py-0.5 text-[10px] font-medium text-white",children:t.durationLabel}):null,n.jsx("span",{className:"absolute inset-0 flex items-center justify-center bg-bg/30 opacity-0 transition-opacity group-hover/cta:opacity-100",children:n.jsx($v,{children:n.jsx(lc,{size:32})})})]}),n.jsx("div",{className:"mt-3 flex min-w-0 flex-1 justify-center lg:mt-0 min-[1400px]:pr-[7%]",children:n.jsxs("div",{className:"grid w-fit max-w-full lg:grid-rows-[1fr_auto_1fr] text-center",children:[n.jsx("h3",{className:"row-start-2 font-display text-text text-[22px] md:text-[28px] xl:text-[32px] leading-[1.05] tracking-[0.02em] transition-colors group-hover/cta:text-green",children:t.title}),n.jsxs("span",{className:"row-start-3 mt-2 flex items-center justify-center gap-2 self-start font-display text-[14px] tracking-[0.16em] text-green transition-colors group-hover/cta:text-green-2",children:[n.jsx(ez,{size:16,strokeWidth:2,className:"relative -top-[1px] shrink-0"}),"WATCH THE WALKTHROUGH",n.jsx(nc,{size:14,strokeWidth:2,className:"relative -top-px shrink-0"})]})]})})]}):null}function mt({children:e}){return n.jsx("strong",{className:"font-medium text-text",children:e})}function gce({href:e,children:t}){return n.jsxs("a",{href:e,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-0.5 text-green no-underline hover:underline",children:[t,n.jsx($T,{size:12,strokeWidth:2.5,className:"mb-[1px] shrink-0"})]})}function ud({children:e}){return n.jsx("code",{className:"font-mono text-text bg-surface2 border border-border2 px-1.5 py-px text-[13px] whitespace-nowrap",children:e})}function bce(){return n.jsxs("a",{href:mZ,target:"_blank",rel:"noreferrer",className:"relative -top-px inline-flex items-center gap-1 whitespace-nowrap align-middle font-medium text-green no-underline hover:underline",children:[n.jsx("img",{src:"/llu-bot-avatar-transparent.png",alt:"",className:"relative -top-[3px] h-[22px] w-[22px] -my-1"}),pZ]})}function yce(){return n.jsx("a",{href:vR,target:"_blank",rel:"noreferrer",className:"whitespace-nowrap font-medium text-text no-underline transition-colors hover:text-green",children:yR})}const vce="https://www.17lands.com",wce="https://discord.com/channels/775371722065051658/1504825374188507156";function jce(){return n.jsxs("div",{className:"bg-bg text-text min-h-screen flex flex-col page-fade",children:[n.jsx(St,{subtitle:"ABOUT"}),n.jsxs("main",{className:"flex-1 flex flex-col mx-auto w-full max-w-[1040px] px-5 md:px-10 pt-5 md:pt-10 pb-5 md:pb-5 md:relative",children:[n.jsx(kce,{}),n.jsx($C,{}),n.jsx(YT,{}),n.jsx($C,{}),n.jsx(Sce,{}),n.jsx(Lu,{className:"mt-auto pt-3 md:mt-0 md:pt-0 md:absolute md:bottom-5 md:right-10"})]})]})}function kce(){return n.jsxs("section",{children:[n.jsxs(g8,{children:["THE ",n.jsx("span",{className:"text-green",children:"LEADERBOARD"})]}),n.jsxs("p",{className:"text-[13px] md:text-[14px] text-muted leading-[1.6]",children:["Ranks Discord members who opt in via ",n.jsx(Ig,{children:"/join"}),", using their"," ",n.jsx(b8,{href:vce,children:"17Lands"})," data."]}),n.jsxs("p",{className:"text-[13px] md:text-[14px] text-muted leading-[1.6] mt-2",children:["Use ",n.jsx(Ig,{children:"/opt-out"})," to hide your rank, keeping your profile and stats. Use ",n.jsx(Ig,{children:"/retire"})," ","to hide everything until you come back."]})]})}function Sce(){return n.jsxs("section",{children:[n.jsx(g8,{children:n.jsx("span",{className:"text-green",children:"FEEDBACK"})}),n.jsxs("p",{className:"text-[13px] md:text-[14px] text-muted leading-[1.6]",children:["Spotted a bug or have an idea to improve the site? Share it in"," ",n.jsx(b8,{href:wce,children:"#🤖-site-feedback"})," channel on the Discord."]})]})}function g8({children:e}){return n.jsx("h2",{className:"font-display text-[16px] md:text-[18px] text-text tracking-[0.18em] mb-3 md:mb-4",children:e})}function $C(){return n.jsxs("div",{className:"flex items-center gap-3 my-5 md:my-8","aria-hidden":"true",children:[n.jsx("span",{className:"w-1 h-1 bg-dim rotate-45 inline-block"}),n.jsx("span",{className:"flex-1 h-px bg-border block"}),n.jsx("span",{className:"w-1 h-1 bg-dim rotate-45 inline-block"})]})}function Ig({children:e}){return n.jsx("code",{className:"font-mono text-text bg-surface2 border border-border2 px-1.5 py-px text-[13px] whitespace-nowrap",children:e})}function b8({href:e,children:t}){return n.jsx("a",{href:e,target:"_blank",rel:"noreferrer",className:"text-green hover:underline underline-offset-2 whitespace-nowrap",children:t})}const Nce={C:"common",U:"uncommon",R:"rare",M:"mythic"};function UC({filters:e,setFilters:t,options:s,setCode:r,hideArt:a,setHideArt:o,onSearch:i,dataGrades:l,setDataGrades:c,stacked:d=!1}){const u=(A,P)=>{const M=e[A],U=M.includes(P)?M.filter(F=>F!==P):[...M,P];t({...e,[A]:U})},f=A=>{t({...e,colors:e.colors.includes(A)?[]:[A]})},[h,m]=p.useState(!1),y=e.trends.length===2?"both":e.trends.length===1?e.trends[0]:"off",b=()=>{t({...e,trends:y==="off"?["up","down"]:y==="both"?["up"]:y==="up"?["down"]:[]}),m(!0)},w=y==="off"?`Show cards that moved (${s.trends.up+s.trends.down})`:y==="both"?`Show only cards that moved up (${s.trends.up})`:y==="up"?`Show only cards that moved down (${s.trends.down})`:"Show all cards",x=n.jsxs("div",{className:"relative flex grow items-center justify-center",children:[n.jsxs("div",{className:"relative flex",children:[n.jsx("span",{className:j(y8,"absolute right-full top-1/2 mr-2 -translate-y-1/2"),children:"COLOR"}),n.jsx("div",{className:j("flex",v8),children:s.colors.map(A=>n.jsx(Ln,{active:e.colors.includes(A.value),onClick:()=>f(A.value),label:`${A.name} (${A.count})`,narrow:!0,children:n.jsx("i",{className:df(A.value),style:{fontSize:A.value==="M"?21:15}})},A.value))})]}),n.jsx(Ln,{active:!1,onClick:i,label:"Search",tooltip:!1,narrow:!0,className:"absolute right-0",children:n.jsx("span",{className:"flex w-[28px] items-center justify-center",children:n.jsx(ac,{size:17})})})]}),g=n.jsx(ba,{label:"RARITY",stacked:d,joined:!0,children:s.rarities.map(A=>n.jsx(Ln,{active:e.rarities.includes(A.value),onClick:()=>u("rarities",A.value),label:`${A.name} (${A.count})`,roomy:!0,children:n.jsx(N6,{code:r,rarity:Nce[A.value],size:22})},A.value))}),v=n.jsx(ba,{label:"TYPE",stacked:d,joined:!0,children:s.types.map(A=>n.jsx(Ln,{active:e.cardTypes.includes(A.value),onClick:()=>u("cardTypes",A.value),label:`${A.label} (${A.count})`,roomy:!0,children:n.jsx("i",{className:`ms ms-${A.ms} relative -top-[2px]`,style:{fontSize:20,WebkitTextStroke:"0.6px currentColor"}})},A.value))}),k=d&&s.sets.length>=3,S=n.jsx(ba,{label:"MANA VALUE",stacked:d,joined:!0,className:d?void 0:"max-[1150px]:hidden",children:hX.map(A=>n.jsx(Ln,{active:e.manaValues.includes(A),onClick:()=>u("manaValues",A),label:`Mana value ${A}
518`,narrow:!0,compact:k,children:n.jsx("span",{className:j("font-display font-bold leading-none",k?"text-[15px]":"text-[18px]"),children:A})},A))}),N=s.sets.length>1?n.jsx(ba,{label:"SET GROUP",stacked:d,joined:!0,children:s.sets.map(A=>n.jsx(Ln,{active:e.sets.includes(A.value),onClick:()=>u("sets",A.value),label:`${A.label} (${A.count})`,compact:k,children:n.jsx("i",{className:`ss ss-${Vm(A.value)}`,style:{fontSize:k?16:19}})},A.value))}):null,C=n.jsx(ba,{label:"TREND",stacked:d,joined:!0,children:n.jsx(Ln,{active:y!=="off",onClick:b,label:w,narrow:!0,tooltipOpen:h,onTooltipOpenChange:m,children:n.jsx("span",{className:"flex w-[28px] items-center justify-center",children:y==="up"||y==="down"?n.jsx("span",{className:"text-[15px] leading-none",style:{color:El[y]},children:Ih[y]}):n.jsxs("span",{className:j("flex gap-0.5 text-[12px] leading-none",y==="off"&&"opacity-70"),children:[n.jsx("span",{style:{color:El.up},children:Ih.up}),n.jsx("span",{style:{color:El.down},children:Ih.down})]})})})}),_=n.jsx(ba,{label:"ART",stacked:d,joined:!0,children:n.jsx(Ln,{active:a,onClick:()=>o(!a),label:a?"Show card art":"Hide card art",narrow:!0,mutedActive:!0,children:n.jsx("span",{className:"flex w-[28px] items-center justify-center",children:n.jsx(Cce,{hidden:a})})})}),T=c?n.jsxs(ba,{label:"GRADES",stacked:d,joined:!0,children:[n.jsx(Ln,{active:!l,onClick:()=>c(!1),label:"Show cards by LLU grade",narrow:!0,children:n.jsx("span",{className:"px-1 text-[12px] font-semibold",children:"LLU"})}),n.jsx(Ln,{active:!!l,onClick:()=>c(!0),label:"Show cards by 17Lands stats",narrow:!0,children:n.jsx("span",{className:"px-1 text-[12px] font-semibold",children:"17L"})})]}):null,E=n.jsx(ba,{label:"SEARCH",stacked:d,joined:!0,children:n.jsx(Ln,{active:!1,onClick:i,label:"Search",tooltip:!1,narrow:!0,children:n.jsx("span",{className:"flex w-[28px] items-center justify-center",children:n.jsx(ac,{size:17})})})});return d?n.jsxs("div",{className:"flex w-full flex-col gap-y-3",children:[n.jsxs("div",{className:"grid w-full grid-cols-2 items-end justify-items-center gap-x-1.5",children:[g,v]}),n.jsxs("div",{className:"flex w-full flex-wrap items-end justify-between gap-x-1.5 gap-y-3",children:[S,N,C,T,_,x]})]}):n.jsxs("div",{className:"flex flex-wrap items-end gap-x-5 gap-y-3",children:[g,v,S,N,C,T,_,E]})}function Cce({hidden:e}){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",strokeLinejoin:"round"}),n.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),n.jsx("path",{d:"M21 15l-5-5L5 21",strokeLinecap:"round",strokeLinejoin:"round"}),e&&n.jsx("path",{d:"M3 3l18 18",strokeLinecap:"round"})]})}const y8="font-display text-[13px] tracking-[0.2em] text-muted",v8=j("[&>button]:rounded-none","[&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md","[&>button:not(:first-child)]:-ml-px");function ba({label:e,children:t,stacked:s,joined:r=!1,className:a}){return n.jsxs("div",{className:j("flex flex-col",s?"items-center gap-1":"gap-0.5",a),children:[n.jsx("span",{className:y8,children:e}),n.jsx("div",{className:j("flex",r?v8:"gap-1.5"),children:t})]})}function Ln({active:e,onClick:t,label:s,children:r,roomy:a=!1,narrow:o=!1,compact:i=!1,mutedActive:l=!1,className:c,tooltip:d=!0,tooltipOpen:u,onTooltipOpenChange:f}){const h=l?"z-10 border-border2 bg-surface2 text-subtle":"z-10 border-green bg-green/10 text-text",m=n.jsx("button",{type:"button",onClick:t,"aria-label":s,className:j("relative flex h-10 items-center justify-center rounded border transition-colors",a?"min-w-[40px] px-2.5":o?i?"min-w-[28px] px-1":"min-w-[34px] px-1.5":i?"min-w-[32px] px-1.5":"min-w-[40px] px-2",e?h:"border-border2 bg-transparent text-muted hover:bg-surface2 hover:text-text",c),children:r});return d?n.jsx(Ne,{label:s,open:u,onOpenChange:f,children:m}):m}function _ce({cards:e,onClose:t}){var d;const[s,r]=p.useState(""),[a,o]=p.useState(null),i=p.useRef(null),l=p.useMemo(()=>gX(e,s),[e,s]),c=a===null||(d=l[a])==null?void 0:d.card;return p.useEffect(()=>{var u;(u=i.current)==null||u.focus()},[]),p.useEffect(()=>{const u=f=>{f.key==="Escape"&&a===null&&t()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[t,a]),It.createPortal(n.jsxs("div",{className:"fixed inset-0 z-[190] flex items-start justify-center bg-black/70 px-4 pt-[12vh] animate-fadeIn",onClick:t,role:"dialog","aria-modal":"true","aria-label":"Search cards",children:[n.jsxs("div",{className:"flex w-full max-w-[420px] flex-col rounded-xl border border-border2 bg-surface shadow-2xl",onClick:u=>u.stopPropagation(),children:[n.jsxs("div",{className:"flex items-center justify-between px-4 pt-3.5",children:[n.jsx("span",{className:"font-display text-[18px] tracking-[0.12em] text-text",children:"SEARCH"}),n.jsx("button",{type:"button",onClick:t,"aria-label":"Close",className:"flex h-8 w-8 cursor-pointer items-center justify-center rounded text-muted transition-colors hover:text-text",children:n.jsx(rn,{size:18})})]}),n.jsx("form",{className:"px-4 pb-3 pt-2.5",onSubmit:u=>{u.preventDefault(),l.length>0&&o(0)},children:n.jsxs("div",{className:"relative flex items-center",children:[n.jsx(ac,{size:17,className:"pointer-events-none absolute left-2.5 text-dim"}),n.jsx("input",{ref:i,type:"search",value:s,onChange:u=>r(u.target.value),placeholder:"Card name",autoComplete:"off",className:j("w-full rounded border border-border2 bg-bg py-2 pl-9 pr-9 text-[14px] text-text outline-none","transition-colors placeholder:text-dim focus:border-green/60","[&::-webkit-search-cancel-button]:hidden")}),s.length>0&&n.jsx(Ne,{label:"Clear Search",children:n.jsx("button",{type:"button",onClick:()=>{var u;r(""),(u=i.current)==null||u.focus()},"aria-label":"Clear Search",className:"absolute right-1.5 flex h-7 w-7 cursor-pointer items-center justify-center rounded text-green transition-colors hover:bg-surface2",children:n.jsx(rn,{size:16})})})]})}),s.trim().length>0&&n.jsx("div",{className:"menu-scrollbar max-h-[45vh] overflow-y-auto border-t border-border px-2 py-2",children:l.length===0?n.jsx("p",{className:"px-2 py-3 text-center text-[13px] text-muted",children:"No cards match"}):l.map(({card:u,start:f,end:h},m)=>n.jsxs("button",{type:"button",onClick:()=>o(m),className:"flex w-full cursor-pointer items-center gap-2.5 rounded px-2 py-2 text-left transition-colors hover:bg-surface2",children:[n.jsx("i",{className:j(df(_i(u.color)),"shrink-0"),style:{fontSize:_i(u.color)==="M"?19:14}}),n.jsxs("span",{className:"min-w-0 flex-1 truncate text-[14px] text-text",children:[u.name.slice(0,f),n.jsx("b",{className:"font-semibold text-green",children:u.name.slice(f,h)}),u.name.slice(h)]}),n.jsx("span",{className:"shrink-0 font-display text-[15px] leading-none",style:{color:Fs(u.tier)},children:u.tier})]},u.card_id))})]}),a!==null&&c&&n.jsx(Kv,{card:c,onClose:()=>o(null),onPrev:a>0?()=>o(a-1):void 0,onNext:a<l.length-1?()=>o(a+1):void 0,position:`${a+1} / ${l.length}`,neighborUrls:Vv(l.map(u=>u.card),a)})]}),document.body)}const Tce=180,Ece=31,Rce=28;function Ace({skeletons:e,setCode:t,activePair:s,pairHref:r,onClose:a}){const o=ut(),i=ln(),l=Rt(),c=e.findIndex(w=>w.colors.toLowerCase()===(s==null?void 0:s.toLowerCase())),d=Math.max(0,c),u=e[d],f=Mi(e.flatMap(w=>[...w.cards,...w.splitCards].map(x=>({name:x.n,set:x.s})))),{columns:h,splitColumns:m}=kY(u),y=u.splitCards.length>0,b=w=>r(e[(d+w+e.length)%e.length].colors);return p.useEffect(()=>{const w=x=>{if(x.key==="Escape")a();else if(x.key==="ArrowLeft"||x.key==="ArrowRight"){x.preventDefault();const g=x.key==="ArrowLeft"?-1:1;i(b(g),{replace:!0,state:l.state})}};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)}),It.createPortal(n.jsx("div",{className:"fixed inset-0 z-50 flex flex-col items-center bg-black/80 backdrop-blur-sm animate-fadeIn px-[4px] md:px-6 pt-8 md:pt-10 pb-6 md:pb-8",onClick:a,role:"dialog","aria-modal":"true","aria-label":"Archetype skeletons",children:n.jsx(rw,{value:f,children:n.jsx(EP,{setCode:t,children:n.jsxs("div",{className:"flex min-h-0 w-full max-w-[1400px] flex-1 flex-col",children:[n.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col border border-border bg-surface",onClick:w=>w.stopPropagation(),children:[n.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border px-3 py-2.5 md:gap-4 md:px-4 md:py-3",children:[n.jsxs("div",{className:"flex flex-1 items-center justify-center gap-2 md:gap-3",children:[n.jsx(Be,{colors:u.colors,size:o?15:20}),n.jsx("span",{className:"font-display text-[16px] leading-none tracking-[0.14em] text-text md:text-[24px]",children:"ARCHETYPE SKELETON"})]}),n.jsx("button",{type:"button",onClick:a,"aria-label":"Close",className:"shrink-0 cursor-pointer border-0 bg-transparent p-1 text-muted transition-colors hover:text-text",children:n.jsx(rn,{size:18})})]}),n.jsx("div",{className:"themed-scrollbar min-h-0 flex-1 overflow-auto py-4 md:py-5",children:n.jsxs("div",{className:"mx-auto w-fit min-w-full px-2 md:px-4",children:[n.jsx(zC,{columns:h,isMobile:o}),y&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"my-4 border-t border-border2 md:my-5"}),n.jsx(zC,{columns:m,isMobile:o})]})]})})]}),n.jsx(Pce,{skeletons:e,index:d,showArrows:!o,pairHref:r,prevHref:b(-1),nextHref:b(1)})]})})})}),document.body)}function zC({columns:e,isMobile:t}){if(t){const s=e.filter(r=>r.length>0);return n.jsx("div",{className:"grid grid-cols-2 items-start gap-x-2 gap-y-5",children:s.map((r,a)=>n.jsx(BC,{cards:r,reveal:Rce},a))})}return n.jsx("div",{className:"mx-auto grid w-fit items-start gap-x-3",style:{gridTemplateColumns:`repeat(${e.length}, ${Tce}px)`},children:e.map((s,r)=>n.jsx(BC,{cards:s,reveal:Ece},r))})}function BC({cards:e,reveal:t}){return e.length===0?n.jsx("div",{}):n.jsx(ex,{count:e.length,reveal:t,cardClassName:Xm,cardAt:s=>e[s],tapToPreview:!0,renderCard:s=>n.jsx(hc,{card:e[s]})})}function Pce({skeletons:e,index:t,showArrows:s,pairHref:r,prevHref:a,nextHref:o}){const i=Rt();return n.jsxs("div",{onClick:l=>l.stopPropagation(),className:"mt-4 flex w-full shrink-0 items-center gap-2 self
518-center rounded-2xl border border-border bg-surface px-2 py-2 shadow-lg md:mt-8 md:w-auto md:gap-3 md:px-3",children:[s&&n.jsx(za,{dir:"prev",srLabel:"Previous color pair",to:a}),n.jsx("div",{className:"grid w-full grid-cols-5 gap-1.5 md:flex md:w-auto md:min-w-0 md:flex-1 md:items-center md:justify-center md:gap-2 md:overflow-x-auto md:[-ms-overflow-style:none] md:[scrollbar-width:none] md:[&::-webkit-scrollbar]:hidden",children:e.map((l,c)=>n.jsx(te,{to:r(l.colors),replace:!0,state:i.state,"aria-label":l.colors,"aria-current":c===t,className:j("flex h-9 w-full cursor-pointer items-center justify-center rounded-full border px-2 transition-colors no-underline md:h-10 md:w-auto md:flex-none md:shrink-0 md:px-3",c===t?"border-green/50 bg-green/15":"border-border bg-surface2 hover:border-border2"),children:n.jsx(Be,{colors:l.colors,size:14})},l.colors))}),s&&n.jsx(za,{dir:"next",srLabel:"Next color pair",to:o})]})}function fd({skeletonsOpen:e=!1}){var K,W,J,Z;const{data:t}=un(),s=ut(),{setCode:r,pair:a}=cn(),[o,i]=p.useState(eS),[l,c]=kX(),[d,u]=SX(),[f,h]=p.useState(!1),[m,y]=p.useState(!1),[b,w]=p.useState(0),x=p.useRef(null),g=lA(o),v=((K=t==null?void 0:t.find(Y=>Y.isActive))==null?void 0:K.code)??_s,k=p.useMemo(()=>oA(t),[t]),S=(r==null?void 0:r.toUpperCase())??((W=k[0])==null?void 0:W.code)??v,N=Y=>`/tier-list/${Y}`,C=`/tier-list/${S}/archetypes`,_=Ju(N(S)),T=k.find(Y=>Y.code===S),{uid:E,graders:A,comparison:P,effectiveUid:M}=Fv(S),U=T?Qt(T):S,F=p.useMemo(()=>ZR(S),[S]),{data:I,lastUpdated:q}=Zm(M),O=cf(S),H=O!=null&&O.hasGrades?{dataGrades:d,setDataGrades:u}:{},B=!!(O!=null&&O.hasGrades)&&d,D=B&&O?{setCode:S,updatedAt:O.updatedAt}:null,L=p.useMemo(()=>jX(I??[]),[I]),$=!!(I!=null&&I.length),V=Oce(S,s,$);return p.useEffect(()=>{window.scrollTo(0,0)},[r]),p.useEffect(()=>{i(eS)},[M]),p.useEffect(()=>{s||i(Y=>Y.colors.length>0?{...Y,colors:[]}:Y)},[s]),p.useEffect(()=>{const Y=x.current;if(!Y)return;const ae=new ResizeObserver(()=>w(Y.offsetHeight));return ae.observe(Y),w(Y.offsetHeight),()=>ae.disconnect()},[]),Qv(b+40),n.jsx(zX,{children:n.jsxs("div",{className:"bg-bg text-text min-h-screen flex flex-col page-fade",children:[n.jsx(St,{subtitle:"TIER LIST"}),n.jsxs("main",{className:"flex flex-col w-full px-2 md:px-[15px] pb-10 overflow-x-clip",children:[n.jsx("div",{ref:x,className:"sticky top-0 z-20 bg-bg py-2 md:py-3",children:s?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h1",{className:"font-display tracking-[0.12em] flex flex-1 items-center gap-2 leading-none min-w-0",children:n.jsx(ku,{sets:k,activeCode:S,glyphCode:U,label:((J=T==null?void 0:T.name)==null?void 0:J.toUpperCase())??S,isMobile:!0,loading:!t,hrefFor:N,triggerClassName:"h-10 px-2.5"})}),F.length>0&&n.jsx(FC,{href:C}),M&&n.jsxs("button",{type:"button",onClick:()=>h(Y=>!Y),"aria-expanded":f,"aria-label":"Filters",disabled:!$,className:j("flex h-10 shrink-0 items-center gap-1.5 rounded border px-2 text-[12px] transition-colors",f||qm(o)?"border-green text-text":"border-border2 text-muted",!$&&"opacity-50"),children:[n.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("path",{d:"M3 5h18l-7 8v6l-4-2v-4z",strokeLinejoin:"round"})}),n.jsx("span",{className:j(F.length>0&&"hidden min-[400px]:inline"),children:"Filters"}),g>0&&n.jsx("span",{className:"flex h-4 min-w-4 items-center justify-center rounded-full bg-green px-1 text-[10px] font-bold text-bg",children:g}),n.jsx("span",{className:j("text-[10px] transition-transform",f&&"rotate-180"),children:"▾"})]})]}),n.jsx(HC,{lastUpdated:q,dataSource:D,className:"mt-1.5 whitespace-nowrap text-[clamp(8px,2.8vw,11px)]"}),M&&$&&f&&n.jsx("div",{className:"pt-3",children:n.jsx(UC,{filters:o,setFilters:i,options:L,setCode:U,hideArt:l,setHideArt:c,onSearch:()=>y(!0),...H,stacked:!0})})]}):n.jsxs("div",{ref:V.rowRef,className:j("grid items-center gap-x-[clamp(0.75rem,2.5vw,2.5rem)]",V.centered?"grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)]":"grid-cols-[minmax(0,max-content)_auto_minmax(0,1fr)]"),children:[n.jsxs("div",{ref:V.headingRef,className:"w-fit min-w-0 max-w-full",children:[n.jsxs("h1",{className:"font-display tracking-[0.12em] flex items-center gap-3 leading-none min-w-0",children:[n.jsx(ku,{sets:k,activeCode:S,glyphCode:U,label:((Z=T==null?void 0:T.name)==null?void 0:Z.toUpperCase())??S,isMobile:!1,loading:!t,hrefFor:N,labelRef:V.labelRef}),F.length>0&&n.jsx(FC,{href:C})]}),n.jsx(HC,{lastUpdated:q,dataSource:D,className:"mt-1 pl-[2px] text-[11px]"})]}),M&&$?n.jsx("div",{ref:V.filterRef,className:"justify-self-center -translate-y-1",children:n.jsx(UC,{filters:o,setFilters:i,options:L,setCode:U,hideArt:l,setHideArt:c,onSearch:()=>y(!0),...H})}):n.jsx("div",{}),n.jsx("div",{})]})}),M?n.jsx(JX,{setCode:S,uid:M,graders:A,comparison:P,filters:o,hideArt:l,dataGrades:B,stickyTop:b}):n.jsxs("div",{className:"flex items-center justify-center border border-border bg-surface text-muted text-[14px] min-h-[300px]",children:["No tier list is available for ",S," yet."]}),n.jsxs("div",{className:"flex items-center justify-between gap-3 pt-2",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:[A.length>0&&n.jsxs("div",{className:"flex items-center gap-x-2",children:[n.jsx("span",{className:"font-mono text-[10px] md:text-[12px] text-muted",children:"Set Reviews:"}),n.jsx("div",{className:"flex items-center gap-x-3.5",children:A.map(Y=>n.jsx(WC,{uid:Y.uid,label:`${Y.name}'s`},Y.uid))})]}),E&&n.jsx(WC,{uid:E,label:A.length>0?"Live: LLU":"Set Review List: LLU"})]}),n.jsx("a",{href:"https://www.17lands.com/tier_lists",target:"_blank",rel:"noreferrer",className:"font-mono text-[10px] md:text-[12px] text-muted hover:text-green transition-colors no-u
518nderline whitespace-nowrap",children:"Powered by 17Lands"})]})]}),m&&n.jsx(_ce,{cards:I??[],onClose:()=>y(!1)}),e&&F.length>0&&n.jsx(Ace,{skeletons:F,setCode:S,activePair:a,pairHref:Y=>`${C}/${Y.toLowerCase()}`,onClose:_})]})})}function Oce(e,t,s){const r=p.useRef(null),a=p.useRef(null),o=p.useRef(null),i=p.useRef(null),[l,c]=p.useState(!1);return p.useEffect(()=>{const d=r.current,u=a.current;if(!d||!u)return;const f=()=>{var g;const m=o.current,y=m?m.scrollWidth-m.clientWidth:0,b=u.offsetWidth+y,w=((g=i.current)==null?void 0:g.offsetWidth)??0,x=parseFloat(getComputedStyle(d).columnGap)||0;c(2*(b+x)+w<=d.clientWidth)},h=new ResizeObserver(f);for(const m of[d,u,i.current])m&&h.observe(m);return document.fonts.ready.then(f),()=>h.disconnect()},[e,t,s]),{rowRef:r,headingRef:a,labelRef:o,filterRef:i,centered:l}}function FC({href:e}){return n.jsx(te,{to:e,state:gi,className:"flex h-10 shrink-0 items-center rounded border border-border2 px-2 font-display text-[14px] leading-none tracking-[0.14em] text-text transition-colors no-underline hover:border-green hover:text-green md:h-9 md:px-2.5",children:n.jsx("span",{className:"-translate-y-px",children:"ARCHETYPES"})})}function WC({uid:e,label:t}){return n.jsx(Ne,{label:"View on 17Lands",side:"top",children:n.jsxs("a",{href:`https://www.17lands.com/tier_list/${e}`,target:"_blank",rel:"noreferrer",className:"font-mono flex items-center gap-1 text-[10px] md:text-[12px] text-muted hover:text-green transition-colors no-underline",children:[t,n.jsx(en,{size:11})]})})}function HC({lastUpdated:e,dataSource:t,className:s}){const r=(t==null?void 0:t.updatedAt)??e,a=r?Lce(r):null;return n.jsxs("div",{className:j("font-mono flex w-full items-center justify-between gap-x-4 text-muted",s),children:[t?n.jsxs("a",{href:rA(t.setCode),target:"_blank",rel:"noreferrer",className:j("flex items-center gap-1.5 tracking-[0.16em] text-muted no-underline","transition-colors hover:text-green"),children:["17LANDS DATA",n.jsx(en,{size:11})]}):n.jsxs(BX,{className:"tracking-[0.16em]",children:["SET REVIEW GRADES",n.jsx(FX,{className:"ml-1.5"})]}),a&&n.jsx("span",{className:"tracking-[0.06em]",children:a})]})}function Lce(e){const t=new Date(e),s=new Date;if((s.getTime()-t.getTime())/864e5<7){const l=ro(e,s);return l==="now"?"Updated just now":`Last updated ${l} ago`}const a=t.toLocaleDateString("en-US",{month:"short",day:"numeric"}),o=` '${String(t.getFullYear()%100).padStart(2,"0")}`,i=t.getFullYear()===s.getFullYear();return`Last updated ${a}${i?"":o}`}const Mg="shrink-0 h-[26px] px-2 border inline-flex items-center justify-center gap-1 cursor-pointer transition-colors";function GC({options:e,filters:t,setFilters:s,minDrafts:r,setMinDrafts:a,search:o,setSearch:i}){const l=(u,f)=>{const h=t[u],m=h.includes(f)?h.filter(y=>y!==f):[...h,f];s({...t,[u]:m})},c=u=>{s({...t,colors:t.colors.includes(u)?[]:[u]})},d=qR(t);return n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[n.jsxs("div",{className:"relative flex h-[26px] items-center",children:[n.jsx(ac,{size:13,className:"pointer-events-none absolute left-2 text-muted"}),n.jsx("input",{type:"text",value:o,onChange:u=>i(u.target.value),placeholder:"Search…",className:"h-[26px] w-60 border border-border2 bg-transparent pl-7 pr-6 text-[13px] text-text placeholder:text-muted focus:border-green focus:outline-none"}),o?n.jsx("button",{type:"button",onClick:()=>i(""),"aria-label":"Clear search",className:"absolute right-1.5 text-muted hover:text-text",children:n.jsx(rn,{size:13})}):null]}),n.jsx("div",{className:"flex items-center gap-1",children:e.colors.map(u=>n.jsx("button",{type:"button",onClick:()=>c(u.value),"aria-label":`${u.name} (${u.count})`,className:j(Mg,"min-w-[28px]",t.colors.includes(u.value)?oi:Rl),children:n.jsx("i",{className:df(u.value),style:{fontSize:u.value==="M"?20:14}})},u.value))}),n.jsx("div",{className:"flex items-center gap-1",children:e.types.map(u=>n.jsx("button",{type:"button",onClick:()=>l("types",u.value),"aria-label":`${u.label} (${u.count})`,className:j(Mg,t.types.includes(u.value)?oi:Rl),children:n.jsx("i",{className:`ms ms-${u.ms}`,style:{fontSize:17,WebkitTextStroke:"0.6px currentColor"}})},u.value))}),n.jsx("div",{className:"flex items-center gap-1",children:e.manaValues.map(u=>n.jsx("button",{type:"button",onClick:()=>l("manaValues",u.value),"aria-label":`Mana value ${u.value} (${u.count})`,className:j(Mg,"min-w-[26px]",t.manaValues.includes(u.value)?oi:Rl),children:n.jsx("span",{className:"font-display text-[15px] leading-none",children:u.value})},u.value))}),n.jsxs("div",{className:"flex h-[26px] items-center gap-2 border border-border2 pl-2.5 pr-2",children:[n.jsx("span",{className:"mr-0.5 font-display text-[11px] tracking-[0.16em] text-muted",children:"MIN DRAFTS"}),n.jsx("input",{type:"range",min:1,max:20,value:r,onChange:u=>a(Number(u.target.value)),className:j("w-24 cursor-pointer",r>1?"accent-green":"accent-subtle")}),n.jsx("span",{className:j("font-num w-6 text-center text-[15px] leading-none tabular-nums",r>1?"text-text":"text-muted"),children:r})]}),d>0?n.jsx("button",{type:"button",onClick:()=>s(KR),className:"flex h-[26px] items-center border border-border2 px-2.5 font-display text-[12px] tracking-[0.14em] text-muted transition-colors hover:border-green hover:text-green",children:"CLEAR"}):null]})}
518const Dce=[92,201,141],VC=[200,207,221],Ice=[224,106,106],Mce="rgb(122,131,149)",$ce=.07;function KC(e,t,s){const r=e.map((a,o)=>Math.round(a+(t[o]-a)*s));return`rgb(${r[0]}, ${r[1]}, ${r[2]})`}function w8(e){if(e==null)return Mce;const t=Math.max(-1,Math.min(1,(e-.5)/$ce));return t>=0?KC(VC,Dce,t):KC(VC,Ice,-t)}const tm="OTHER",$g="WUBRG";function j8(e){const t=[...e].filter(s=>$g.includes(s));return t.sort((s,r)=>$g.indexOf(s)-$g.indexOf(r)),t.length===2?t.join(""):tm}function Uce(e){const t=new Map;let s=0;for(const a of e){const o=j8(a.deck_colors),i=t.get(o)??{decks:0,gameWins:0,games:0};i.decks+=a.decks,i.gameWins+=a.game_wins,i.games+=a.games,t.set(o,i),s+=a.decks}const r=[];for(const[a,o]of t)r.push({key:a,colors:a===tm?"":a,decks:o.decks,gameWins:o.gameWins,games:o.games,playRate:s>0?o.decks/s:0,winRate:o.games>0?o.gameWins/o.games:null});return r}const qC=8,zce=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function k8(e,t){const s=e.includes("T")?e:`${e}T12:00:00`,r=new Date(s),a=Number.isNaN(r.getTime())?"":`${zce[r.getMonth()]} ${r.getDate()}`,o=/early/i.test(t)?"Early":/late/i.test(t)?"Late":"";return[a,o].filter(Boolean).join(" ").toUpperCase()}function S8(e,t){const s=e.eventDate.slice(0,10);for(const r of t??[])if(s>=r.startDate&&s<=r.endDate)return r.code}function ZC({setCode:e,season:t,sets:s}){const{data:r}=af(e),[a,o]=p.useState(qC),i=p.useMemo(()=>(r??[]).filter(u=>u.kind!=="mock"&&u.isFinalized&&(t==null||S8(u,s)===t)),[r,t,s]),l=p.useMemo(()=>i.filter(u=>u.championDisplayName).sort((u,f)=>u.eventTime<f.eventTime?1:u.eventTime>f.eventTime?-1:0),[i]),c=p.useMemo(()=>i.reduce((u,f)=>u+(f.participantCount??0),0),[i]),d=l.slice(0,a);return n.jsxs("div",{className:"flex flex-col gap-4",children:[n.jsxs(fc,{children:[n.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[n.jsx(ct,{size:16,color:"#ffc63a"}),n.jsx(Xe,{size:16,className:"text-subtle",children:"RECENT TROPHIES"})]}),r?l.length===0?n.jsx("div",{className:"font-mono text-[11px] text-muted py-2",children:"NO TROPHIES YET"}):n.jsxs(n.Fragment,{children:[d.map((u,f)=>{const h=u.championPlayerSlug?`/pods/${u.slug}/${u.championPlayerSlug}`:`/pods/${u.slug}?player=${encodeURIComponent(u.championDisplayName??"")}`;return n.jsxs(te,{to:h,className:j("group grid grid-cols-[28px_minmax(0,1fr)_86px_50px] gap-2 items-center py-[7px] -mx-1 px-1 no-underline text-inherit transition-colors hover:bg-surface2",f?"border-t border-border":""),children:[n.jsx(Be,{colors:wo(u.championDeckColors),size:10}),n.jsx("span",{className:"font-display text-[15px] leading-none tracking-[0.04em] truncate",children:_c(u.championDisplayName??"").toUpperCase()}),n.jsx("span",{className:"font-mono text-[11px] text-subtle whitespace-nowrap text-left",children:k8(u.eventDate,u.name)}),n.jsxs("span",{className:"flex items-center justify-end gap-1 font-mono text-[11px] text-muted tabular-nums whitespace-nowrap",children:[ro(u.eventTime),n.jsx(en,{size:12,className:"text-dim transition-colors group-hover:text-text","aria-hidden":"true"})]})]},u.eventId)}),l.length>a&&n.jsxs("button",{type:"button",onClick:()=>o(u=>u+qC),className:"-mb-3.5 mt-0.5 flex w-full items-center justify-center gap-1.5 border-t border-border bg-transparent py-2 font-display text-[12px] tracking-[0.18em] text-muted transition-colors hover:text-text",children:["SHOW MORE",n.jsx(Et,{size:15,strokeWidth:2.5})]})]}):n.jsx("div",{className:"font-mono text-[11px] text-muted py-2",children:"LOADING…"})]}),i.length>0&&n.jsxs("div",{className:"font-mono text-[11px] text-muted -mt-2 flex justify-between px-8",children:[n.jsxs("span",{children:[c," PLAYERS"]}),n.jsxs("span",{children:[i.length," EVENTS"]})]})]})}const YC=e=>e==null?"—":`${(e*100).toFixed(1)}%`,QC="grid grid-cols-[22px_26px_minmax(0,1fr)_28px_66px_54px] gap-1.5 items-center",JC=5;function XC({setCode:e,season:t,sets:s}){const{data:r,isPending:a}=HZ(e),{data:o}=af(e),[i,l]=p.useState("win"),[c,d]=p.useState("desc"),[u,f]=p.useState(JC),h=p.useMemo(()=>{const w=new Map;for(const x of o??[]){if(x.kind==="mock"||!x.isFinalized||!x.championDeckColors||t!=null&&S8(x,s)!==t)continue;const g=j8(x.championDeckColors);w.set(g,(w.get(g)??0)+1)}return w},[o,t,s]),m=p.useMemo(()=>{const w=t==null?r??[]:(r??[]).filter(g=>g.season===t),x=g=>i==="play"?g.playRate:g.winRate??-1;return Uce(w).sort((g,v)=>{const k=x(g)-x(v);return c==="desc"?-k:k})},[r,t,i,c]),y=m.slice(0,u),b=w=>{w===i?d(x=>x==="desc"?"asc":"desc"):(l(w),d("desc"))};
518return n.jsxs(fc,{children:[n.jsxs("div",{className:j(QC,"mb-2 items-center font-display text-[11px] tracking-[0.1em] text-muted"),children:[n.jsxs("div",{className:"col-span-3 flex items-center gap-1.5",children:[n.jsx(ct,{size:16,color:"#ffc63a"}),n.jsx(Xe,{size:16,className:"text-subtle",children:"TOP COLORS"})]}),n.jsx("span",{className:"flex justify-end",children:n.jsx(ct,{size:13,color:"#ffc63a"})}),n.jsx(Ni,{label:"PLAY RATE",active:i==="play",dir:c,onClick:()=>b("play")}),n.jsx(Ni,{label:"WIN RATE",active:i==="win",dir:c,onClick:()=>b("win")})]}),a?n.jsx("div",{className:"font-mono text-[11px] text-muted py-2",children:"LOADING…"}):m.length===0?n.jsx("div",{className:"font-mono text-[11px] text-muted py-2",children:"NO DECK COLORS RECORDED YET"}):n.jsxs(n.Fragment,{children:[y.map((w,x)=>n.jsxs("div",{className:j(QC,"py-2",x?"border-t border-border":""),children:[n.jsx("span",{className:"font-num text-[13px] text-muted pl-1 leading-none",children:x+1}),n.jsx("span",{className:"flex justify-center",children:w.key===tm?n.jsx(ia,{size:18,className:"shrink-0 block -my-1","aria-hidden":"true"}):n.jsx(Be,{colors:w.colors,size:12})}),n.jsx("span",{className:"font-display text-[14px] tracking-[0.05em] pl-1.5 truncate",children:w.key===tm?"Other":ys(w.colors)}),n.jsx("span",{className:"font-num text-[14px] tabular-nums text-right text-text",children:h.get(w.key)??0}),n.jsxs("span",{className:"font-num text-[14px] tabular-nums text-right text-text",children:[YC(w.playRate),n.jsxs("span",{className:"ml-1 text-[11px] text-subtle",children:["(",w.decks,")"]})]}),n.jsx("span",{className:"font-num text-[14px] tabular-nums text-right",style:{color:w8(w.winRate)},children:YC(w.winRate)})]},w.key)),m.length>u&&n.jsxs("button",{type:"button",onClick:()=>f(w=>w+JC),className:"-mb-3.5 mt-0.5 flex w-full items-center justify-center gap-1.5 border-t border-border bg-transparent py-2 font-display text-[12px] tracking-[0.18em] text-muted transition-colors hover:text-text",children:["SHOW MORE",n.jsx(Et,{size:15,strokeWidth:2.5})]})]})]})}function Rw({sources:e,alt:t="",className:s,style:r}){const a=e.join("|"),o=p.useMemo(()=>a.split("|").filter(Boolean),[a]),{src:i,onError:l}=$i(o),{loaded:c,instant:d,onLoad:u}=xA(i??"");return n.jsxs("div",{className:j("relative overflow-hidden bg-surface2",s),style:r,children:[!c&&n.jsx("div",{className:"absolute inset-0 animate-pulse bg-surface2"}),i&&n.jsx("img",{src:i,alt:t,loading:"lazy",decoding:"async",onLoad:u,onError:l,className:j("block h-full w-full object-cover",c?"opacity-100":"opacity-0",!d&&"transition-opacity duration-300")},i)]})}function N8(){const e=p.useRef(null);return{bind:s=>({onMouseEnter:r=>{var a;return(a=e.current)==null?void 0:a.show(s,r)},onMouseMove:r=>{var a;return(a=e.current)==null?void 0:a.show(s,r)},onMouseLeave:()=>{var r;return(r=e.current)==null?void 0:r.hide()},onMouseDown:()=>{var r;return(r=e.current)==null?void 0:r.hide()}}),layer:n.jsx(Bce,{ref:e})}}const Bce=p.forwardRef((e,t)=>{const[s,r]=p.useState(null),a=p.useRef(null);return p.useImperativeHandle(t,()=>({show:(o,i)=>{r(o),a.current&&(a.current.style.transform=`translate(${i.clientX+14}px, ${i.clientY+18}px)`)},hide:()=>r(null)})),It.createPortal(n.jsx("div",{ref:a,className:j("fixed left-0 top-0 z-50 pointer-events-none select-none rounded-md px-2.5 py-1.5 whitespace-nowrap","border border-border2 bg-black text-text text-[12px] leading-tight shadow-lg shadow-black/60",s?"opacity-100":"opacity-0"),children:s}),document.body)});function Fce(e){const[t,s]=(e.record??"").split("-"),r=parseInt(t||"0",10)||0,a=parseInt(s||"0",10)||0;return{eventId:e.event_id,eventSlug:e.event_slug,eventName:e.event_name,eventDate:e.event_date,eventTime:e.event_time,season:e.season,seat:e.seat,packNum:e.pack_num,pickNum:e.pick_num,maindecked:e.maindecked,displayName:e.player_display_name??_c(e.display_name),participantDisplayName:e.display_name,playerSlug:e.player_slug,avatarUrl:e.avatar_url,deckColors:e.deck_colors,record:e.record,wins:r,losses:a,placement:e.placement,isTrophy:r>=Sc,deckScreenshotUrl:e.deck_screenshot_url,deckScreenshotCaption:e.deck_screenshot_caption}}const ci=15;function Wce(e){const t=Array.from({length:ci},()=>0),s=new Map;let r=0,a=0,o=0,i=0;for(const c of e){const d=Math.min(c.pickNum,ci)-1;if(t[d]+=1,!c.maindecked)continue;r+=1,o+=c.wins,i+=c.losses,c.isTrophy&&(a+=1);const u=bp(wo(c.deckColors));if(!u)continue;const f=s.get(u)??{colors:u,decks:0,wins:0,losses:0};f.decks+=1,f.wins+=c.wins,f.losses+=c.losses,s.set(u,f)}const l=[...s.values()].sort((c,d)=>d.decks-c.decks||d.wins-c.wins);return{taken:e.length,maindecks:r,trophies:a,matchWins:o,matchLosses:i,pickCurve:t,colorPairs:l}}function Hce(e){return[...e].sort((t,s)=>t.eventTime<s.eventTime?1:t.eventTime>s.eventTime?-1:t.seat-s.seat)}function Gce(e,t,s){const r=new Set;for(const o of t)o.maindecked&&r.add(`${o.eventId}|${o.seat}`);const a=new Map;for(const o of e){if(o.card_name===s||!r.has(`${o.event_id}|${o.seat}`))continue;const i=a.get(o.card_name)??{name:o.card_name,set:o.card_set,decks:0};i.decks+=1,a.set(o.card_name,i)}return[...a.values()].sort((o,i)=>i.decks-o.decks||o.name.localeCompare(i.name))}function Vce(e,t,s){const{data:r,isPending:a}=FZ(e,t);return p.useMemo(()=>{const o=(r??[]).filter(l=>s==null||l.season===s),i=Hce(o.map(Fce));return{decks:i,summary:Wce(i),isPending:a}},[r,s,a])}function Kce(e,t){const s=p.useMemo(()=>{const i=new Set;for(const l of e.decks)l.maindecked&&i.add(l.eventId);return[...i].sort()},[e.decks]),{data:r,isPending:a}=WZ(s);return{cards:p.useMemo(()=>Gce(r??[],e.decks,t),[r,e.decks,t]),isPending:e.isPending||s.length>0&&a}
518}function Hh(e,t,s){const r=`/pods/${e}/data`;return`${t?`${r}/${Cu(t)}`:r}${s}`}const qce=e=>e==null?"—":`${(e*100).toFixed(1)}%`;function Zce({curve:e,ata:t,alsa:s,height:r=84}){let a=0;for(const o of e)a=Math.max(a,o);return n.jsxs("div",{children:[n.jsx(cx,{title:"PICK ORDER",children:n.jsxs("span",{className:"flex items-center gap-3 font-mono text-[11px] whitespace-nowrap",children:[s!=null&&n.jsxs("span",{className:"text-purple",children:["ALSA ",s.toFixed(2)]}),t!=null&&n.jsxs("span",{className:"text-blue",children:["ATA ",t.toFixed(2)]})]})}),n.jsxs("div",{className:"relative grid items-end gap-[3px]",style:{gridTemplateColumns:`repeat(${ci}, minmax(0, 1fr))`,height:r},children:[e.map((o,i)=>{const l=a>0?o/a:0,c=`${Math.max(l*100,8)}%`;return n.jsx(Ne,{label:Yce(o,i+1),side:"top",children:n.jsxs("div",{className:"relative h-full bg-surface2",children:[o>0&&n.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-green",style:{height:c,opacity:.35+l*.65}}),o>0&&n.jsx("span",{className:j("absolute inset-x-0 z-20 text-center font-num font-semibold text-[11px] leading-none text-white","[text-shadow:0_0_2px_#0a0c10,0_0_2px_#0a0c10,0_0_1px_#0a0c10]",l>.5&&"top-1.5"),style:l>.5?void 0:{bottom:`calc(${c} + 4px)`},children:o})]})},i)}),n.jsx(e4,{average:s,className:"bg-purple"}),n.jsx(e4,{average:t,className:"bg-blue"})]}),n.jsx("div",{className:"mt-1 grid h-4 gap-[3px] font-num text-[10px] leading-4 text-dim text-center",style:{gridTemplateColumns:`repeat(${ci}, minmax(0, 1fr))`},children:e.map((o,i)=>n.jsx("span",{children:i+1},i))})]})}function e4({average:e,className:t}){if(e==null)return null;const s=Math.min(Math.max(e,1),ci)-1,a=`((100% - ${(ci-1)*3}px) / ${ci})`,o=`calc(${s} * (${a} + 3px) + ${a} / 2)`;return n.jsx("span",{className:j("pointer-events-none absolute inset-y-0 z-10 w-0.5 -translate-x-1/2 shadow-[0_0_0_1px_rgba(10,12,16,0.6)]",t),style:{left:o},"aria-hidden":!0})}function Yce(e,t){const s=Qce(t);return e===0?`Never taken ${s}`:`Taken ${s} in ${e} ${e===1?"draft":"drafts"}`}function Qce(e){const s=e%100>=11&&e%100<=13?"th":{1:"st",2:"nd",3:"rd"}[e%10]??"th";return`${e}${s}`}function cx({title:e,children:t}){return n.jsxs("div",{className:"mb-1.5 flex h-6 items-center justify-between gap-3",children:[n.jsx(Xe,{size:14,className:"text-subtle",children:e}),t]})}const Jce=j("grid items-center gap-x-3","grid-cols-[var(--pips)_minmax(0,1fr)_40px_58px]","sm:grid-cols-[var(--pips)_minmax(0,1fr)_84px_40px_58px]","2xl:grid-cols-[var(--pips)_minmax(0,1fr)_84px_64px_58px]");function C8(e,t=10){let s=2;for(const r of e)s=Math.max(s,wo(r).length);return{"--pips":`${s*(t+4)}px`}}function Xce(e){return`${e} ${e===1?"DECK":"DECKS"}`}function ede({decks:e,isPending:t,onOpen:s,pageSize:r=8,reserveRows:a=!0,hoverTips:o=!0,footerStart:i,className:l}){const c=N8(),[d,u]=p.useState("played"),[f,h]=p.useState(0),m=e.filter(S=>S.maindecked),y=e.filter(S=>!S.maindecked),b=d==="played"?m:y,w=Math.max(1,Math.ceil(b.length/r)),x=f*r,g=b.slice(x,x+r),v=d==="played"?"NO DECKS YET":"NO DECK HAS SIDEBOARDED IT",k=S=>{u(S),h(0)};return n.jsxs("div",{className:j("flex flex-col",l),style:C8(g.map(S=>S.deckColors)),children:[n.jsx(cx,{title:"RECENT DECKS",children:n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsxs(s4,{active:d==="played",onClick:()=>k("played"),children:["MAINDECK ",t?"":m.length]}),n.jsxs(s4,{active:d==="sideboard",onClick:()=>k("sideboard"),children:["SIDEBOARD ",t?"":y.length]})]})}),Array.from({length:Aw(a,r,g.length)},(S,N)=>{const C=g[N];if(C)return n.jsx(tde,{deck:C,first:N===0,tooltip:o?c.bind("View Deck"):void 0,onOpen:s},`${C.eventId}|${C.seat}`);const _=N===0?t?"LOADING…":v:null;return n.jsx(T8,{first:N===0,note:_,pulse:t},`reserved-${N}`)}),n.jsxs("div",{className:"mt-auto flex items-center justify-end gap-2 border-t border-border pt-1.5",children:[i&&n.jsx("div",{className:"mr-auto",children:i}),n.jsx(t4,{dir:"prev",disabled:f===0,onClick:()=>h(S=>Math.max(S-1,0))}),n.jsxs("span",{className:j("min-w-[40px] text-center font-num text-[13px] text-subtle",w<2&&"invisible"),children:[f+1," / ",w]}),n.jsx(t4,{dir:"next",disabled:f>=w-1,onClick:()=>h(S=>Math.min(S+1,w-1))})]}),c.layer]})}const _8="h-[36px]";function Aw(e,t,s){return e?t:Math.max(s,1)}function T8({first:e,note:t,pulse:s,height:r=_8}){return n.jsx("div",{className:j(r,"flex items-center",e?"":"border-t border-border/40"),children:t?n.jsx("span",{className:"font-mono text-[11px] text-muted",children:t}):s?n.jsx("span",{className:"h-2.5 w-2/3 bg-surface2 animate-pulse"}):null})}function t4({dir:e,disabled:t,onClick:s}){const r=e==="prev"?lo:co;return n.jsx("button",{type:"button",onClick:s,disabled:t,"aria-label":e==="prev"?"Previous decks":"Next decks",className:"flex h-7 w-7 items-center justify-center border border-white/40 bg-surface2 text-text transition-colors hover:border-white/70 hover:bg-white/10 disabled:opacity-25 disabled:hover:border-white/40 disabled:hover:bg-surface2",children:n.jsx(r,{size:15,strokeWidth:2.5})})}function s4({active:e,onClick:t,children:s}){return n.jsx("button",{type:"button",onClick:t,"aria-pressed":e,className:j("border px-2 py-1 font-display text-[11px] tracking-[0.14em] leading-none transition-colors",e?"border-green text-green":"border-border text-muted hover:text-text"),children:s})}function tde({deck:e,first:t,tooltip:s,onOpen:r}){const a=k8(e.eventDate,e.eventName);return n.jsxs(te,{to:ta(e.eventSlug,e.displayName,e.displayName),...s,onClick:nx(()=>r(e)),className:j(Jce,_8,"group w-full -mx-1 px-1 text-left bg-transparent no-underline transition-colors hover:bg-surface2",t?"":"border-t border-border"),children:[n.jsx(E8,{colors:wo(e.deckColors),size:10}),n.jsx("span",{className:"min-w-0 truncate font-display text-[15px] leading-none tracking-[0.04em]",children:e.displayName.toUpperCase()}),n.jsx("span",{className:"hidden sm:block font-mono text-[11px] text-subtle whitespace-nowrap",children:a}),n.jsx(sde,{pack:e.packNum,pick:e.pickNum}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[e.record?n.jsx(ht,{centered:!0,wins:e.wins,losses:e.losses,className:"font-num text-[13px] w-full"}):n.jsx("span",{className:"w-full text-center font-num text-[13px] text-dim",children:"—"}),n.jsx("span",{className:"flex w-[13px] shrink-0 justify-end",children:e.isTrophy&&n.jsx(ct,{size:13,color:"#ffc63a"})})]})]})}function E8({colors:e,size:t}){return n.jsx("span",{className:"inline-flex will-change-transform",children:n.jsx(Be,{colors:e,size:t})})}function sde({pack:e,pick:t}){const s=e==null?"":`P${e} `;return n.jsxs("span",{className:"font-mono text-[11px] text-muted whitespace-nowrap",children:[n.jsx("span",{className:"2xl:hidden",children:e==null?`PICK ${t}`:`${s}P${t}`}),n.jsx("span",{className:"hidden 2xl:inline",children:`${s}PICK ${t}`})]})}
518function nde({summary:e,isPending:t,limit:s=5,reserveRows:r=!0}){const a=e.colorPairs.slice(0,s);return n.jsxs("div",{style:C8(a.map(o=>o.colors),11),children:[n.jsx(cx,{title:"PLAYED IN",children:!t&&n.jsx("span",{className:"font-mono text-[11px] text-muted",children:Xce(e.maindecks)})}),n.jsx("div",{className:"border-b border-border",children:Array.from({length:Aw(r,s,a.length)},(o,i)=>{const l=a[i];if(l)return n.jsx(rde,{pair:l,maindecks:e.maindecks,first:i===0},l.colors);const c=i===0&&t?"LOADING…":null;return n.jsx(T8,{first:i===0,note:c,pulse:t,height:R8},`reserved-${i}`)})})]})}function rde({pair:e,maindecks:t,first:s}){const r=t>0?e.decks/t:0;return n.jsxs("div",{className:j("grid grid-cols-[var(--pips)_minmax(0,1fr)_auto_44px] gap-x-3 items-center",R8,s?"":"border-t border-border"),children:[n.jsx(E8,{colors:e.colors,size:11}),n.jsx("span",{className:"relative font-display text-[14px] tracking-[0.05em] truncate",children:ys(e.colors)}),n.jsxs("span",{className:"font-num text-[13px] text-text text-right tabular-nums whitespace-nowrap",children:[qce(r),n.jsxs("span",{className:"ml-1 text-[11px] text-subtle",children:["(",e.decks,")"]})]}),n.jsx(ht,{centered:!0,wins:e.wins,losses:e.losses,className:"font-num text-[13px] w-full"})]})}const R8="h-[36px]";function ade({cards:e,isPending:t,boardCode:s,search:r,maindecks:a,limit:o=6,columns:i=3,reserveRows:l=!0}){const c=e.slice(0,o),d=Mi(c);return n.jsxs("div",{className:"flex h-full flex-col",children:[n.jsx(cx,{title:"PLAYED TOGETHER"}),n.jsx("div",{className:"grid flex-1 auto-rows-fr gap-x-3",style:{gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`},children:Array.from({length:Aw(l,o,c.length)},(u,f)=>{const h=c[f];if(!h){const y=f===0?t?"LOADING…":"NOTHING YET":null;return n.jsx("div",{className:"flex min-h-10 items-center",children:y&&n.jsx("span",{className:"font-mono text-[11px] text-muted",children:y})},`reserved-${f}`)}const m=a>0?Math.round(h.decks/a*100):null;return n.jsxs(te,{to:Hh(s,h.name,r),className:"group flex min-h-10 min-w-0 items-center gap-2.5 py-0.5 no-underline text-inherit",children:[n.jsx("span",{className:"relative flex min-h-9 w-[60px] shrink-0 self-stretch bg-white/25",style:{clipPath:Xr},children:n.jsx(Rw,{sources:Bh(h.name,h.set,d),alt:h.name,className:"absolute inset-px",style:{clipPath:Xr}})}),n.jsxs("span",{className:"relative min-w-0",children:[n.jsx("span",{className:"block truncate font-display text-[16px] leading-tight tracking-[0.03em] transition-colors group-hover:text-green",children:h.name.split("//")[0].trim()}),m!=null&&n.jsxs("span",{className:"absolute left-0 top-full font-num text-[11px] leading-none text-muted",children:[m,"%"]})]})]},h.name)})})]})}function ode({deck:e,onClose:t,onPrev:s,onNext:r}){const{data:a}=of(e.eventId),o=p.useMemo(()=>a?mc(a,e.seat):null,[a,e.seat]),i={playerSlug:e.playerSlug,seatIndex:e.seat};return n.jsx(Fc,{participant:{eventId:e.eventId,displayName:e.displayName,participantDisplayName:e.participantDisplayName,deckColors:e.deckColors,deckScreenshotUrl:e.deckScreenshotUrl,deckScreenshotCaption:e.deckScreenshotCaption,mainboard:o,record:e.record},breakdownHref:wr(e.eventSlug,e.displayName),draftLogHref:a?sa(e.eventSlug,i):null,onClose:t,onPrev:s,onNext:r})}function ide(e){const[t,s]=p.useState(null),r=e.filter(l=>l.maindecked===((t==null?void 0:t.maindecked)??!0)),a=t?r.findIndex(l=>l.eventId===t.eventId&&l.seat===t.seat):-1,o=l=>{a<0||r.length===0||s(r[(a+l+r.length)%r.length])},i=t?n.jsx(ode,{deck:t,onClose:()=>s(null),onPrev:r.length>1?()=>o(-1):void 0,onNext:r.length>1?()=>o(1):void 0}):null;return{openDeck:s,deckOpen:t!=null,modal:i}}function n4({sources:e,name:t}){return n.jsx(Rw,{sources:e,alt:t,className:"h-9 w-12 max-w-full shrink-0",style:{clipPath:Xr}})}function A8({sources:e}){return n.jsx(Rw,{sources:e,className:`w-full ${Eu}`,style:{aspectRatio:"488 / 680"}})}function lde({boardCode:e,card:t,imageSources:s,artSources:r,season:a,search:o,colSpan:i,mobile:l=!1}){const c=Vce(e,t.name,a),d=Kce(c,t.name),{openDeck:u,modal:f}=ide(c.decks),{summary:h,isPending:m}=c,y=n.jsx(cde,{detail:c,compact:l}),b=n.jsx(Zce,{curve:h.pickCurve,ata:t.ata,alsa:t.alsa,height:45}),w=n.jsx(nde,{summary:h,isPending:m,limit:6,reserveRows:!l}),x=n.jsx(ede,{decks:c.decks,isPending:m,onOpen:u,pageSize:8,reserveRows:!l,hoverTips:!l,footerStart:l?y:void 0,className:"min-w-0 h-full"}),g=(v,k)=>n.jsx(ade,{cards:d.cards,isPending:d.isPending,boardCode:e,search:o,maindecks:h.maindecks,limit:v,columns:k,reserveRows:!l});return n.jsx("tr",{children:n.jsxs("td",{colSpan:i,className:"p-0 border-b border-border",children:[n.jsxs("div",{className:j("relative bg-bg animate-fadeIn",l?"sticky left-0 w-[100vw] px-4 py-5":"px-5 py-5"),children:[n.jsx(dde,{sources:r}),l?n.jsxs("div",{className:"relative flex flex-col gap-4",children:[x,b,(m||h.colorPairs.length>0)&&w,(d.isPending||d.cards.length>0)&&g(6,2)]}):n.jsxs("div",{className:j("relative grid items-stretch gap-x-6 gap-y-5","grid-cols-[208px_minmax(240px,0.85fr)_minmax(0,1.3fr)]","2xl:grid-cols-[232px_minmax(0,0.9fr)_minmax(0,1.3fr)_210px]"),children:[n.jsxs("div",{className:"-mb-5 flex flex-col",children:[n.jsx(A8,{sources:s}),n.jsx("div",{className:"flex flex-1 items-center",children:y})]}),n.jsxs("div",{className:"min-w-0 flex flex-col justify-between gap-3",children:[w,b]}),x,n.jsx("div",{className:"hidden 2xl:block min-w-0",children:g(7,1)})]})]}),f]})})}
518function cde({detail:e,compact:t}){const{summary:s,isPending:r}=e,a=s.trophies>0;return n.jsxs("div",{className:j("flex items-center",t?"gap-7":"w-full justify-between gap-4 px-3",r&&"invisible"),children:[n.jsxs("span",{className:"flex items-center gap-1.5 font-num font-medium text-[15px] leading-none",children:[n.jsx(ct,{size:14,color:a?"#ffc63a":void 0,className:"text-dim"}),n.jsx("span",{className:a?"text-text":"text-muted",children:s.trophies})]}),n.jsx(ht,{wins:s.matchWins,losses:s.matchLosses,className:"font-num font-medium text-[15px] leading-none"})]})}function dde({sources:e}){const[t,s]=p.useState(!1),r=e[0];return r?n.jsx("img",{src:r,alt:"","aria-hidden":!0,decoding:"async",onLoad:()=>s(!0),className:j("pointer-events-none absolute right-0 top-0 h-full w-[70%] object-cover transition-opacity duration-500",t?"opacity-[0.16]":"opacity-0"),style:{maskImage:"linear-gradient(to right, transparent, black 60%)",WebkitMaskImage:"linear-gradient(to right, transparent, black 60%)"}}):null}const gh="ALL",ude="font-num font-medium text-[15px] text-text",fde=new Set(["seen","picked"]),P8={seen:54,picked:56,alsa:50,ata:50,gamesPlayed:54,playRate:86,winRate:58},O8=44,L8=184,hde=O8+L8+Object.values(P8).reduce((e,t)=>e+(t??60),0);function pde(e,t){const s=[...new Set(e.map(a=>a.season))].filter(a=>a!=="CUBE"&&a!=="UNKNOWN"),r=new Map((t??[]).map((a,o)=>[a.code,o]));return s.sort((a,o)=>(r.get(a)??999)-(r.get(o)??999)||a.localeCompare(o)),s}function r4(){const{board:e,card:t}=cn(),s=(e??"PEASANT").toUpperCase(),r=HR(s),a=ln(),{search:o}=Rt(),[i]=Rn(),l=Bc(gh),{data:c,isPending:d}=BZ(s),u=p.useMemo(()=>c??[],[c]),{data:f}=un(),h=ut(),[m,y]=p.useState("cards"),[b,w]=p.useState(!1),[x,g]=p.useState("alsa"),[v,k]=p.useState("asc"),[S,N]=p.useState(1),[C,_]=p.useState(KR),[T,E]=p.useState(""),[A,P]=p.useState(null),M=p.useRef(null),[U,F]=p.useState(0);p.useLayoutEffect(()=>{const ee=M.current;if(!ee)return;const Q=()=>F(ee.getBoundingClientRect().height);Q();const re=new ResizeObserver(Q);return re.observe(ee),()=>re.disconnect()},[]);const I=p.useRef(!1),q=(ee,Q)=>{if(h||ye.has(ee.name))return;I.current=!0;const re=vr(ee.name,ee.set,Fe);if(re.length===0)return;const fe=new Image;fe.onload=()=>{I.current&&P({sources:re,anchor:uf(Q)})},fe.src=re[0],fe.complete&&fe.onload(new Event("load"))},O=()=>{I.current=!1,P(null)},[H,B]=p.useState([]),D=p.useRef(null),L=ee=>{O();const Q=H.filter(qe=>qe!==ee.name),fe=ye.has(ee.name)?Q:[...Q,ee.name],Ee=fe[fe.length-1]??null;B(fe),D.current=Ee,a(Hh(s,Ee,o),{replace:!0})},$=p.useMemo(()=>pde(u,f),[u,f]),V=i.get(Hn),z=V&&(!c||$.includes(V))?V:null,K=p.useMemo(()=>{const ee=z==null?u:u.filter(Q=>Q.season===z);return Ck(ee)},[u,z]),W=p.useMemo(()=>{const ee=new Set,Q=[];for(const re of u){const fe=`${re.card_set??""}|${re.card_name}`;ee.has(fe)||(ee.add(fe),Q.push({name:re.card_name,set:re.card_set}))}return Q},[u]),[J,Z]=p.useState(()=>new Set),Y=p.useMemo(()=>wY(K),[K]),ae=p.useMemo(()=>{const ee=T.trim().toLowerCase(),Q=K.filter(re=>re.drafts>=S&&vY(re,C)&&(!ee||re.name.toLowerCase().includes(ee)));return mY(Q,x,v)},[K,S,C,T,x,v]),pe=p.useMemo(()=>{if(!t)return null;const ee=t.toLowerCase();for(const Q of K)if(Cu(Q.name)===ee)return Q;for(const Q of Ck(u))if(Cu(Q.name)===ee)return Q;return null},[t,K,u]),ye=p.useMemo(()=>new Set(pe?[...H,pe.name]:H),[H,pe]),De=p.useMemo(()=>{const ee=pe?[{name:pe.name,set:pe.set}]:[];for(const Q of W)J.has(D8(Q.name,Q.set))&&ee.push(Q);return ee},[J,pe,W]),Fe=fte(W,De),tt=p.useRef(null),st=p.useRef(null);p.useEffect(()=>{const ee=tt.current;if(!ee)return;const Q=new IntersectionObserver(re=>{const fe=[];for(const Ee of re){const qe=Ee.target.dataset.imageKey;Ee.isIntersecting&&qe&&fe.push(qe)}Z(Ee=>fe.every(qe=>Ee.has(qe))?Ee:new Set([...Ee,...fe]))},{root:h?st.current:null,rootMargin:"400px 0px"});for(const re of ee.querySelectorAll("tr[data-image-key]"))Q.observe(re);return()=>Q.disconnect()},[ae,h]);const ie=p.useRef(null),Se=p.useRef(null);p.useLayoutEffect(()=>{const ee=(pe==null?void 0:pe.name)??null;if(ee===Se.current)return;if(ee!=null&&ee!==D.current){const re=ie.current;if(!re)return;mde(re,h?st.current:null,U),B(fe=>fe.includes(ee)?fe:[...fe,ee])}Se.current=ee,D.current=null});const Ie=N8(),_e=ee=>h?void 0:Ie.bind(ye.has(ee.name)?"Close Breakdown":"Open Card Breakdown"),We=n.jsxs(n.Fragment,{children:[A?It.createPortal(n.jsx(Ym,{anchor:A.anchor,children:n.jsx(A8,{sources:A.sources})}),document.body):null,Ie.layer]}),we=(ee,Q)=>ye.has(ee.name)?n.jsx(lde,{boardCode:s,card:ee,imageSources:vr(ee.name,ee.set,Fe),artSources:Bh(ee.name,ee.set,Fe),season:z,search:o,colSpan:gn.length+(Q?2:1),mobile:Q}):null,He=ee=>{ee===x?k(Q=>Q==="desc"?"asc":"desc"):(g(ee),k("desc"))};if(h){const ee=qR(C),Q=[{value:gh,label:"ALL SEASONS",icon:n.jsx(Ov,{size:20,className:"text-white shrink-0"})},...$.map(re=>({value:re,label:`${re} SEASON`,glyph:re}))];return n.jsxs("div",{className:"bg-bg text-text min-h-screen flex flex-col page-fade",children:[n.jsx(St,{subtitle:r.toUpperCase()}),n.jsxs("div",{ref:M,className:"sticky top-0 z-30",children:[n.jsxs("div",{className:"relative z-10 px-4 py-3 border-b border-border bg-surface flex items-center gap-3",children:[n.jsx(Ae,{code:"CUBE",size:40,className:"text-text shrink-0"}),n.jsx("span",{className:"min-w-0 truncate font-display tracking-[0.04em]",style:{fontSize:24,lineHeight:.9},children:r.toUpperCase()}),n.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[m==="cards"&&n.jsxs("button",{type:"button",onClick:()=>w(re=>!re),"aria-expanded":b,"aria-label":"Filters",className:j("relative flex h-9 w-9 shrink-0 items-center justify-center border transition-colors",b||ee>0?"border-green text-green":"border-border2 text-muted"),children:[n.jsx(b1,{size:16}),ee>0&&n.jsx("span",{className:"absolute -top-1.5 -right-1.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-green px-1 text-[10px] font-bold text-bg",children:ee})]}),n.jsx("div",{className:"w-[150px]",children:n.jsx(hP,{value:z??gh,options:Q,hrefFor:re=>l(Hn,re),variant:"mobile"})})]})]}),n.jsxs("div",{className:"page-chrome bg-bg",children:[n.jsxs("div",{className:"flex items-stretch border-b border-border",children:[n.jsx(Xp,{active:m==="cards",onClick:()=>y("cards"),children:"CARD DATA"}),n.jsx(Xp,{active:m==="archetypes",onClick:()=>y("archetypes"),children:"DECK COLORS"})]}),m==="cards"&&b&&n.jsx("div",{className:"border-b border-border px-4 py-3",children:n.jsx(GC,{options:Y,filters:C,setFilters:_,minDrafts:S,setMinDrafts:N,search:T,setSearch:E})})]})]}),n.jsx("main",{className:"flex-1",children:m==="archetypes"?n.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[n.jsx(XC,{setCode:s,season:z,sets:f}),n.jsx(ZC,{setCode:s,season:z,sets:f})]}):n.jsx("div",{ref:st,className:"overflow-auto",style:{maxHeight:`calc(100dvh - ${U}px)`},children:n.jsxs("table",{className:"table-fixed border-collapse text-[13px]",style:{width:hde},children:[n.jsxs("colgroup",{children:[n.jsx("col",{style:{width:O8}}),n.jsx("col",{style:{width:L8}}),gn.map(re=>n.jsx("col",{style:{width:P8[re.key]??60}},re.key))]}),n.jsx("thead",{children:n.jsxs("tr",{className:"text-left",children:[n.jsx("th",{className:"sticky left-0 top-0 z-30 bg-bg pl-2 py-2 border-b border-border","aria-hidden":!0}),n.jsx("th",{className:"sticky top-0 z-20 bg-bg border-b border-border p-0 text-left font-normal font-display tracking-[0.2em] text-[11px] text-muted",children:n.jsx(Ni,{label:"CARD NAME",active:x==="name",dir:v,onClick:()=>He("name"),fill:!0,align:"left",className:"pr-2 py-2"})}),gn.map((re,fe)=>n.jsx("th",{className:"sticky top-0 z-20 bg-bg border-b border-border whitespace-nowrap p-0 text-right font-normal font-display tracking-[0.2em] text-[11px] text-muted",children:n.jsx(i4,{col:re,sortKey:x,sortDir:v,onSort:He,mobile:!0,isLast:fe===gn.length-1})},re.key))]})}),n.jsx("tbody",{ref:tt,children:d?n.jsx(d4,{sticky:!0}
518):ae.length===0?n.jsx(c4,{text:K.length===0?"No cube drafts on record yet":"No cards match these filters"}):ae.map(re=>n.jsxs(p.Fragment,{children:[n.jsx(l4,{card:re,href:Hh(s,re.name,o),sources:Bh(re.name,re.set,Fe),rowRef:(pe==null?void 0:pe.name)===re.name?ie:void 0,active:ye.has(re.name),onHover:q,onLeave:O,onOpen:L,sticky:!0}),we(re,!0)]},`${re.name}|${re.set}`))})]})})}),n.jsx(Lu,{className:"mt-auto px-5 py-4 shrink-0"}),We]})}return n.jsxs("div",{className:"bg-bg text-text min-h-screen flex flex-col page-fade",children:[n.jsx(St,{subtitle:r.toUpperCase()}),n.jsxs("div",{className:"relative px-5 md:px-10 py-5 border-b border-border bg-surface flex items-center gap-5 md:gap-6",children:[n.jsx(Ae,{code:"CUBE",size:84,className:"text-text"}),n.jsxs("div",{className:"flex items-baseline gap-3.5",children:[n.jsx("span",{className:"font-display tracking-[0.04em]",style:{fontSize:56,lineHeight:.9},children:r.toUpperCase()}),n.jsx("span",{className:"font-display text-[22px] text-muted tracking-[0.06em]",children:"CARD DATA"})]}),n.jsx("div",{className:"flex-1"}),$.length>0&&n.jsxs("div",{className:"hidden md:flex flex-wrap items-center justify-end gap-1.5",children:[n.jsx(o4,{code:"CUBE",label:"ALL",active:z==null,to:l(Hn,gh)}),$.map(ee=>n.jsx(o4,{code:ee,label:ee,active:z===ee,to:l(Hn,ee)},ee))]})]}),n.jsx("div",{className:"px-5 md:px-10 py-3 border-b border-border",children:n.jsx(GC,{options:Y,filters:C,setFilters:_,minDrafts:S,setMinDrafts:N,search:T,setSearch:E})}),n.jsxs("main",{className:"relative flex-1 lg:grid lg:grid-cols-[minmax(0,1fr)_340px] lg:items-start",children:[n.jsx("div",{className:"min-w-0",children:n.jsxs("table",{className:"w-full table-fixed border-collapse text-[13px]",children:[n.jsxs("colgroup",{children:[n.jsx("col",{style:{width:"34%"}}),gn.map(ee=>n.jsx("col",{},ee.key))]}),n.jsx("thead",{children:n.jsxs("tr",{className:"text-left",children:[n.jsx("th",{className:"sticky top-0 z-20 bg-bg border-b border-border p-0 text-left font-normal font-display tracking-[0.2em] text-[11px] text-muted",children:n.jsx(Ni,{label:"CARD NAME",active:x==="name",dir:v,onClick:()=>He("name"),fill:!0,align:"left",className:"pl-5 md:pl-10 pr-3 py-2"})}),gn.map((ee,Q)=>n.jsx("th",{className:"sticky top-0 z-20 bg-bg border-b border-border whitespace-nowrap p-0 text-right font-normal font-display tracking-[0.2em] text-[11px] text-muted",children:n.jsx(i4,{col:ee,sortKey:x,sortDir:v,onSort:He,isLast:Q===gn.length-1})},ee.key))]})}),n.jsx("tbody",{ref:tt,children:d?n.jsx(d4,{}):ae.length===0?n.jsx(c4,{text:K.length===0?"No cube drafts on record yet":"No cards match these filters"}):ae.map(ee=>n.jsxs(p.Fragment,{children:[n.jsx(l4,{card:ee,href:Hh(s,ee.name,o),sources:Bh(ee.name,ee.set,Fe),rowRef:(pe==null?void 0:pe.name)===ee.name?ie:void 0,active:ye.has(ee.name),tooltip:_e(ee),onHover:q,onLeave:O,onOpen:L}),we(ee,!1)]},`${ee.name}|${ee.set}`))})]})}),n.jsxs("aside",{className:"flex flex-col gap-4 p-4 border-t border-border lg:border-t-0 lg:sticky lg:top-4 lg:self-start",children:[n.jsx(XC,{setCode:s,season:z,sets:f}),n.jsx(ZC,{setCode:s,season:z,sets:f})]}),n.jsx("div",{className:"hidden lg:block pointer-events-none absolute inset-y-0 right-[340px] w-px bg-border"})]}),n.jsx(Lu,{className:"mt-auto px-5 py-4 md:pt-5 md:pb-3 shrink-0"}),We]})}const a4="polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%)";function o4({code:e,label:t,active:s,to:r}){return n.jsx(te,{to:r,className:"group block cursor-pointer no-underline",style:{clipPath:a4,background:s?"#2ee85c":"#3b4458",padding:1,minHeight:42},children:n.jsxs("span",{className:j("flex h-full items-center justify-center gap-[7px] px-[17px] font-display",s?"bg-green text-bg":"bg-surface text-text group-hover:bg-surface2"),style:{clipPath:a4,minHeight:40},children:[e?n.jsx(Ae,{code:e,size:22,className:s?"text-bg":"text-text"}):null,n.jsx("span",{className:"text-[20px] tracking-[0.06em] leading-none",children:t})]})})}function i4({col:e,sortKey:t,sortDir:s,onSort:r,mobile:a=!1,isLast:o=!1}){const i=e.key==="playRate",l=a?j("px-2 py-2",o&&"pr-1"):j("px-3 py-2",o&&"pr-2 md:pr-7");return n.jsx("div",{className:j("flex justify-end",l),children:n.jsx(Ne,{label:e.title,side:"top",children:n.jsx(Ni,{label:a&&e.shortLabel?e.shortLabel:e.label,active:t===e.key,dir:s,onClick:()=>r(e.key),fill:!0,grow:!1,trailing:i?n.jsx("span",{className:"ml-1 w-7 shrink-0","aria-hidden":!0}):null})})})}function l4({card:e,href:t,sources:s,sticky:r=!1,rowRef:a,active:o,tooltip:i,onHover:l,onLeave:c,onOpen:d}){const u=j("block truncate font-display text-[18px] tracking-[0.02em] 
518no-underline",o?"text-green":"text-text"),f=h=>{h.stopPropagation(),No(h)&&(h.preventDefault(),d(e))};return n.jsxs("tr",{ref:a,...i,"data-image-key":D8(e.name,e.set),className:j("border-b border-bg cursor-pointer",o?"bg-surface2":"bg-surface",r?"group hover:bg-surface2":"hover:bg-surface2"),onClick:()=>d(e),children:[r?n.jsxs(n.Fragment,{children:[n.jsx("td",{className:j("sticky left-0 z-10 group-hover:bg-surface2 pl-2 pr-1 py-2",o?"bg-surface2":"bg-surface"),onMouseEnter:h=>l(e,h.currentTarget),onMouseLeave:c,children:n.jsx(n4,{sources:s,name:e.name})}),n.jsx("td",{className:"pr-2 py-2",children:n.jsx(te,{to:t,onClick:f,className:u,children:e.name})})]}):n.jsx("td",{className:"pl-5 md:pl-10 pr-3 py-2",onMouseEnter:h=>l(e,h.currentTarget),onMouseLeave:c,children:n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx(n4,{sources:s,name:e.name}),n.jsx(te,{to:t,onClick:f,className:j("min-w-0",u),children:e.name})]})}),gn.map((h,m)=>{const y=m===gn.length-1,b=h.format(e),w=b==="—";return n.jsx("td",{className:j("whitespace-nowrap px-2 md:px-3 py-2 text-right",ude,y&&"pr-3 md:pr-10",(w||fde.has(h.key))&&"text-muted"),style:h.key==="winRate"&&!w?{color:w8(e.winRate)}:void 0,children:h.key==="playRate"&&e.playRate!=null?n.jsxs("span",{className:"flex items-baseline justify-end",children:[n.jsx("span",{children:b}),n.jsxs("span",{className:"ml-1 w-7 shrink-0 text-left font-num text-[11px] text-subtle",children:["(",e.maindecked,")"]})]}):b},h.key)})]})}function D8(e,t){return`${t??""}|${e}`}function mde(e,t,s){var i,l;const r=((l=(i=e.closest("table"))==null?void 0:i.querySelector("thead"))==null?void 0:l.getBoundingClientRect().height)??0;if(!t){window.scrollTo({top:e.getBoundingClientRect().top+window.scrollY-r});return}const a=t.getBoundingClientRect(),o=e.getBoundingClientRect().top-a.top+t.scrollTop;t.scrollTo({top:o-r}),window.scrollTo({top:a.top+window.scrollY-s})}function c4({text:e}){return n.jsx("tr",{children:n.jsx("td",{colSpan:gn.length+2,className:"px-5 md:px-10 py-10 text-center text-[13px] text-muted",children:e})})}function d4({sticky:e=!1}){const t="h-3.5 bg-surface2 animate-pulse";return n.jsx(n.Fragment,{children:Array.from({length:12}).map((s,r)=>n.jsxs("tr",{className:"bg-surface border-b border-bg",children:[e?n.jsxs(n.Fragment,{children:[n.jsx("td",{className:"sticky left-0 z-10 bg-surface pl-2 pr-1 py-2",children:n.jsx("div",{className:"h-9 w-12 bg-surface2 animate-pulse",style:{clipPath:Xr}})}),n.jsx("td",{className:"pr-2 py-2",children:n.jsx("div",{className:t,style:{width:`${55+r*7%35}%`}})})]}):n.jsx("td",{className:"pl-5 md:pl-10 pr-3 py-2",children:n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"h-9 w-12 shrink-0 bg-surface2 animate-pulse",style:{clipPath:Xr}}),n.jsx("div",{className:t,style:{width:`${45+r*7%35}%`}})]})}),gn.map((a,o)=>{const i=o===gn.length-1;return n.jsx("td",{className:j("px-2 md:px-3 py-2",i&&"pr-3 md:pr-10"),children:n.jsx("div",{className:j(t,"ml-auto w-8")})},a.key)})]},r))})}const xde={sm:{base:"gap-3 py-2",padWithIcon:"pl-3.5 pr-5",padBare:"px-5",label:"text-[15px] tracking-[0.10em]",circle:"w-7 h-7",arrow:14},md:{base:"gap-3 md:gap-4 py-2.5 md:py-3",padWithIcon:"pl-5 md:pl-6 pr-6 md:pr-8",padBare:"pl-9 pr-5 md:pl-10 md:pr-6",label:"text-[16px] md:text-[18px] tracking-[0.14em]",circle:"w-9 h-9 md:w-10 md:h-10",arrow:18},lg:{base:"gap-3 md:gap-4 py-2.5 md:py-3",padWithIcon:"pl-5 md:pl-6 pr-6 md:pr-8",padBare:"px-7 md:px-8",label:"text-[17px] md:text-[20px] tracking-[0.14em]",circle:"w-9 h-9 md:w-10 md:h-10",arrow:18}},gde="polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%)";function Pw({children:e,size:t="md",icon:s,hover:r="self",className:a}){const o=xde[t];return n.jsxs("span",{className:j("bg-green text-bg inline-flex items-center transition-colors border-none",o.base,s?o.padWithIcon:o.padBare,r==="group"?"group-hover:bg-green-2":"hover:bg-green-2",a),style:{clipPath:gde},children:[s&&n.jsx("span",{className:j("inline-flex items-center justify-center rounded-full bg-bg text-text shrink-0",o.circle),children:s}),n.jsx("span",{className:j("font-display leading-none",o.label),children:e}),n.jsx(Jt,{size:o.arrow})]})}function pb(){return n.jsxs("div",{className:"bg-bg text-text min-h-screen flex flex-col page-fade",children:[n.jsx(St,{subtitle:""}),n.jsxs("main",{className:"flex-1 flex flex-col items-center justify-center text-center px-5 gap-6 md:gap-7",children:[n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("h1",{className:"font-display text-green leading-none tracking-[0.1em] text-[44px] md:text-[68px]",children:"PAGE NOT FOUND"}),n.jsxs("div",{className:"flex flex-col gap-2 text-[14px] md:text-[15px] leading-[1.6] max-w-[440px]",children:[n.jsx("p",{className:"text-text",children:"Oops! The page you were looking for could not be resolved."}),n.jsx("p",{className:"text-muted",children:"It may have been moved, or the link was mistyped."})]})]}),n.jsx(te,{to:"/",className:"no-underline",children:n.jsx(Pw,{size:"md",children:"BACK TO HOME"})})]}),n.jsx(Lu,{className:"px-5 md:px-10 pb-5"})]})}const bde="linear-gradient(90deg, #8a94a3 0%, #e6e9ef 50%, #8a94a3 100%)",yde="linear-gradient(90deg, #5c6675 0%, #b9c1cc 40%, #ffffff 50%, #b9c1cc 60%, #5c6675 100%)",vde="linear-gradient(to bottom, #d6dbe3 0%, #ffffff 48%, #ffffff 56%, #cdd3dc 100%)",wde="linear-gradient(90deg, #c88a2c 0%, #ffd579 50%, #c88a2c 100%)",jde="linear-gradient(to bottom, #ffe6a3 0%, #ffcf5e 50%, #d99a2e 100%)",nr={W:"#e8e4cf",U:"#5aa9e6",B:"#9b8
5186c4",R:"#e0625c",G:"#54b87a"},dx={white_common:nr.W,blue_common:nr.U,black_common:nr.B,red_common:nr.R,green_common:nr.G,white_uncommon:nr.W,blue_uncommon:nr.U,black_uncommon:nr.B,red_uncommon:nr.R,green_uncommon:nr.G,multicolor_uncommon:"#ffc63a",best_card:wde,wildcard_common:"#ffffff",wildcard_uncommon:bde};function I8(e){return e==="wildcard_uncommon"?yde:dx[e]}const kde={white_common:"W",blue_common:"U",black_common:"B",red_common:"R",green_common:"G",white_uncommon:"W",blue_uncommon:"U",black_uncommon:"B",red_uncommon:"R",green_uncommon:"G"};function mo({slotKey:e,size:t=15,setCode:s=""}){const r=kde[e];if(r)return n.jsx(fr,{c:r,size:Math.round(t*.64)});if(e==="multicolor_uncommon")return n.jsx("i",{className:"ms ms-multicolor ms-duo ms-duo-color ms-grad",style:{fontSize:t,lineHeight:1}});const a=`ss ss-${Vm(s)}`;if(e==="wildcard_common")return n.jsx("i",{className:a,style:{fontSize:t,color:"#fff",lineHeight:1}});const o=e==="best_card";return n.jsx("i",{className:`${a} ${o?"ss-mythic":"ss-uncommon"} ss-grad`,style:{fontSize:t,lineHeight:1,background:o?jde:vde,WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent"}})}const Sde=["W","U","B","R","G","C"],Nde=new Set,Cde={W:0,U:1,B:2,R:3,G:4};function u4(e){return e.length===0?6:e.length>1?5:Cde[e[0]]??6}function _de(e,t){const s=u4(e.colors)-u4(t.colors);return s!==0?s:e.cmc!==t.cmc?e.cmc-t.cmc:e.name.localeCompare(t.name)}function M8({slot:e,cards:t,pickedCards:s,takenBy:r,onSelect:a,selectedName:o,minColW:i=200,showLabel:l=!0,leftLabel:c,footerRight:d,autoFocusSearch:u=!0,animateMount:f=!0,setCode:h}){const[m,y]=p.useState(""),[b,w]=p.useState(null),x=p.useRef(null);p.useEffect(()=>{var T;u&&((T=x.current)==null||T.focus())},[u]);const g=e.key==="wildcard_common"||e.key==="wildcard_uncommon"||e.key==="best_card",v=T=>w(E=>E===T?null:T),k=p.useMemo(()=>t.filter(T=>
518e.filter(T,Nde)).sort(_de),[t,e]),S=p.useMemo(()=>{let T=k;if(m.trim()){const E=m.toLowerCase();T=T.filter(A=>A.name.toLowerCase().includes(E))}return g&&b&&(T=b==="C"?T.filter(E=>E.colors.length===0):T.filter(E=>E.colors.includes(b))),T},[k,m,g,b]),N=S.filter(T=>!s.has(T.name)).length,C=g?n.jsx("div",{className:"flex items-center gap-1",children:Sde.map(T=>{const E=b===T;return n.jsx("button",{type:"button",onClick:()=>v(T),"aria-label":T,className:`flex items-center justify-center w-7 h-7 transition ${E?"opacity-100":"opacity-35 hover:opacity-65"}`,children:n.jsx(fr,{c:T,size:17})},T)})}):null,_=n.jsxs("div",{className:`relative ${c?"w-1/2 max-w-[260px] shrink-0":"ml-auto w-full max-w-[280px]"}`,children:[n.jsx(ac,{size:15,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-dim pointer-events-none"}),n.jsx("input",{ref:x,type:"text",value:m,onChange:T=>y(T.target.value),placeholder:"Search...",className:"w-full bg-surface border border-border2 pl-8 pr-2.5 py-1.5 text-text text-[13px] placeholder:text-dim outline-none focus:border-green/60 transition-colors"})]});return n.jsxs("div",{className:f?"animate-fadeIn":void 0,children:[l?n.jsxs("header",{className:"grid grid-cols-[1fr_auto_1fr] items-center gap-2 mb-3",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0 pl-3",children:[n.jsx(mo,{slotKey:e.key,size:24,setCode:h}),n.jsx("span",{className:"font-display text-text text-[22px] tracking-[0.1em] truncate",children:e.label})]}),n.jsx("div",{className:"flex justify-center",children:C}),_]}):c?n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"flex items-center gap-2 min-w-0 mr-auto pl-1",children:c}),_]}),C?n.jsx("div",{className:"flex justify-center mt-2",children:C}):null]}):n.jsxs("header",{className:"flex items-center gap-2 mb-3",children:[C,_]}),S.length===0?n.jsx("div",{className:"py-8 text-center text-muted text-[14px]",children:"No matching cards"}):n.jsx("div",{className:"grid gap-3.5",style:{gridTemplateColumns:`repeat(auto-fill, minmax(${i}px, 1fr))`},children:S.map(T=>{if(s.has(T.name))return n.jsxs("div",{className:"relative p-0 rounded-[3%] overflow-hidden outline outline-1 -outline-offset-1 outline-white/10",children:[n.jsx("img",{src:T.imageNormal,alt:T.name,className:"w-full block grayscale brightness-[0.45]",style:{aspectRatio:"488 / 680"},loading:"lazy"}),n.jsx("div",{className:"absolute inset-0 flex items-center justify-center overflow-hidden pointer-events-none px-2",children:n.jsxs("span",{className:"font-display text-white text-[14px] tracking-[0.1em] uppercase text-center [text-shadow:0_1px_5px_rgba(0,0,0,0.95)]",children:[(r==null?void 0:r.get(T.name))??"Already"," pick"]})})]},T.name);const A=T.name===o;return n.jsx("button",{type:"button",onClick:()=>a(T.name),className:`relative bg-transparent cursor-pointer p-0 rounded-[3%] overflow-hidden outline outline-1 -outline-offset-1 outline-white/10 transition-transform duration-150 hover:z-10 ${A?"p0p1-card-selected z-10 scale-[1.03] hover:scale-[1.05]":"hover:scale-[1.04]"}`,children:n.jsx("img",{src:T.imageNormal,alt:T.name,className:"w-full block",style:{aspectRatio:"488 / 680"},loading:"lazy"})},T.name)})}),n.jsxs("footer",{className:"mt-3 flex items-center justify-between gap-3",children:[n.jsxs("span",{className:"text-muted text-[12px]",children:[N," card",N!==1?"s":""," available"]}),d]})]})}function $8({filled:e,total:t,isComplete:s,doneLabel:r,doneHint:a}){if(s&&r)return n.jsxs("div",{className:"h-7 rounded-full bg-green/10 border border-green/30 flex items-center justify-center gap-2 px-3 animate-fadeIn",children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",className:"shrink-0",children:n.jsx("path",{d:"M5 12.5 L10 17.5 L19 7",stroke:"#2ee85c",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})}),n.jsx("span",{className:"font-display text-green text-[14px] tracking-[0.08em] leading-none whitespace-nowrap",children:r}),a&&n.jsx("span",{className:"font-body text-subtle text-[12px] leading-none whitespace-nowrap",children:a})]});const o=Math.round(e/t*100);return n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"flex-1 h-2 bg-surface2 overflow-hidden rounded-full",children:n.jsx("div",{className:`h-full rounded-full transition-all ${s?"bg-green":"bg-green/70"}`,style:{width:`${o}%`}})}),n.jsxs("span",{className:`font-num tabular-nums text-[12px] shrink-0 ${s?"text-green":"text-muted"}`,children:[e,"/",t]})]})}function U8({onClear:e,clearing:t,visible:s=!0,className:r="flex justify-center mt-1.5"}){const[a,o]=p.useState(!1);p.useEffect(()=>{if(!a)return;const c=setTimeout(()=>
518o(!1),3e3);return()=>clearTimeout(c)},[a]);const i=()=>{if(!a){o(!0);return}o(!1),e()},l=s&&!t;return n.jsx("div",{className:`${r} ${l?"":"invisible"}`,children:n.jsx("button",{type:"button",onClick:i,disabled:!l,className:`bg-transparent border-0 text-[12px] cursor-pointer transition-colors ${a?"text-red font-semibold":"text-dim hover:text-red"}`,children:a?"Clear all picks?":"CLEAR ALL PICKS"})})}function Br(e,t){return`${e} ${t}${e===1?"":"s"}`}function z8(e){const t=Math.floor(e/864e5),s=Math.floor(e/(1e3*60*60)%24),r=Math.floor(e/(1e3*60)%60);return t>0?`${Br(t,"day")}, ${Br(s,"hour")}`:s>0?`${Br(s,"hour")}, ${Br(r,"minute")}`:Br(r,"minute")}function B8(e){return e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function F8(e){return e.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function W8(e){const t=Math.floor(e/864e5);if(t>=2)return Br(t,"day");const s=Math.floor(e/(1e3*60*60)),r=Math.floor(e/(1e3*60)%60);return s>0?`${Br(s,"hour")}, ${Br(r,"minute")}`:Br(r,"minute")}function Tde({deadline:e,scoringDate:t,opensAt:s,size:r=13,phase:a,isCurrent:o=!0}){nf(3e4);const i=wi(),l=e.getTime()-i;if(a==="comingSoon")return n.jsxs("span",{className:"whitespace-nowrap",style:{fontSize:r},children:[n.jsx("span",{className:"text-muted",children:"Opens "}),n.jsx("span",{className:"text-green",children:F8(s??e)})]});if(a==="voting")return n.jsxs("span",{className:"whitespace-nowrap",style:{fontSize:r},children:[n.jsx("span",{className:"text-muted",children:"Closes in "}),n.jsx("span",{className:"text-green",children:z8(l)})]});if(a==="loading")return n.jsx("span",{className:"inline-block h-[1em] w-32 bg-surface2 animate-pulse align-middle",style:{fontSize:r}});if(a==="final")return!o&&t?n.jsxs("span",{className:"whitespace-nowrap",style:{fontSize:r},children:[n.jsx("span",{className:"text-muted",children:"Results "}),n.jsx("span",{className:"text-green",children:B8(t)})]}):n.jsx("span",{className:"text-green",style:{fontSize:r},children:"Results are in!"});if(t){const c=t.getTime()-i;if(c>0)return n.jsxs("span",{className:"whitespace-nowrap",style:{fontSize:r},children:[n.jsx("span",{className:"text-muted",children:"Results in "}),n.jsx("span",{className:"text-green",children:W8(c)})]})}return n.jsx("span",{className:"text-muted",style:{fontSize:r},children:"Entries have closed"})}function H8({from:e,to:t,phase:s}){if(s==="loading")return n.jsx("div",{className:"w-full h-2 bg-surface2 overflow-hidden rounded-full animate-pulse"});const r=t.getTime()-e.getTime(),a=wi()-e.getTime(),o=Math.max(0,Math.min(100,Math.round(a/r*100)));return n.jsx("div",{className:"w-full h-2 bg-surface2 overflow-hidden rounded-full",children:n.jsx("div",{className:"h-full rounded-full bg-green/70 transition-all",style:{width:`${o}%`}})})}const G8="https://www.17lands.com/card_data",f4=n.jsx("a",{href:G8,target:"_blank",rel:"noreferrer",className:"text-green hover:underline underline-offset-2",children:"17Lands GIH win rate"}),Ede=n.jsx("a",{href:G8,target:"_blank",rel:"noreferrer",className:"text-green hover:underline underline-offset-2",children:"17Lands data"});function V8({setName:e,setCode:t="",phase:s,dateRange:r,multiline:a=!1}){const o=n.jsx("span",{className:"font-semibold text-text",children:e}),i=Pde(Ft(t).length),l=r?Ode(r.start,r.end):null,c=Rde(s,o,i,l);return n.jsx(n.Fragment,{children:c.map((d,u)=>n.jsxs(p.Fragment,{children:[u>0&&(a?n.jsx("br",{}):" "),d.body,d.mark??(a?"":".")]},u))})}function Rde(e,t,s,r){switch(e){case"loading":return[{body:n.jsx("span",{className:"inline-block h-3.5 w-64 bg-surface2 animate-pulse align-middle"}),mark:""},{body:n.jsx("span",{className:"inline-block h-3.5 w-80 bg-surface2 animate-pulse align-middle"}),mark:""}];case"comingSoon":case"voting":return[{body:n.jsxs(n.Fragment,{children:["Put together a team of ",s," cards from ",t]})},{body:n.jsxs(n.Fragment,{children:["4 weeks after voting, teams are ranked by their total ",f4]})}];case"postVoting":return[{body:n.jsxs(n.Fragment,{children:["Participants have put in their predictions for ",t]})},{body:n.jsxs(n.Fragment,{children:["Check out the most popular picks, then come back once they're ranked by ",f4,", four weeks after voting"]})}];case"midway":return[{body:n.jsxs(n.Fragment,{children:[t," season is underway"]})},{body:n.jsxs(n.Fragment,{children:["Check out the ",n.jsx("strong",{children:"preliminary data"}),r&&n.jsxs(n.Fragment,{children:[" from ",r]})]})},{body:n.jsx(n.Fragment,{children:"Final results coming soon"})}];case"final":return[{body:n.jsxs(n.Fragment,{children:["After four weeks, ",t," results are in"]}),mark:"!"},{body:n.jsxs(n.Fragment,{children:["Check out the final standings based on ",Ede]})}]}}const Ade=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve"];function Pde(e){return Ade[e]??String(e)}function Ode(e,t){const s=new Date(e+"T00:00:00"),r=new Date(t+"T00:00:00"),a=o=>o.toLocaleDateString("en-US",{month:"short",day:"numeric"});return`${a(s)} – ${a(r)}`}function K8({next:e,showSet:t=!0}){const s=nf(1e3);return!e||e.previewsOpen.getTime()<=s?null:n.jsxs("span",{className:"flex items-center justify-center gap-x-3",children:[t&&n.jsx(Ae,{code:e.code,size:17,className:"text-white"}),t&&n.jsx("span",{className:"font-semibold text-text",children:e.code}),n.jsx("span",{children:t?"picks open":"Picks open"}),n.jsx("span",{className:"font-mono text-green tabular-nums border border-border2 bg-surface2/40 px-2 py-1",style:{fontSize:13,lineHeight:1,letterSpacing:"0.02em"},children:PZ(e.previewsOpen.getTime(),s)})]})}const Lde=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];function Dde(e){const t=new Date(e),s=Lde[t.getUTCMonth()],r=String(t.getUTCFullYear()).slice(2);return s?`${s} '${r}`:""}function Ide(e){return e.status==="live"?{text:"LIVE",className:"text-green"}:e.status==="results"?{text:"RESULTS",className:"text-green/70"}:e.status==="soon"?{text:"SOON",className:"text-dim"}:{text:Dde(e.release),className:"text-dim"}}function q8({contests:e,activeCode:t,hrefFor:s,isMobile:r=!1}){const[a,o]=p.useState(!1),[i,l]=p.useState(""),c=p.useRef(null),d=F6(a);if(e.length<=1)return null;const u=e.find(b=>b.code===t)??e[0],f=e.length>7,h=i.trim().toLowerCase(),m=h?e.filter(b=>b.code.toLowerCase().includes(h)||b.name.toLowerCase().includes(h)):e,y=()=>o(!1);return p.useEffect(()=>{if(!a)return;const b=x=>{var g;(g=c.current)!=null&&g.contains(x.target)||y()},w=x=>{x.key==="Escape"&&y()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",w)}},[a]),p.useEffect(()=>{a||l("")},[a]),n.jsxs("div",{ref:c,className:"relative min-w-0",children:[n.jsx("button",{type:"button",onClick:()=>o(b=>!b),"aria-expanded":a,className:j("group flex max-w-full min-w-0 items-center border border-border2 text-text transition-colors cursor-pointer hover:bg-surface",r?"gap-1.5 px-1.5 py-1":"gap-3 px-2 py-1",a&&"bg-surface"),children:r?n.jsxs(n.Fragment,{children:[n.jsx(Ae,{code:u.code,size:22}),n.jsx("span",{className:"font-display tracking-[0.04em] leading-none",style:{fontSize:22},children:u.code}),n.jsx(Et,{strokeWidth:2.5,className:j("text-muted transition-transform shrink-0 h-4 w-4",a&&"rotate-180")}
518)]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-display tracking-[0.04em] leading-[0.9]",style:{fontSize:44},children:u.code}),n.jsx("span",{className:"font-display text-[20px] text-muted tracking-[0.06em]",children:u.name.toUpperCase()}),n.jsx(Et,{strokeWidth:2.5,className:j("text-muted transition-transform shrink-0 h-5 w-5",a&&"rotate-180")})]})}),a&&n.jsxs("div",{ref:d,className:"absolute left-0 top-full z-30 flex max-h-[min(60vh,400px)] min-w-full w-max max-w-[80vw] flex-col overflow-hidden border border-border2 bg-surface shadow-xl",children:[f&&n.jsx("div",{className:"shrink-0 border-b border-border p-1.5",children:n.jsx("input",{autoFocus:!0,value:i,onChange:b=>l(b.target.value),placeholder:"Search contests…",className:"w-full border border-border bg-bg px-2.5 py-1.5 font-body text-[14px] text-text placeholder:text-dim outline-none focus:border-green"})}),n.jsxs("div",{className:"menu-scrollbar min-h-0 flex-1 overflow-y-auto",children:[m.map((b,w)=>{const x=b.code===t,g=Ide(b);return n.jsxs(te,{to:s(b.code),onClick:y,className:j("flex w-full items-center gap-3 border-l-2 px-3.5 py-2.5 text-left font-display tracking-[0.06em] transition-colors no-underline",w>0&&"border-t border-border",x?"border-l-green bg-surface2 text-green":"border-l-transparent text-text hover:bg-surface2"),children:[n.jsx(Ae,{code:b.code,size:22}),n.jsx("span",{className:j("flex-1 self-baseline truncate text-[16px] leading-none",x?"text-green":"text-text"),children:b.name.toUpperCase()}),n.jsx("span",{className:j("text-[13px] self-baseline leading-none tracking-[0.04em] mono shrink-0",x?"text-green":g.className),children:g.text})]},b.code)}),m.length===0&&n.jsx("div",{className:"px-3.5 py-3 font-body text-[14px] text-muted",children:"No contests match"})]})]})]})}function h4({featured:e,contests:t,contestHref:s,cta:r,innerRef:a,belowIntro:o,phase:i,dateRange:l,isCurrent:c}){const d=i!=="voting"&&i!=="comingSoon";return n.jsxs("div",{ref:a,className:"sticky top-0 z-30 relative px-10 py-5 border-b border-border bg-surface flex flex-wrap items-center gap-x-8 gap-y-3",children:[n.jsx(Ae,{code:e.code,size:84}),n.jsxs("div",{className:"shrink-0",children:[n.jsx(Xe,{size:13,children:"PACK 0, PICK 1"}),n.jsx("div",{className:"flex items-baseline gap-3.5 mt-0.5",children:t.length>1?n.jsx(q8,{contests:t,activeCode:e.code,hrefFor:s}):n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-display tracking-[0.04em]",style:{fontSize:56,lineHeight:.9},children:e.code}),n.jsx("span",{className:"font-display text-[22px] text-muted tracking-[0.06em]",children:e.name.toUpperCase()})]})}),n.jsx("div",{className:"font-mono text-[11px] mt-1 flex items-center justify-between gap-x-6",children:n.jsx(Tde,{deadline:e.votingDeadline,scoringDate:e.scoringDate,opensAt:e.previewsOpen,size:11,phase:i,isCurrent:c})}),d&&n.jsx("div",{className:"w-full mt-2",children:n.jsx(H8,{from:e.votingDeadline,to:e.scoringDate,phase:i})})]}),n.jsxs("div",{className:"flex-1 min-w-0 flex flex-col items-center justify-center gap-2.5 xl:absolute xl:left-1/2 xl:top-1/2 xl:w-[580px] xl:-translate-x-1/2 xl:-translate-y-1/2 xl:flex-none",children:[n.jsx("p",{className:"max-w-[580px] text-center text-subtle text-[14px] leading-[1.55]",children:n.jsx(V8,{setName:e.name,setCode:e.code,phase:i,dateRange:l,multiline:!0})}),n.jsx("div",{className:"w-full flex justify-center text-subtle text-[14px]",children:i==="final"?n.jsx(K8,{next:e.next}):o})]}),n.jsx("div",{className:"shrink-0 ml-auto flex justify-end min-w-[280px]",children:r})]})}const p4="polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%)";function Mde({complete:e=!1}){const t=e?"PICKS SAVED":"AUTO-SAVED",s=e?"Edit anytime before the deadline":"Synced to your account as you pick";
518return n.jsx("div",{className:"inline-block animate-fadeUpIn",style:{clipPath:p4,background:"#3b4458",padding:1},children:n.jsxs("div",{className:"flex items-center gap-3.5 bg-surface2 py-2.5 pl-5 pr-5",style:{clipPath:p4},children:[n.jsxs("span",{className:`relative inline-flex h-9 w-9 items-center justify-center rounded-full ${e?"bg-green":"bg-green/15"}`,children:[!e&&n.jsx("span",{className:"absolute inset-0 rounded-full ring-1 ring-inset ring-green/40"}),n.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"relative",children:n.jsx("path",{d:"M5 12.5 L10 17.5 L19 7",stroke:e?"#0a0c10":"#2ee85c",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"animate-drawCheck",style:{strokeDasharray:24}})},String(e))]}),n.jsxs("span",{className:"grid",children:[n.jsxs("span",{"aria-hidden":!0,className:"invisible col-start-1 row-start-1 flex flex-col gap-1 leading-none",children:[n.jsx("span",{className:"font-display text-[17px] tracking-[0.14em]",children:"AUTO-SAVED"}),n.jsx("span",{className:"font-body text-[12px]",children:"Synced to your account as you pick"})]}),n.jsxs("span",{className:"col-start-1 row-start-1 flex flex-col gap-1 leading-none",children:[n.jsx("span",{className:"font-display text-[17px] tracking-[0.14em] text-green",children:t}),n.jsx("span",{className:"font-body text-[12px] text-muted",children:s})]})]})]})})}function ux({imageUrl:e,alt:t,children:s,className:r}){const[a,o]=p.useState(!1);return p.useEffect(()=>{if(!a)return;const i=l=>{l.key==="Escape"&&o(!1)};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[a]),n.jsxs(n.Fragment,{children:[n.jsx("div",{className:`relative shrink-0 cursor-pointer ${r??""}`,onClick:i=>{i.stopPropagation(),dc(e,()=>o(!0))},children:s}),a&&It.createPortal(n.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/70 p-6",onClick:i=>{i.stopPropagation(),o(!1)},children:n.jsx("div",{className:"w-full max-w-[320px] overflow-hidden rounded-xl shadow-2xl",onClick:i=>i.stopPropagation(),children:n.jsx("img",{src:e,alt:t,className:"w-full block rounded-xl"})})}),document.body)]})}function $de({label:e,stats:t,cardsByName:s,onClose:r}){return p.useEffect(()=>{const a=o=>{o.key==="Escape"&&r()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[r]),It.createPortal(n.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/70 p-6",onClick:r,children:n.jsxs("div",{className:"w-full max-w-[360px] max-h-[80vh] overflow-y-auto themed-scrollbar roun
518ded-xl border border-border2 bg-surface shadow-2xl",onClick:a=>a.stopPropagation(),children:[n.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border sticky top-0 bg-surface",children:[n.jsx("span",{className:"font-display text-[14px] tracking-[0.08em] text-text",children:e.toUpperCase()}),n.jsx("button",{type:"button",onClick:r,"aria-label":"Close",className:"ml-auto text-muted hover:text-text text-[20px] leading-none bg-transparent border-0 cursor-pointer p-1",children:"×"})]}),n.jsx("div",{className:"flex flex-col divide-y divide-border2",children:t.map(a=>{const o=s.get(a.cardName);return n.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[o&&n.jsx(ux,{imageUrl:o.imageNormal,alt:o.name,className:"w-10 h-10 rounded overflow-hidden",children:n.jsx("img",{src:o.imageArtCrop,alt:o.name,className:"w-full h-full object-cover"})}),n.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-1.5",children:[n.jsx("span",{className:"text-text text-[13.5px] truncate",children:a.cardName}),o&&n.jsx(lf,{cost:o.manaCost,size:12})]}),n.jsxs("span",{className:"text-dim text-[13px] font-mono tabular-nums shrink-0",children:[a.pickCount," picked"]})]},a.cardName)})})]})}),document.body)}function pf(e){const t=new Map;for(const s of e){const r=t.get(s.slot);r?r.push(s):t.set(s.slot,[s])}return t}const Ude=2;function mf(e){if(e.length===0)return{most:[],least:[]};const t=Math.max(...e.map(r=>r.pickCount)),s=Math.min(...e.map(r=>r.pickCount));return{most:e.filter(r=>r.pickCount===t),least:e.filter(r=>r.pickCount<=s+Ude)}}function Fd(e){return`${Math.max(Math.round(e),1)}%`}function zde(e){const t=new Map;for(const s of e)t.set(s.slot,(t.get(s.slot)??0)+s.pickCount);return t.size===0?0:Math.max(...t.values())}function fx(e,t,s){return t.some(o=>o.cardName===e.cardName)?t.length>1?{state:"most",qualifier:"TIED FOR CROWD FAVORITE"}:{state:"most",qualifier:"CROWD FAVORITE"}:s.some(o=>o.cardName===e.cardName)?{state:"rogue",qualifier:"ROGUE PICK"}:{state:"minority"}}function Bde(e,t,s,r,a){if(e.length===0)return null;const o=e.find(u=>u.cardName===t);if(!o)return null;const{most:i,least:l}=mf(e),c=i[0];if(!c)return null;const d=fx(o,i,l);return{slotKey:r,slotLabel:a,state:d.state==="most"?"matched":d.state,agreed:d.state==="most",tiedCount:i.length,crowd:m4(c,s),yours:m4(o,s)}}function m4(e,t){const s=t.get(e.cardName);return{name:e.cardName,imageUrl:(s==null?void 0:s.imageNormal)??"",pickPct:e.pickPct}}const Z8="#161b26",Ug="#7a8395",x4="#a98eff",zg="#2ee85c",g4="#e6ecf5";function mb({maxWidth:e,onClick:t,children:s}){return n.jsx("div",{onClick:t,className:"flex max-h-[92vh] w-full flex-col overflow-hidden rounded-xl border border-white/15 p-[6px] shadow-2xl sm:border-white/60",style:{backgroundColor:Z8,maxWidth:e},children:s})}function xb({slotKey:e,slotLabel:t,setCode:s}){return n.jsxs("div",{className:"flex items-center justify-center gap-2 px-2 pb-3 pt-1.5 lg:gap-2.5 lg:pb-4",children:[n.jsx(mo,{slotKey:e,size:20,setCode:s}),n.jsx("span",{className:"font-display text-[18px] leading-none tracking-[0.2em] text-text lg:text-[22px]",children:t.toUpperCase()})]})}function Y8({left:e,right:t}){return n.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] gap-2 lg:gap-5",children:[e,n.jsx(gb,{}),t]})}function Fde({left:e,middle:t,right:s}){return n.jsxs("div",{className:"grid gap-0",style:{gridTemplateColumns:"1fr auto 1fr auto 1fr"},children:[e,n.jsx(gb,{}),t,n.jsx(gb,{}),s]})}function gb(){return n.jsxs("div",{className:"relative flex items-center justify-center",children:[n.jsx("div",{className:"absolute inset-y-0 w-0.5 bg-white/20"}),n.jsx("span",{className:"relative z-10 flex h-9 w-9 items-center justify-center rounded-full border border-white/60 font-display text-[13px] tracking-[0.08em] text-muted lg:h-12 lg:w-12 lg:text-[16px]",style:{backgroundColor:Z8},children:"VS"})]})}function bb({onPrev:e,onNext:t,paged:s,prevLabel:r="Prev",nextLabel:a="Next"}){return s?n.jsxs("div",{className:"flex items-center justify-between px-3 py-3.5",children:[n.jsx(za,{dir:"prev",label:r,onClick:e}),n.jsx(za,{dir:"next",label:a,onClick:t})]}):null}function Wd({label:e,labelColor:t,value:s,valueColor:r,caption:a,fillPct:o,barColor:i,dim:l=!1,density:c,solo:d=!1,tight:u=!1,imageUrl:f,name:h}
518){if(c==="compact")return n.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5 px-1 pb-1",children:[n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"font-display leading-none tracking-[0.14em]",style:{fontSize:10,color:t},children:e}),n.jsxs("span",{className:"flex items-baseline gap-1.5",children:[n.jsx("span",{className:"font-num tabular-nums font-semibold leading-none",style:{fontSize:20,color:l?"#4a5568":r},children:s}),a&&n.jsx("span",{className:"font-body text-[9px] leading-none text-muted",children:a})]})]}),n.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-white/10",children:n.jsx("div",{className:"h-full rounded-full",style:{width:`${o}%`,background:i}})}),n.jsx(b4,{imageUrl:f,name:h,className:"w-full rounded-[5px]"}),n.jsx("span",{className:"truncate text-center font-body text-[9px] leading-snug text-muted",children:h||"—"})]});const m=d?"flex items-baseline justify-between gap-3":"flex flex-col gap-1.5 lg:flex-row lg:items-baseline lg:justify-between lg:gap-3",y=d?"flex items-baseline gap-1.5":"order-2 flex items-baseline gap-1.5 lg:order-none",b=d?"shrink-0 whitespace-nowrap font-display text-[13px] leading-none tracking-[0.14em] lg:text-[16px]":u?"order-1 whitespace-nowrap font-display text-[12px] leading-none tracking-[0.08em] lg:order-none lg:shrink-0 lg:text-[16px]":"order-1 truncate font-display text-[13px] leading-none tracking-[0.14em] lg:order-none lg:shrink-0 lg:whitespace-nowrap lg:text-[16px]",w=`mx-auto max-h-[58vh] w-auto rounded-[10px] ${d?"max-w-[200px] lg:max-w-full":"max-w-full"}`;return n.jsxs("div",{className:"flex min-w-0 flex-col gap-2.5 lg:gap-3",children:[n.jsxs("div",{className:"flex flex-col gap-2 px-1",children:[n.jsxs("div",{className:m,children:[n.jsxs("span",{className:y,children:[n.jsx("span",{className:"font-num tabular-nums text-[20px] font-semibold leading-none lg:text-[30px]",style:{color:l?"#4a5568":r},children:s}),a&&n.jsx("span",{className:"text-[11px] leading-none text-muted lg:text-[13px]",children:a})]}),n.jsx("span",{className:b,style:{color:t},children:e})]}),n.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-white/10",children:n.jsx("div",{className:"h-full rounded-full",style:{width:`${o}%`,background:i}})})]}),n.jsx(b4,{imageUrl:f,name:h,className:w})]})}function b4({imageUrl:e,name:t,className:s}){return e?n.jsx("img",{src:e,alt:t,className:s}):n.jsx("div",{className:`rounded-[10px] bg-white/5 ${s}`,style:{aspectRatio:"488/680"}})}function Q8(e){const[t,s]=p.useState(null),r=t===null?null:e[t]??null;return{list:e,index:t,current:r,open:a=>s(a),close:()=>s(null),step:a=>s(o=>o===null?o:(o+a+e.length)%e.length)}}function Wde(e){return Q8(e)}function J8({pager:e,padding:t="p-4",renderCard:s}){const{current:r,index:a,list:o,close:i,step:l}=e;return p.useEffect(()=>{if(r===null)return;const c=d=>{d.key==="Escape"?i():d.key==="ArrowLeft"?l(-1):d.key==="ArrowRight"&&l(1)};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[r,i,l]),r===null||a===null?null:It.createPortal(n.jsx("div",{className:`fixed inset-0 z-[200] flex items-center justify-center bg-black/70 ${t}`,onClick:i,children:s(r,{paged:o.length>1,onPrev:()=>l(-1),onNext:()=>l(1)})}),document.body)}function Hde({pager:e}){return n.jsx(J8,{pager:e,padding:"p-6",renderCard:(t,s)=>n.jsx(Gde,{versus:t,...s})})}function Gde({versus:e,onPrev:t,onNext:s,paged:r=!1}){const a=d=>d.stopPropagation();if(e.agreed){const d=Math.max(Math.min(e.yours.pickPct,100),4);return n.jsxs(mb,{maxWidth:420,onClick:a,children:[n.jsxs("div",{className:"px-4 pt-2",children:[n.jsx(xb,{slotKey:e.slotKey,slotLabel:e.slotLabel}),n.jsx(Wd,{label:"CROWD PICK",labelColor:zg,value:Fd(e.yours.pickPct),valueColor:zg,caption:"of votes",fillPct:d,barColor:zg,density:"comfortable",solo:!0,imageUrl:e.yours.imageUrl,name:e.yours.name})]}),n.jsx(bb,{onPrev:t,onNext:s,paged:r,prevLabel:"Prev Pick",nextLabel:"Next Pick"})]})}const o=e.state==="rogue",i=o?x4:g4,l=o?x4:Ug,c=o?"ROGUE PICK":"YOUR PICK";return n.jsxs(mb,{maxWidth:820,onClick:a,children:[n.jsxs("div",{className:"px-2 pt-2 lg:px-4",children:[n.jsx(xb,{slotKey:e.slotKey,slotLabel:e.slotLabel}),n.jsx(Y8,{left:n.jsx(Wd,{label:"CROWD FAVORITE",labelColor:Ug,value:Fd(e.crowd.pickPct),valueColor:g4,caption:"of votes",fillPct:Math.max(Math.min(e.crowd.pickPct,100),4),barColor:Ug,density:"comfortable",imageUrl:e.crowd.imageUrl,name:e.crowd.name}),right:n.jsx(Wd,{label:c,labelColor:i,value:Fd(e.yours.pickPct),valueColor:i,caption:"of votes",fillPct:Math.max(Math.min(e.yours.pickPct,100),4),barColor:l,density:"comfortable",imageUrl:e.yours.imageUrl,name:e.yours.name})})]}),n.jsx(bb,{onPrev:t,onNext:s,paged:r,prevLabel:"Prev Pick",nextLabel:"Next Pick"})]})}function Vde({pickStats:e,cardsByName:t,picksBySlot:s,setCode:r,compact:a=!1}){const o=pf(e);return n.jsx(Kde,{title:"Crowd Favorites",entries:Ft(r??"").map(i=>{const l=o.get(i.key)??[];return{slotKey:i.key,label:i.label,stats:mf(l).most,slotStats:l}}),cardsByName:t,picksBySlot:s,setCode:r,compact:a})}function Kde({title:e,entries:t,cardsByName:s,picksBySlot:r,setCode:a,compact:o}){return n.jsxs("div",{children:[n.jsx("div",{className:"flex justify-center mb-1.5 lg:mb-2",children:n.jsx(Xe,{size:22,color:"white",children:e})}),n.jsx(_o,{entries:t,cardsByName:s,picksBySlot:r,setCode:a,compact:o})]})}
518function _o({entries:e,cardsByName:t,picksBySlot:s,onTileOpen:r,setCode:a,compact:o=!1}){const i=[],l=new Map;if(!r)for(const u of e){const f=s==null?void 0:s.get(u.slotKey),h=u.slotStats&&f?Bde(u.slotStats,f,t,u.slotKey,u.label):null;h&&(l.set(u.slotKey,i.length),i.push(h))}const c=Wde(i);let d=Dc(e.length)?"lg:grid-cols-6":"lg:grid-cols-8";return o&&(d="lg:grid-cols-12"),n.jsxs("div",{className:`grid grid-cols-4 ${d} gap-2`,children:[e.map(({slotKey:u,label:f,stats:h,badge:m,pctLabel:y})=>{const b=l.get(u),w=r?()=>r(u):b!==void 0?()=>c.open(b):void 0;return n.jsx(qde,{slotKey:u,label:f,stats:h,badge:m,pctLabel:y,cardsByName:t,onOpenVersus:w,setCode:a,compact:o},u)}),!r&&n.jsx(Hde,{pager:c})]})}function qde({slotKey:e,label:t,stats:s,cardsByName:r,onOpenVersus:a,badge:o,pctLabel:i,setCode:l,compact:c}){const[d,u]=p.useState(!1),f=s.length>0,h=s.length>1,m=f?r.get(s[0].cardName):void 0,y=dx[e];let b;return m?a?b=n.jsx("button",{type:"button",onClick:a,className:"w-full h-full cursor-pointer p-0 border-0 bg-transparent",children:n.jsx("img",{src:m.imageArtCrop,alt:m.name,className:"w-full h-full object-cover"})}):b=n.jsx(ux,{imageUrl:m.imageNormal,alt:m.name,className:"w-full h-full",children:n.jsx("img",{src:m.imageArtCrop,alt:m.name,className:"w-full h-full object-cover"})}):b=a?n.jsx("button",{type:"button",onClick:a,className:"w-full h-full cursor-pointer p-0 border-0 bg-transparent flex items-center justify-center",children:n.jsx(mo,{slotKey:e,size:48,setCode:l})}):n.jsx(mo,{slotKey:e,size:48,setCode:l}),n.jsxs("div",{className:"group relative min-w-0 transition-transform duration-150 hover:z-10 hover:scale-[1.04]",children:[n.jsxs("div",{className:"flex flex-col border border-t-0 border-border2 bg-surface overflow-hidden",children:[n.jsx("div",{className:"relative z-10 h-[4px] w-full shrink-0 origin-top transition-transform duration-150 group-hover:scale-y-[2]",style:{background:y}}),n.jsxs("div",{className:"relative aspect-square bg-surface2 flex items-center justify-center overflow-hidden",children:[b,o&&n.jsx("span",{className:"absolute bottom-1 left-1 text-[11px] lg:text-[13px] font-display tracking-wide uppercase bg-black/85 text-purple rounded-sm px-1.5 py-0.5",children:o}),h&&n.jsxs("button",{type:"button",onClick:()=>u(!0),className:"absolute top-1 right-1 text-[9px] lg:text-[10px] font-display tracking-wide bg-bg/90 rounded-sm px-1 text-muted cursor-pointer",title:`${s.length} cards tied at this count — view all`,children:[s.length,"-WAY TIE"]}),f&&n.jsx("span",{className:"absolute bottom-1 right-1 text-[11px] lg:text-[13px] font-num tabular-nums font-semibold px-1 rounded-sm bg-bg/85",children:i??Fd(s[0].pickPct)})]}),f&&n.jsxs("div",{className:"px-1.5 py-1.5 min-w-0 flex items-center gap-1.5",children:[n.jsx("span",{className:"text-subtle text-[11px] lg:text-[13px] truncate min-w-0",children:s[0].cardName}),m&&!c&&n.jsx("span",{className:"ml-auto shrink-0 hidden lg:flex",children:n.jsx(lf,{cost:m.manaCost,size:12})})]})]}),d&&n.jsx($de,{label:t,stats:s,cardsByName:r,onClose:()=>u(!1)})]})}function X8({title:e,headerAside:t,bySlot:s,setCode:r}){const a=Ft(r??"");return n.jsxs("div",{className:"flex flex-col gap-1.5 lg:gap-3",children:[n.jsxs("div",{className:"relative flex items-center justify-center",children:[n.jsx(Xe,{size:22,className:"text-white",children:e}),t&&n.jsx("span",{className:"absolute right-3 text-subtle text-[14px]",children:t})]}),n.jsx("div",{className:"hidden lg:grid grid-cols-2 xl:grid-cols-3 gap-3 items-start",children:a.map(o=>n.jsx(eL,{slot:o,rows:s.get(o.key)??[],setCode:r},o.key))}),n.jsx(Zde,{slots:a,bySlot:s,setCode:r})]})}function Zde({slots:e,bySlot:t,setCode:s}){const[r,a]=p.useState(new Set),o=p.useRef(null),i=(l,c)=>{const d=new Set(r);d.has(l)?(o.current={el:c,top:c.getBoundingClientRect().top},d.delete(l)):d.add(l),a(d)};return p.useLayoutEffect(()=>{const l=o.current;l&&(o.current=null,window.scrollBy(0,l.el.getBoundingClientRect().top-l.top))},[r]),n.jsx("div",{className:"lg:hidden flex flex-col gap-2 [overflow-anchor:none]",children:e.map(l=>n.jsx(eL,{slot:l,rows:t.get(l.key)??[],setCode:s,expanded:r.has(l.key),onToggle:c=>i(l.key,c)},l.key))})}function eL({slot:e,rows:t,setCode:s,expanded:r=!1,onToggle:a}){const o=a!==void 0,i=I8(e.key),l=!o||r,c=e.key==="wildcard_uncommon",d=n.jsxs("div",{className:`flex-1 flex items-center gap-2 ${c?"pl-4 pr-3":"px-3"} py-2.5 min-w-0`,children:[n.jsx(mo,{slotKey:e.key,size:20,setCode:s}),n.jsx("span",{className:"font-display text-[15px] tracking-[0.1em] text-white truncate",children:e.label.toUpperCase()}),n.jsxs("span",{className:"ml-auto shrink-0 text-muted text-[12px] tabular-nums",children:[t.length," card",t.length!==1?"s":""," chosen"]}),o&&n.jsx(fs,{size:16,className:`shrink-0 text-muted transition-transform duration-150 ${r?"rotate-180":""}`})]});return n.jsxs("div",{className:"relative border-y border-r border-border2 bg-surface overflow-hidden flex flex-col",children:[n.jsx("div",{className:`absolute inset-y-0 left-0 z-10 ${c?"w-2":"w-1"} pointer-events-none`,style:{background:i}}),o?n.jsx("button",{type:"button",onClick:u=>a(u.currentTarget),className:`flex items-stretch bg-surface2 text-left cursor-pointer ${l?"border-b border-border2":""}`,children:d}):n.jsx("div",{className:"flex items-stretch bg-surface2 border-b border-border2",children:d}),l&&n.jsx("div",{children:t.map((u,f)=>n.jsx(Yde,{rank:f+1,row:u,wide:c},u.name))})]})}function Yde({rank:e,row:t,wide:s}){const r=e===1;return n.jsxs("div",{className:"relative overflow-hidden border-b border-border2 last:border-b-0",children:[t.fillPct>0&&n.jsx("div",{className:"absolute inset-y-0 left-0 bg-subtle/[0.08]",style:{width:`${t.fillPct}%`}}),n.jsxs("div",{className:`relative flex items-center gap-2.5 ${s?"pl-4":"pl-1.5"} pr-3 py-1.5 ${t.isYours?"bg-green/[0.07]":""}`,children:[n.jsx("span",{className:`w-4 shrink-0 text-right font-num tabular-nums text-[13px] ${r?"text-text font-bold":"text-muted"}`,children:e}),t.card?n.jsx(ux,{imageUrl:t.card.imageNormal,alt:t.card.name,className:"w-11 h-11 rounded-sm overflow-hidden shrink-0",children:n.jsx("img",{src:t.card.imageArtCrop,alt:t.card.name,className:"w-full h-full object-cover"})}):n.jsx("div",{className:"w-11 h-11 rounded-sm bg-surface2 shrink-0"}),n.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[n.jsx("span",{className:"text-text text-[15px] leading-snug line-clamp-2 min-w-0",children:t.name}),t.isYours&&n.jsx("span",{className:"shrink-0 inline-block font-display tracking-[0.14em] uppercase text-[12.5px] leading-none px-2 py-1 bg-green text-bg",children:"YOURS"}),n.jsxs("span",{className:"ml-auto flex items-center gap-3 shrink-0",children:[t.card&&n.jsx(lf,{c
518ost:t.card.manaCost,size:12}),t.value]})]})]})]})}function Qde({pickStats:e,cardsByName:t,picksBySlot:s,setCode:r}){const a=p.useMemo(()=>{const i=pf(e);return new Map(Ft(r??"").map(l=>{const c=[...i.get(l.key)??[]].sort((f,h)=>h.pickCount-f.pickCount),d=c.length?c[0].pickPct:0,u=c.map(f=>({name:f.cardName,card:t.get(f.cardName),isYours:(s==null?void 0:s.get(l.key))===f.cardName,fillPct:d>0?Math.max(f.pickPct/d*100,3):0,value:n.jsx("span",{className:"font-num tabular-nums text-[16px] font-semibold text-text w-8 text-right",children:f.pickCount})}));return[l.key,u]}))},[e,t,s,r]),o=p.useMemo(()=>zde(e),[e]);return n.jsx(X8,{title:"FULL BREAKDOWN",headerAside:`${o} player${o!==1?"s":""}`,bySlot:a,setCode:r})}function tL({pickStats:e,cardsByName:t,picksBySlot:s,setCode:r,yourPicks:a,compact:o=!1}){return n.jsxs("div",{className:"flex flex-col gap-3 lg:gap-6",children:[a,n.jsx(Vde,{pickStats:e,cardsByName:t,picksBySlot:s,setCode:r,compact:o}),n.jsx(Qde,{pickStats:e,cardsByName:t,picksBySlot:s,setCode:r})]})}function sL({contestSlots:e,pickStats:t,cardsByName:s,picksBySlot:r,setCode:a,compact:o=!1}){const i=Jde(e,t,r);return n.jsxs("div",{children:[n.jsx("div",{className:"flex items-baseline justify-center gap-2 mb-1.5 lg:mb-2",children:n.jsx(Xe,{size:22,className:"text-white",children:"YOUR PICKS"})}),n.jsx(_o,{entries:i,cardsByName:s,picksBySlot:r,setCode:a,compact:o})]})}function Jde(e,t,s){const r=pf(t);return e.map(a=>{const o=s.get(a.key),i=r.get(a.key)??[],l=o?i.find(u=>u.cardName===o):void 0,c=mf(i),d=l?fx(l,c.most,c.least):void 0;return{slotKey:a.key,label:a.label,stats:l?[l]:[],slotStats:i,badge:(d==null?void 0:d.state)==="rogue"?d.qualifier:void 0}})}const yb="polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%)",Bn={1:"#ffc63a",2:"#c0c8d6",3:"#c87941"},bc="#2ee85c",Ow="#3b4458",y4={fav:0,pack:1,rogue:2},Vo={fav:bc,pack:"#4aa8ff",rogue:"#a98eff"};function nL(e,t=!1){const{user:s,isPastDeadline:r,isComplete:a,pickStats:o,phase:i,resultsDataReady:l,ratingsSnapshot:c,cards:d,ballots:u}=e,{picksBySlot:f,featured:h}=e;return!s||!r||!a||!o||o.length===0?null:i==="final"&&l&&c&&d&&u?n.jsx(iue,{ratingsSnapshot:c,pickStats:o,ballots:u,cards:d,picksBySlot:f,discordId:s.discordId}):i==="midway"&&l&&c&&d?n.jsx(rue,{ratingsSnapshot:c,cards:d,picksBySlot:f,compact:t}):n.jsx(Xde,{pickStats:o,picksBySlot:f,setCode:(h==null?void 0:h.code)??"",compact:t})}function Xde({pickStats:e,picksBySlot:t,setCode:s,compact:r}){const a=tue(e,t,s);if(a.length===0)return null;const o=a.filter(u=>u.state==="fav").length,i=a.filter(u=>u.state==="pack").length,l=a.filter(u=>u.state==="rogue"),c=sue(l),d=[...a].sort((u,f)=>y4[u.state]-y4[f.state]);return n.jsx(Lw,{title:"YOUR BALLOT",legend:n.jsx(eue,{}),compact:r,stats:n.jsxs(n.Fragment,{children:[n.jsx(Gh,{n:o,label:"CROWD",color:Vo.fav,compact:r}),n.jsx(Gh,{n:i,label:"SPLIT",color:Vo.pack,compact:r}),n.jsx(Gh,{n:l.length,label:"ROGUE",color:Vo.rogue,compact:r,className:r?void 0:"mr-[5px]"})]}),bar:n.jsx("div",{className:`flex gap-1 ${aL(r)}`,"aria-hidden":!0,children:d.map((u,f)=>n.jsx("div",{className:`${rL(r)} flex-1 rounded-[1px]`,style:{background:Vo[u.state]}},f))}),footnote:c&&n.jsxs("p",{className:`font-body text-subtle text-[12px] leading-snug ${r?"":"-ml-[10px]"}`,children:[n.jsx("span",{className:"mr-1",children:"🌶️"}),nue(c.pickCount)," ",n.jsx("span",{className:"text-text",children:c.cardName})]})})}function Lw({title:e,legend:t,stats:s,bar:r,footnote:a,frameColor:o,compact:i}){const[l,c]=p.useState(!1);return i?n.jsx("button",{type:"button",onClick:()=>c(d=>!d),"aria-expanded":l,className:"block w-full bg-transparent border-0 p-0 text-left cursor-pointer",children:n.jsxs(Du,{compact:!0,frameColor:o,animate:!0,children:[n.jsxs("div",{className:"w-full flex items-center gap-3",children:[n.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[n.jsx(Cp,{size:12,strokeWidth:2,className:"text-white"}),n.jsx("span",{className:"font-display text-white",style:{fontSize:12,letterSpacing:"0.22em"},children:e})]}),n.jsx("div",{className:"flex-1 min-w-0 flex items-baseline justify-end gap-3",children:s})]}),r,l&&n.jsxs("div",{className:"flex flex-col gap-1.5 pt-1 text-[12px]",children:[t,a]})]})}):n.jsxs(Du,{compact:!1,frameColor:o,animate:!0,children:[n.jsx(Ne,{label:t,side:"bottom",align:"start",hideArrow:!0,className:"max-w-[320px]",children:n.jsxs("button",{type:"button",className:"group inline-flex items-center gap-1.5 self-start cursor-default bg-transparent border-0 p-0",children:[n.jsx(Cp,{size:15,strokeWidth:2,className:"text-white transition-colors"}),n.jsx("span",{className:"font-display text-white",style:{fontSize:15,letterSpacing:"0.22em"},children:e})]})}),n.jsx("div",{className:"flex items-baseline justify-between",children:s}),r,a]})}function Du({compact:e,frameColor:t=Ow,animate:s=!1,children:r}){const a=e?Uc:yb,o=e?"block w-full":"inline-block",i=e?"px-4 py-2 flex flex-col gap-1.5":"w-[clamp(280px,22vw,340px)] px-5 py-2.5 flex flex-col gap-2";return n.jsx("div",{className:`${o} ${s?"animate-fadeUpIn":""}`,style:{clipPath:a,background:t,padding:1},children:n.jsx("div",{className:`bg-surface2 ${i}`,style:{clipPath:a},children:r})})}function rL(e){return e?"h-1.5":"h-2.5"}function aL(e){return e?"":"-ml-[5px]"}function oL({setCode:e="",compact:t=!1}){return t?n.jsxs(Du,{compact:!0,children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("div",{className:"h-3 w-24 bg-surface animate-pulse"}),n.jsx("div",{className:"h-4 w-36 bg-surface animate-pulse"})]}),n.jsx("div",{className:"h-1.5 w-full bg-surface animate-pulse rounded-[1px]"})]}):n.jsxs(Du,{compact:!1,children:[n.jsx("div",{className:"h-[15p
518x] w-28 bg-surface animate-pulse"}),n.jsx("div",{className:"h-6 w-40 bg-surface animate-pulse"}),n.jsx("div",{className:"flex gap-1 -ml-[5px]","aria-hidden":!0,children:Array.from({length:Ft(e).length},(s,r)=>n.jsx("div",{className:"h-2.5 flex-1 rounded-[1px] bg-surface animate-pulse"},r))})]})}function Gh({n:e,label:t,color:s,compact:r,className:a}){return n.jsxs("span",{className:`flex items-baseline ${r?"gap-1":"gap-1.5"} ${a??""}`,children:[n.jsx("span",{className:"font-display leading-none",style:{fontSize:r?17:24,color:s},children:e}),n.jsx("span",{className:`font-body leading-none ${r?"text-[11px]":"text-[12px]"}`,style:{color:s},children:t})]})}function eue(){return n.jsxs("div",{className:"flex flex-col gap-1.5 text-left",children:[n.jsx(Bg,{color:Vo.fav,term:"Crowd",def:n.jsxs(n.Fragment,{children:["you picked the ",n.jsx("b",{className:"font-semibold text-text",children:"most popular"})," card"]})}),n.jsx(Bg,{color:Vo.pack,term:"Split",def:n.jsxs(n.Fragment,{children:["you picked a card in the ",n.jsx("b",{className:"font-semibold text-text",children:"middle"})," of the pack"]})}),n.jsx(Bg,{color:Vo.rogue,term:"Rogue",def:n.jsxs(n.Fragment,{children:["you picked one of the ",n.jsx("b",{className:"font-semibold text-text",children:"least popular"})," cards"]})})]})}function Bg({color:e,term:t,def:s}){return n.jsxs("div",{className:"leading-snug",children:[n.jsx("span",{className:"font-semibold",style:{color:e},children:t})," ",n.jsxs("span",{className:"text-subtle",children:["- ",s]})]})}function tue(e,t,s){const r=pf(e),a=[];for(const o of Ft(s)){const i=t.get(o.key);if(!i)continue;const l=r.get(o.key),c=l==null?void 0:l.find(h=>h.cardName===i);if(!l||!c)continue;const{most:d,least:u}=mf(l),f=fx(c,d,u).state;a.push({state:f==="most"?"fav":f==="rogue"?"rogue":"pack",cardName:i,pickCount:c.pickCount})}return a}function sue(e){let t=null;for(const s of e)(!t||s.pickCount<t.pickCount)&&(t=s);return t}function nue(e){const t=e-1;return t<=0?"You were the only one to pick":t===1?"Only you and 1 other picked":`Only you and ${t} others picked`}function rue({ratingsSnapshot:e,cards:t,picksBySlot:s,compact:r}){const a=Ft(e.setCode),o=p.useMemo(()=>{const l=$m(e),c=rG(t,a,l);let d=0;for(const u of a){const f=s.get(u.key),h=c.get(u.key);f&&h&&f===h&&d++}return d},[e,t,s,a]),i=Array.from({length:a.length},(l,c)=>c<o);return n.jsx(Lw,{title:"YOUR BALLOT",legend:n.jsx(aue,{}),compact:r,stats:n.jsx(Gh,{n:o,label:"BEST POSSIBLE PICKS",color:bc,compact:r}),bar:n.jsx("div",{className:`flex gap-1 ${aL(r)}`,"aria-hidden":!0,children:i.map((l,c)=>n.jsx("div",{className:`${rL(r)} flex-1 rounded-[1px]`,style:{background:l?bc:Ow}},c))})})}function aue(){return n.jsxs("div",{className:"text-left leading-snug",children:[n.jsx("span",{className:"font-semibold",style:{color:bc},children:"Best possible picks"})," ",n.jsx("span",{className:"text-subtle",children:"- the top card for a given slot based on GIH win rate"})]})}const oue={1:"🥇",2:"🥈",3:"🥉"};function iue({ratingsSnapshot:e,pickStats:t,ballots:s,cards:r,picksBySlot:a,discordId:o}){const i=R6(),l=p.useMemo(()=>{const b=Ft(e.setCode),w=$m(e),x=dv(r,b,w),g=PE(AE(RE(s),w)),v=OE(g,a,o),k=g.filter(S=>S.picks.size===b.length).map(S=>S.score);return{score:(v==null?void 0:v.score)??cv(a,w),rank:(v==null?void 0:v.rank)??null,total:g.length,bestScore:x.score,crowdScore:uv(t,b,w).score,floor:k.length>0?Math.min(...k):0}},[e,t,s,r,a,i,o]),c=l.rank!==null&&l.rank<=3?l.rank:null,d=c?Bn[c]:bc,u=l.bestScore>l.floor?l.floor:0,f=l.bestScore-u,h=b=>f>0?Math.min(100,Math.max(0,(b-u)/f*100)):0,m=l.score>0?Math.max(3,h(l.score)):0,y=h(l.crowdScore);return n.jsx(Lw,{title:"YOUR RESULT",legend:n.jsx(lue,{}),compact:!1,frameColor:c?`${d}8c`:void 0,stats:n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"flex items-baseline gap-1.5",children:[n.jsx("span",{className:"font-num tabular-nums leading-none",style:{fontSize:24,color:d},children:l.score.toFixed(1)}),n.jsx("span",{className:"font-body text-[12px] leading-none",style:{color:d},children:"GIH WR total"})]}),l.rank!==null&&n.jsxs("span",{className:`font-mono tabular-nums text-[12px] leading-none ${c?"":"text-subtle"}`,style:c?{color:d}:void 0,children:[c?`${oue[c]} `:"","#",l.rank," of ",l.total]})]}),bar:n.jsxs("div",{className:"h-2.5 rounded-[1px] relative -ml-[5px]",style:{background:Ow}
518,"aria-hidden":!0,children:[n.jsx("div",{className:"absolute top-0 left-0 h-full rounded-[1px]",style:{width:`${m}%`,background:d}}),n.jsx("div",{className:"absolute top-0 h-full w-px bg-white/50",style:{left:`${y}%`}})]})})}function lue(){return n.jsxs("div",{className:"flex flex-col gap-1.5 text-left leading-snug",children:[n.jsxs("div",{children:[n.jsx("span",{className:"font-semibold",style:{color:bc},children:"Score"})," ",n.jsxs("span",{className:"text-subtle",children:["- your ballot's summed ",n.jsx("b",{className:"font-semibold text-text",children:"GIH win rate"})]})]}),n.jsxs("div",{className:"text-subtle",children:["The bar spans the ",n.jsx("b",{className:"font-semibold text-text",children:"lowest completed ballot"})," to the ",n.jsx("b",{className:"font-semibold text-text",children:"best possible"})," ballot; the white line marks the performance of the ",n.jsx("b",{className:"font-semibold text-text",children:"crowd picks"})]})]})}function cue({cards:e,cardsByName:t,ratingsByName:s,yourCardBySlot:r,pickStats:a,bounds:o,setCode:i}){const l=p.useMemo(()=>{const f=new Map;for(const h of a){const m=f.get(h.slot)??new Set;m.add(h.cardName),f.set(h.slot,m)}return f},[a]),c=p.useMemo(()=>Um(i?Lc[i]:void 0),[i]),d=p.useMemo(()=>{const f=new Set;return new Map(c.map(h=>{const m=l.get(h.key)??new Set,b=e.filter(w=>h.filter(w,f)&&m.has(w.name)).map(w=>{const x=s.get(w.name),g=x&&x.gih>=An&&x.gihwr!==null?x.gihwr:null;return{card:w,gihwr:g,isYours:r.get(h.key)===w.name}});return b.sort((w,x)=>w.gihwr!==null&&x.gihwr!==null?x.gihwr-w.gihwr:w.gihwr!==null?-1:x.gihwr!==null?1:0),[h.key,b]}))},[c,e,s,r,l]),u=p.useMemo(()=>{const f=o.max-o.min;return new Map([...d.entries()].map(([h,m])=>{const y=m.map(b=>({name:b.card.name,card:t.get(b.card.name),isYours:b.isYours,fillPct:b.gihwr!==null?f>0?Math.max((b.gihwr-o.min)/f*100,3):100:0,value:n.jsx("span",{className:`font-num tabular-nums text-[13px] font-semibold ${b.gihwr!==null?"text-text":"text-muted"}`,children:b.gihwr!==null?`${(b.gihwr*100).toFixed(1)}%`:"—"})}));return[h,y]}))},[d,o,t]);return n.jsx(X8,{title:"GIH WINRATE BREAKDOWN",bySlot:u,setCode:i})}const due="#2ee85c",uue="#e6ecf5";function iL(e,t){if(e===null)return 0;const s=t.max-t.min;return s<=0?100:Math.max(4,Math.min(100,(e-t.min)/s*100))}function lL(e){return e!==null?`${(e*100).toFixed(1)}%`:"—"}const fue={yours:"YOUR PICK",crowd:"CROWD FAVORITE",best:"BEST POSSIBLE"},hue={"crowd+yours":"CROWD・YOURS","best+yours":"BEST POSSIBLE・YOURS","best+crowd":"BEST POSSIBLE・CROWD","best+crowd+yours":"BEST POSSIBLE・CROWD・YOURS"};function pue(e){return e.includes("best")&&e.includes("yours")?due:uue}function mue(e){const t=[];t.push({role:"crowd",side:e.crowd}),t.push({role:"best",side:e.best}),e.yours&&t.push({role:"yours",side:e.yours});const s=[],r=new Map;for(const{role:a,side:o}of t)r.has(o.name)||(s.push(o.name),r.set(o.name,{roles:[],side:o})),r.get(o.name).roles.push(a);if(e.yours){const a=s.indexOf(e.yours.name);a!==-1&&(s.splice(a,1),s.push(e.yours.name))}return s.map(a=>{const{roles:o,side:i}=r.get(a),l=[...o].sort().join("+"),c=hue[l]??fue[o[0]],d=pue(o);return{side:i,roles:o,label:c,accent:d}})}function xue(e){return Q8(e)}function gue({pager:e,bounds:t}){return n.jsx(J8,{pager:e,padding:"p-4",renderCard:(s,r)=>n.jsx(bue,{versus:s,bounds:t,...r})})}function bue({versus:e,onPrev:t,onNext:s,paged:r=!1,bounds:a}){const o=c=>c.stopPropagation(),i=mue(e),l=i.length===1?420:i.length===2?820:1160;return n.jsxs(mb,{maxWidth:l,onClick:o,children:[n.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 px-2 pt-2 lg:px-4",children:[n.jsx(xb,{slotKey:e.slotKey,slotLabel:e.slotLabel}),i.length===1?n.jsx(yue,{column:i[0],bounds:a}):i.length===2?n.jsx(vue,{columns:i,bounds:a}):n.jsx(wue,{columns:i,bounds:a})]}),n.jsx(bb,{onPrev:t,onNext:s,paged:r,prevLabel:"Prev Slot",nextLabel:"Next Slot"})]})}function cL(e){return"GIH"}function yue({column:e,bounds:t}){return n.jsx(Wd,{label:e.label,labelColor:e.accent,value:lL(e.side.gihwr),valueColor:e.accent,caption:cL(),fillPct:iL(e.side.gihwr,t),barColor:e.accent,dim:e.side.gihwr===null,density:"comfortable",solo:!0,imageUrl:e.side.imageUrl,name:e.side.name})}function vue({columns:e,bounds:t}){return n.jsx(Y8,{left:n.jsx(Hd,{column:e[0],bounds:t}),right:n.jsx(Hd,{column:e[1],bounds:t})})}function wue({columns:e,bounds:t}
518){return n.jsx(Fde,{left:n.jsx(Hd,{column:e[0],bounds:t,tight:!0}),middle:n.jsx(Hd,{column:e[1],bounds:t,tight:!0}),right:n.jsx(Hd,{column:e[2],bounds:t,tight:!0})})}function Hd({column:e,bounds:t,tight:s=!1}){return n.jsx(Wd,{label:e.label,labelColor:e.accent,value:lL(e.side.gihwr),valueColor:e.accent,caption:cL(),fillPct:iL(e.side.gihwr,t),barColor:e.accent,dim:e.side.gihwr===null,density:"comfortable",tight:s,imageUrl:e.side.imageUrl,name:e.side.name})}const jue="#2ee85c";function dL(e){return`${(e*100).toFixed(1)}%`}function v4(e,t){const s=new Map(e.map(r=>[r.slot,r]));return Ft(t).map(r=>{const a=s.get(r.key);return a!=null&&a.cardName?{slotKey:r.key,label:r.label,stats:[{setCode:t,slot:r.key,cardName:a.cardName,pickCount:0,pickPct:0}],pctLabel:a.gihwr>0?dL(a.gihwr):"—"}:{slotKey:r.key,label:r.label,stats:[]}})}function kue(e,t,s){return Ft(t).map(r=>{const a=e.get(r.key);if(!a)return{slotKey:r.key,label:r.label,stats:[]};const o=s.get(a),i=o&&o.gih>=An&&o.gihwr!==null?o.gihwr:null;return{slotKey:r.key,label:r.label,stats:[{setCode:t,slot:r.key,cardName:a,pickCount:0,pickPct:0}],pctLabel:i!==null?dL(i):"—"}})}function uL({ratingsSnapshot:e,pickStats:t,cards:s,cardsByName:r,picksBySlot:a,user:o,hasParticipated:i}){const{setCode:l}=e,c=p.useMemo(()=>Ft(l),[l]),d=p.useMemo(()=>$m(e),[e]),u=p.useMemo(()=>nG(t,d),[t,d]),f=p.useMemo(()=>uv(t,c,d),[t,c,d]),h=p.useMemo(()=>dv(s,c,d),[s,c,d]),m=!!o&&i,[y,b]=p.useState("yours"),w=m&&y==="yours",x=m?cv(a,d):0,g=p.useMemo(()=>m?kue(a,l,d):[],[m,a,l,d]),v=p.useMemo(()=>v4(f.picks,l),[f.picks,l]),k=p.useMemo(()=>v4(h.picks,l),[h.picks,l]),S=p.useMemo(()=>aG(c,a,f,h,d,r,m),[c,a,f,h,d,r,m]),N=xue(S),C=T=>{const E=c.findIndex(A=>A.key===T);E!==-1&&N.open(E)},_=p.useMemo(()=>m?a:new Map,[m,a]);return n.jsxs("div",{className:"flex flex-col gap-3 lg:gap-6",children:[n.jsx(w4,{label:w?"YOUR PICKS":"CROWD PICKS",labelToggle:m,labelColor:"#ffffff",score:w?x:f.score,entries:w?g:v,cardsByName:r,setCode:l,onTileOpen:C,aligned:m,toggle:m?{viewingYours:w,onClick:()=>b(y==="yours"?"crowd":"yours")}:void 0}),n.jsx(w4,{label:"BEST POSSIBLE",labelColor:jue,score:h.score,scoreColor:"text-green",showHelp:!1,aligned:m,entries:k,cardsByName:r,setCode:l,onTileOpen:C}),n.jsx(gue,{pager:N,bounds:u}),n.jsx(cue,{cards:s,cardsByName:r,ratingsByName:d,yourCardBySlot:_,pickStats:t,bounds:u,setCode:l})]})}const Sue=["YOUR PICKS","CROWD PICKS"];function w4({label:e,labelToggle:t=!1,labelColor:s,score:r,scoreColor:a="text-subtle",showHelp:o=!0,entries:i,cardsByName:l,setCode:c,onTileOpen:d,toggle:u,aligned:f=!1}){const h=n.jsx("span",{className:"whitespace-nowrap font-display leading-none tracking-[0.12em] text-[18px] lg:tracking-[0.22em] lg:text-[20px]",style:{color:s},children:t?n.jsx(vb,{options:Sue,active:e}):e}),m=n.jsx(Nue,{score:r,scoreColor:a,showHelp:o}),y=u?n.jsx(Cue,{toggle:u}):null;return n.jsxs("div",{children:[f?n.jsxs("div",{className:"mb-1.5 grid grid-cols-[1fr_auto_1fr] items-center gap-2 lg:hidden",children:[n.jsx("div",{className:"justify-self-start pl-1",children:h}),n.jsx("div",{className:"justify-self-center",children:m}),n.jsx("div",{className:"justify-self-end",children:y})]}):n.jsxs("div",{className:"mb-1.5 flex items-center justify-center gap-6 lg:hidden",children:[h,m]}),n.jsxs("div",{className:"mb-2 hidden items-baseline lg:grid lg:grid-cols-[1fr_auto_1fr] lg:gap-5",children:[n.jsx("div",{className:"lg:col-start-2",children:h}),n.jsxs("div",{className:"flex items-baseline gap-4 lg:col-start-3 lg:justify-self-start",children:[m,y]})]}),n.jsx(_o,{entries:i,cardsByName:l,setCode:c,onTileOpen:d})]})}function Nue({score:e,scoreColor:t,showHelp:s}){return n.jsxs("span",{className:"inline-flex items-baseline gap-1.5",children:[n.jsx("span",{className:j("font-num text-[16px] font-semibold leading-none tabular-nums lg:text-[20px]",t),children:e.toFixed(1)}),s&&n.jsx(Ne,{label:"Game In Hand Win Rate",side:"top",children:n.jsx("button",{type:"button",className:"inline-flex cursor-default items-center self-center border-0 bg-transparent p-0 text-muted",children:n.jsx(Cp,{size:16})})})]})}function Cue({toggle:e}){const t=e.viewingYours?"VIEW CROWD PICKS":"VIEW YOUR PICKS",s=e.viewingYours?"VIEW CROWD":"VIEW YOURS";return n.jsxs("button",{type:"button",onClick:e.onClick,className:"rounded border border-border2 px-2.5 py-1 font-display text-[13px] tracking-[0.12em] text-subtle transition-colors hover:border-green hover:text-green",children:[n.jsx(vb,{options:["VIEW CROWD PICKS","VIEW YOUR PICKS"],active:t,className:"hidden lg:grid"}),n.jsx(vb,{options:["VIEW CROWD","VIEW YOURS"],active:s,className:"grid lg:hidden"})]})}function vb({options:e,active:t,className:s}){return n.jsx("span",{className:j("grid justify-items-center",s
518),children:e.map(r=>n.jsx("span",{"aria-hidden":r!==t,className:j("col-start-1 row-start-1",r===t?"":"invisible"),children:r},r))})}const _ue=5;function wb({title:e,children:t}){return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("div",{className:"flex justify-center",children:n.jsx(Xe,{size:22,className:"text-white",children:e})}),t&&n.jsx("p",{className:"text-center text-[13.5px] text-subtle mt-1.5",children:t})]})}function Dw(e){return`${(e*100).toFixed(1)}%`}function Hc({name:e,avatarUrl:t,className:s,fallbackClassName:r,style:a,title:o}){const[i,l]=p.useState(!1);return t&&!i?n.jsx("img",{src:t,alt:e,title:o,decoding:"async",onError:()=>l(!0),className:s,style:a}):n.jsx("div",{className:r,style:a,title:o,children:e.replace(/^\W+/,"").charAt(0).toUpperCase()||"?"})}function Tue(e,t){const s=new Map(e.map(r=>[r.slot,r]));return Ft(t).map(r=>{const a=s.get(r.key);return a!=null&&a.cardName?{slotKey:r.key,label:r.label,stats:[{setCode:t,slot:r.key,cardName:a.cardName,pickCount:0,pickPct:0}],pctLabel:a.gihwr>0?Dw(a.gihwr):"—"}:{slotKey:r.key,label:r.label,stats:[]}})}function hx(e,t,s){return Ft(t).map(r=>{const a=e.picks.get(r.key);if(!a)return{slotKey:r.key,label:r.label,stats:[]};const o=s.get(a),i=o&&o.gih>=An&&o.gihwr!==null?o.gihwr:null;return{slotKey:r.key,label:r.label,stats:[{setCode:t,slot:r.key,cardName:a,pickCount:0,pickPct:0}],pctLabel:i!==null?Dw(i):"—"}})}function Eue(e,t,s,r){return Ft(t).map(a=>{const o=e.picks.get(a.key)??null,i=o?r.get(o):void 0,l=o?s.get(o):void 0,c=l&&l.gih>=An&&l.gihwr!==null?l.gihwr:null;return{slotKey:a.key,label:a.label,cardName:o,card:i,gihwr:c,points:c!==null?c*100:0}})}function Rue({seg:e}){var s;const t=KX(((s=e.card)==null?void 0:s.imageNormal)??"");return e.card&&!t?null:n.jsx("div",{className:"bg-surface2 border border-border2 rounded-sm shadow-xl overflow-hidden w-56",children:e.card?n.jsx("img",{src:e.card.imageNormal,alt:e.card.name,className:"w-full block"}):n.jsxs("div",{className:"px-2 py-1.5",children:[n.jsx("div",{className:"font-display tracking-[0.1em] text-[10px] text-muted uppercase leading-none mb-0.5",children:e.label}),n.jsx("div",{className:"text-[12px] text-subtle",children:e.cardName??"—"})]})})}function px({ballot:e,setCode:t,maxScore:s,ratingsByName:r,cardsByName:a,stickyTop:o=0}){const l=p.useMemo(()=>Eue(e,t,r,a),[e,t,r,a]).filter(d=>d.points>0),c=s>0?e.score/s*100:0;return n.jsxs("div",{className:"hidden lg:block flex-1 self-stretch -my-2.5 lg:-my-3 relative min-w-0",onClick:d=>d.stopPropagation(),children:[n.jsx("div",{className:"absolute inset-0 bg-black/15 pointer-events-none"}),n.jsx("div",{className:"absolute top-0 left-0 h-full flex gap-px overflow-hidden",style:{width:`${c}%`},children:l.map(({slotKey:d,card:u})=>n.jsxs("div",{className:"relative h-full overflow-hidden flex-1 basis-0",children:[n.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px] z-10 pointer-events-none",style:{background:I8(d)}}),u&&n.jsx("img",{src:u.imageArtCrop,alt:"","aria-hidden":!0,decoding:"async",className:"absolute inset-0 w-full xl:-top-1/4 object-cover pointer-events-none"}),n.jsx("div",{className:"absolute inset-0 bg-black/55 pointer-events-none"})]},d))}),n.jsx("div",{className:"absolute top-0 left-0 h-full flex gap-px",style:{width:`${c}%`},children:l.map(d=>n.jsx(Ne,{label:n.jsx(Rue,{seg:d}),side:"top",hideArrow:!0,delayDuration:0,collisionPadding:{top:o+8,bottom:8,left:8,right:8},className:"p-0 bg-transparent border-0 shadow-none",children:n.jsx("div",{className:"relative h-full cursor-pointer flex-1 basis-0"})},d.slotKey))})]})}const Iw={best:{label:"Best possible",color:"#3fe0d0"},crowd:{label:"Crowd Picks",color:"#7aa2ff"}};function fL(){return n.jsx("span",{className:"shrink-0 inline-flex items-center h-[18px] font-display uppercase tracking-[0.14em] px-[7px] text-[11px] text-bg",style:{background:Iw.best.color},children:"✦ BEST POSSIBLE"})}function xf(){return n.jsx("span",{className:"shrink-0 inline-flex items-center h-[18px] font-display uppercase tracking-[0.14em] px-[7px] text-[11px] bg-green text-bg",children:"YOU"})}function Aue(e){const t=new Map;for(const s of e.team.picks)s.cardName&&t.set(s.slot,s.cardName);return{ballotId:e.kind==="best"?-1:-2,name:Iw[e.kind].label,avatarUrl:null,picks:t,score:e.team.score,rank:0}}function Pue({standing:e,setCode:t,maxScore:s,cardsByName:r,ratings
518ByName:a,stickyTop:o=0}){const[i,l]=p.useState(!1),c=Iw[e.kind],d=p.useMemo(()=>Aue(e),[e]),u=p.useMemo(()=>i?Tue(e.team.picks,t):[],[i,e,t]);return n.jsxs("div",{className:"border-b border-border2 last:border-b-0",style:{boxShadow:`inset 3px 0 0 ${c.color}`,backgroundImage:`linear-gradient(90deg, ${c.color}0d, transparent 55%)`},children:[n.jsxs("button",{type:"button",onClick:()=>l(f=>!f),className:"w-full flex items-center gap-2 lg:gap-3 px-3 lg:px-4 py-2.5 lg:py-3 text-left cursor-pointer bg-transparent border-0",children:[n.jsx("span",{className:"w-7 lg:w-8 shrink-0"}),n.jsx("div",{className:"w-6 h-6 lg:w-7 lg:h-7 rounded-full shrink-0 bg-surface flex items-center justify-center text-[11px] lg:text-[12px]",style:{color:c.color,boxShadow:`0 0 0 1.5px ${c.color}`},children:"✦"}),n.jsx("span",{className:"font-display tracking-wider flex-1 min-w-0 lg:flex-none lg:w-[150px] lg:shrink-0 text-[14px] lg:text-[15px] truncate text-subtle",style:{color:c.color},children:c.label}),n.jsx(px,{ballot:d,setCode:t,maxScore:s,ratingsByName:a,cardsByName:r,stickyTop:o}),n.jsx("span",{className:"font-num tabular-nums text-[13px] lg:text-[14px] font-semibold shrink-0",style:{color:c.color},children:e.team.score.toFixed(2)}),n.jsx(fs,{size:14,className:`shrink-0 text-muted transition-transform duration-150 ${i?"rotate-180":""}`})]}),i&&n.jsx("div",{className:"px-3 lg:px-4 pb-4 pt-1",children:n.jsx(_o,{entries:u,cardsByName:r,setCode:t})})]})}function Oue({champion:e,runnersUp:t,self:s,setCode:r,cardsByName:a,ratingsByName:o,userBallotId:i,bestAchieverIds:l}){const c=p.useMemo(()=>hx(e,r,o),[e,r,o]);return n.jsxs("div",{className:"animate-fadeUpIn flex flex-col gap-2.5",children:[n.jsxs("div",{className:"relative overflow-hidden",style:{transform:"skewX(-6deg)",marginInline:10,background:"linear-gradient(100deg, #232a3a, #1d2330 55%)",border:"1px solid #3b4458",borderLeft:0,boxShadow:"0 0 34px #ffc63a22"},children:[n.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:"repeating-linear-gradient(to bottom, #ffffff06 0 1px, transparent 1px 3px)"}}),n.jsx("div",{className:"absolute top-0 bottom-0 left-0 flex items-center justify-center shrink-0",style:{width:56,background:`linear-gradient(180deg, #ffd76a, ${Bn[1]} 55%, #d99e12)`},children:n.jsx("span",{className:"font-display leading-none",style:{fontSize:40,color:"#0a0c10",transform:"skewX(6deg)"},children:"1"})}),n.jsxs("div",{className:"relative flex flex-row items-center gap-3 sm:gap-4 py-3 sm:py-4",style:{transform:"skewX(6deg)",paddingLeft:74,paddingRight:20},children:[n.jsxs("div",{className:"flex items-center gap-3 sm:gap-4 flex-1 min-w-0",children:[n.jsx(Hc,{name:e.name,avatarUrl:e.avatarUrl,className:"w-10 h-10 sm:w-14 sm:h-14 rounded-full shrink-0 object-cover",fallbackClassName:"w-10 h-10 sm:w-14 sm:h-14 rounded-full shrink-0 bg-surface flex items-center justify-center text-[14px] sm:text-[20px] text-muted font-mono",style:{boxShadow:`0 0 0 2px #1d2330, 0 0 0 3px ${Bn[1]}, 0 0 18px #ffc63a66`}}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"font-mono tracking-[0.22em] text-[10px] sm:text-[10.5px] uppercase text-gold",children:"🏆 CHAMPION"}),n.jsxs("div",{className:"flex flex-row items-center gap-1.5 sm:gap-2 min-w-0",children:[n.jsx("span",{className:"font-display text-[24px] sm:text-[44px] leading-[0.95] tracking-[0.03em] truncate min-w-0",children:e.name.toUpperCase()}),(e.ballotId===i||l.has(e.ballotId))&&n.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.ballotId===i&&n.jsx(xf,{}),l.has(e.ballotId)&&n.jsx(fL,{})]})]})]})]}),n.jsxs("div",{className:"text-right shrink-0 pl-3 sm:pl-4",children:[n.jsxs("div",{className:"hidden sm:block",style:{borderLeft:"2px solid #ffc63a55",paddingLeft:18},children:[n.jsx("div",{className:"font-num tabular-nums text-[34px] font-bold leading-[1.05] text-gold",style:{textShadow:"0 0 34px #ffc63a90"},children:e.score.toFixed(2)}),n.jsx("div",{className:"font-mono tracking-[0.24em] text-[10.5px] font-semibold text-gold/80 mt-1",children:"FINAL SCORE"})]}),n.jsxs("div",{className:"sm:hidden",children:[n.jsx("div",{className:"font-num tabular-nums text-[22px] font-bold leading-[1.05] text-gold",style:{textShadow:"0 0 34px #ffc63a90"},children:e.score.toFixed(2)}),n.jsx("div",{className:"font-mono tracking-[0.18em] text-[8px] font-semibold text-gold/80",children:"FINAL SCORE"})]})]})]})]}),n.jsx("div",{className:"mx-[10px]",children:n.jsx(_o,{entries:c,cardsByName:a,setCode:r})}),n.jsxs("div",{className:"flex flex-col gap-1.5 mt-1",children:[t.map(d=>n.jsx(j4,{ballot:d,accent:d.rank===2?Bn[2]:Bn[3],isSelf:d.ballotId===i,isBest:l.has(d.ballotId),setCode:r,cardsByName:a,ratingsByName:o},d.ballotId)),s&&n.jsx(j4,{ballot:s,accent:"#2ee85c",isSelf:!0,isBest:l.has(s.ballotId),setCode:r,cardsByName:a,ratingsByName:o},s.ballotId)]})]})}function j4({ballot:e,accent:t,isSelf:s,isBest:r,setCode:a,cardsByName:o,ratingsByName:i}){const[l,c]=p.useState(!1),d=p.useMemo(()=>l?hx(e,a,i):[],[l,e,a,i]);return n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("button",{type:"button",onClick:()=>c(u=>!u),className:"relative flex items-stretch overflow-hidden cursor-pointer bg-transparent border-0 p-0 text-left",style:{transform:"skewX(-6deg)",marginInline:10,background:"#1d2330",border:"1px solid #3b4458",borderLeft:0},children:[n.jsx("div",{className:"flex items-center justify-center shrink-0 px-2",style:{minWidth:40,background:`linear-gradient(180deg, ${t}dd, ${t} 55%, ${t}aa)`},children:n.jsx("span",{className:"font-display text-[19px]",style:{color:"#0a0c10",transform:"skewX(6deg)"},children:e.rank})}),n.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-3 py-2 px-4",style:{transform:"skewX(6deg)"},children:[n.jsx(Hc,{name:e.name,avatarUrl:e.avatarUrl,className:"w-6 h-6 sm:w-7 sm:h-7 rounded-full shrink-0 object-cover",fallbackClassName:"w-6 h-6 sm:w-7 sm:h-7 rounded-full shrink-0 bg-surface flex items-center justify-center text-[10px] sm:text-[11px] text-muted font-mono",style:{boxShadow:`0 0 0 1.5px ${t}`}}),n.jsxs("span",{className:"flex flex-row items-center gap-1.5 sm:gap-2 flex-1 min-w-0",children:[n.jsx("span",{className:"font-display text-[16px] sm:text-[20px] tracking-[0.04em] truncate min-w-0",children:e.name.toUpperCase()}),(s||r)&&n.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[s&&n.jsx(xf,{}),r&&n.jsx(fL,{})]})]}),n.jsx("span",{className:"font-num tabular-nums text-[14px] sm:text-[16
518px] font-bold shrink-0",style:{color:t},children:e.score.toFixed(2)}),n.jsx(fs,{size:14,className:`shrink-0 text-muted transition-transform duration-150 ${l?"rotate-180":""}`})]})]}),l&&n.jsx("div",{className:"mx-[10px]",children:n.jsx(_o,{entries:d,cardsByName:o,setCode:a})})]})}const Lue={1:{color:Bn[1],label:"1ST",tint:`linear-gradient(90deg, ${Bn[1]}12, transparent 55%)`},2:{color:Bn[2],label:"2ND",tint:`linear-gradient(90deg, ${Bn[2]}12, transparent 55%)`},3:{color:Bn[3],label:"3RD",tint:`linear-gradient(90deg, ${Bn[3]}12, transparent 55%)`}};function Due({ballot:e,setCode:t,isSelf:s,maxScore:r,cardsByName:a,ratingsByName:o,rowRef:i,stickyTop:l=0}){const[c,d]=p.useState(!1),u=p.useMemo(()=>c?hx(e,t,o):[],[c,e,t,o]),f=Lue[e.rank];return n.jsxs("div",{ref:i,className:`border-b border-border2 last:border-b-0 ${s?"bg-green/[0.07]":""}`,style:{boxShadow:`inset 3px 0 0 ${s?"#2ee85c":f.color}`,backgroundImage:s?void 0:f.tint},children:[n.jsxs("button",{type:"button",onClick:()=>d(h=>!h),className:"w-full flex items-center gap-2 lg:gap-3 px-3 lg:px-4 py-2.5 lg:py-3 text-left cursor-pointer bg-transparent border-0",children:[n.jsx("span",{className:"w-7 lg:w-8 shrink-0 text-right font-display tracking-[0.06em] text-[15px] lg:text-[17px]",style:{color:f.color},children:f.label}),n.jsx(Hc,{name:e.name,avatarUrl:e.avatarUrl,className:"w-6 h-6 lg:w-7 lg:h-7 rounded-full shrink-0 object-cover",fallbackClassName:"w-6 h-6 lg:w-7 lg:h-7 rounded-full shrink-0 bg-surface flex items-center justify-center text-[10px] lg:text-[11px] text-muted font-mono",style:{boxShadow:`0 0 0 1.5px ${f.color}`}}),n.jsxs("div",{className:"flex-1 min-w-0 lg:flex-none lg:w-[150px] lg:shrink-0 flex items-center gap-2",children:[n.jsx("span",{className:`min-w-0 truncate text-[14px] lg:text-[15px] ${s?"text-white font-semibold":"text-text"}`,children:e.name}),s&&n.jsx(xf,{})]}),n.jsx(px,{ballot:e,setCode:t,maxScore:r,ratingsByName:o,cardsByName:a,stickyTop:l}),n.jsx("span",{className:"font-num tabular-nums text-[13px] lg:text-[14px] font-semibold shrink-0",style:{color:f.color},children:e.score.toFixed(2)}),n.jsx(fs,{size:14,className:`shrink-0 text-muted transition-transform duration-150 ${c?"rotate-180":""}`})]}),c&&n.jsx("div",{className:"px-3 lg:px-4 pb-4 pt-1",children:n.jsx(_o,{entries:u,cardsByName:a,setCode:t})})]})}function Iue({ballot:e,setCode:t,isSelf:s,maxScore:r,cardsByName:a,ratingsByName:o,rowRef:i,stickyTop:l=0}){const[c,d]=p.useState(!1),u=p.useMemo(()=>c?hx(e,t,o):[],[c,e,t,o]);return n.jsxs("div",{ref:i,className:`border-b border-border2 last:border-b-0 ${s?"bg-green/[0.07] shadow-[inset_3px_0_0_0_#2ee85c]":""}`,style:{contentVisibility:"auto",containIntrinsicSize:"auto 52px"},children:[n.jsxs("button",{type:"button",onClick:()=>d(f=>!f),className:"w-full flex items-center gap-2 lg:gap-3 px-3 lg:px-4 py-2.5 lg:py-3 text-left cursor-pointer bg-transparent border-0",children:[n.jsxs("span",{className:"w-7 lg:w-8 shrink-0 text-right font-num tabular-nums text-[12px] lg:text-[13px] text-muted",children:["#",e.rank]}),n.jsx(Hc,{name:e.name,avatarUrl:e.avatarUrl,className:"w-6 h-6 lg:w-7 lg:h-7 rounded-full shrink-0 object-cover",fallbackClassName:"w-6 h-6 lg:w-7 lg:h-7 rounded-full shrink-0 bg-surface flex items-center justify-center text-[10px] lg:text-[11px] text-muted font-mono"}),n.jsxs("div",{className:"flex-1 min-w-0 lg:flex-none lg:w-[150px] lg:shrink-0 flex items-center gap-2",children:[n.jsx("span",{className:`min-w-0 truncate text-[14px] lg:text-[15px] ${s?"text-white font-semibold":"text-text"}`,children:e.name}),s&&n.jsx(xf,{})]}),n.jsx(px,{ballot:e,setCode:t,maxScore:r,ratingsByName:o,cardsByName:a,stickyTop:l}),n.jsx("span",{className:"font-num tabular-nums text-[13px] lg:text-[14px] text-subtle shrink-0",children:e.score.toFixed(2)}),n.jsx(fs,{size:14,className:`shrink-0 text-muted transition-transform duration-150 ${c?"rotate-180":""}`})]}),c&&n.jsx("div",{className:"px-3 lg:px-4 pb-4 pt-1",children:n.jsx(_o,{entries:u,cardsByName:a,setCode:t})})]})}function Mue({ballot:e,setCode:t,maxScore:s,cardsByName:r,ratingsByName:a,hidden:o,stickyTop:i,onScrollToRow:l}){return!e||o?null:n.jsx("div",{className:"sticky z-20 border-b border-border2 bg-surface2",style:{to
518p:i},children:n.jsxs("div",{onClick:l,className:"flex items-center gap-2 lg:gap-3 px-3 lg:px-4 py-2.5 lg:py-3 cursor-pointer bg-green/[0.07] shadow-[inset_3px_0_0_0_#2ee85c]",children:[n.jsxs("span",{className:"w-7 lg:w-8 shrink-0 text-right font-num tabular-nums text-[12px] lg:text-[13px] text-muted",children:["#",e.rank]}),n.jsx(Hc,{name:e.name,avatarUrl:e.avatarUrl,className:"w-6 h-6 lg:w-7 lg:h-7 rounded-full shrink-0 object-cover",fallbackClassName:"w-6 h-6 lg:w-7 lg:h-7 rounded-full shrink-0 bg-surface flex items-center justify-center text-[10px] lg:text-[11px] text-muted font-mono"}),n.jsxs("div",{className:"flex-1 min-w-0 lg:flex-none lg:w-[150px] lg:shrink-0 flex items-center gap-2",children:[n.jsx("span",{className:"min-w-0 truncate text-[14px] lg:text-[15px] text-white font-semibold",children:e.name}),n.jsx(xf,{})]}),n.jsx(px,{ballot:e,setCode:t,maxScore:s,ratingsByName:a,cardsByName:r,stickyTop:i}),n.jsx("span",{className:"font-num tabular-nums text-[13px] lg:text-[14px] text-subtle shrink-0",children:e.score.toFixed(2)}),n.jsx(fs,{size:14,className:"shrink-0 text-muted transition-transform duration-150"})]})})}const k4=3,Fg=30;function S4({rankedBallots:e,bestTeam:t,crowdTeam:s,setCode:r,userBallotId:a,cardsByName:o,ratingsByName:i,mode:l="full",onSeeAll:c,stickyTop:d=0}){const u=p.useMemo(()=>iG(e,t,s),[e,t,s]),f=l==="peek",h=u.entries.reduce((E,A)=>Math.max(E,A.kind==="ballot"?A.ballot.score:A.standing.team.score),1),[m,y]=p.useState(null),[b,w]=p.useState(!0);p.useEffect(()=>{if(!m){w(!0);return}const E=new IntersectionObserver(([A])=>w(A.isIntersecting),{rootMargin:`${-d}px 0px 0px 0px`,threshold:0});return E.observe(m),()=>E.disconnect()},[m,d]);const[x,g]=p.useState(Fg),[v,k]=p.useState(null);p.useEffect(()=>{if(!v)return;const E=new IntersectionObserver(([A])=>{A.isIntersecting&&g(P=>P+Fg)},{rootMargin:"1200px 0px"});return E.observe(v),()=>E.disconnect()},[v,x]);const[S,N]=p.useState(!1);if(p.useEffect(()=>{S&&m&&(m.scrollIntoView({behavior:"smooth",block:"center"}),N(!1))},[S,m]),f){const E=e.find(M=>M.rank===1);if(!E)return null;const A=e.filter(M=>M.rank===2||M.rank===3),P=e.find(M=>M.ballotId===a&&M.rank>k4)??null;return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx(Oue,{champion:E,runnersUp:A,self:P,setCode:r,cardsByName:o,ratingsByName:i,userBallotId:a,bestAchieverIds:u.bestAchieverIds}),e.length>k4&&c&&n.jsx("div",{className:"flex justify-center mt-2.5",children:n.jsxs("button",{type:"button",onClick:c,className:"group inline-flex items-center gap-2 font-mono tracking-[0.16em] text-[11px] text-subtle hover:text-text border border-border2 rounded-sm bg-surface2 hover:bg-surface px-4 py-2 transition-colors",children:["SEE FULL STANDINGS",n.jsx(EU,{size:13,className:"transition-transform group-hover:translate-y-0.5"})]})})]})}const C=u.entries.findIndex(E=>E.kind==="ballot"&&E.ballot.ballotId===a),_=C!==-1&&C<x,T=u.entries.slice(0,x);return n.jsxs("div",{className:"relative",children:[n.jsxs("div",{className:"border-t border-border2 bg-surface2",children:[n.jsx(Mue,{ballot:e.find(E=>E.ballotId===a),setCode:r,maxScore:h,cardsByName:o,ratingsByName:i,hidden:_&&b,stickyTop:d,onScrollToRow:()=>{if(m){m.scrollIntoView({behavior:"smooth",block:"center"});return}C!==-1&&(g(E=>Math.max(E,C+Fg)),N(!0))}}),T.map(E=>{if(E.kind==="synthetic")return n.jsx(Pue,{standing:E.standing,setCode:r,maxScore:h,cardsByName:o,ratingsByName:i,stickyTop:d},`synthetic-${E.standing.kind}`);const{ballot:A}=E,P=A.rank<=3?Due:Iue;return n.jsx(P,{ballot:A,setCode:r,isSelf:A.ballotId===a,maxScore:h,cardsByName:o,ratingsByName:i,rowRef:A.ballotId===a?y:void 0,stickyTop:d},A.ballotId)})]}),x<u.entries.length&&n.jsx("div",{ref:k,className:"h-px"})]})}const $ue={trap:"#ff5e5e",sleeper:"#2ee85c"},Uue={trap:"TRAP",sleeper:"SLEEPER"},zue={trap:"BEHIND THE BEST CARD",sleeper:"OVER THE CROWD FAVORITE"},Lo="#181a21",Bue=10;function Fue(e){const t=e.kind==="trap"?e.gihwr-e.slotBestGihwr:e.gihwr-e.crowdFavGihwr;return`${t<0?"−":"+"}${Math.abs(t*100).toFixed(1)}`}function N4(e){const t=Math.round(e*100);return t===0?"<1%":`${t}%`}function Wue(e){return e.length===1?e[0]:`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Hue(e){return e.kind==="trap"?n.jsxs(n.Fragment,{children:[n.jsxs("b",{className:"text-subtle font-medium",children:[e.pickCount," ",e.pickCount===1?"player":"players"," (",N4(e.pickShare),")"]})," ","picked it"]}):e.teamCount===0?n.jsxs(n.Fragment,{children:[n.jsx("b",{className:"text-subtle font-medium",children:"Everyone"})," missed it"]}):e.teamCount<=3?n.jsxs(n.Fragment,{children:["Only"," ",n.jsx("b",{className:"text-subtle font-medium",children:Wue(e.voters.map(t=>t.name))})," ","found it"]}):n.jsxs(n.Fragment,{children:[n.jsxs("b",{className:"text-subtle font-medium",children:[e.teamCount," players (",N4(e.teamShare),")"]})," ","picked it"]})}function Gue({voters:e}){const t=e.slice(0,Bue),s=e.length-t.length,r="[box-shadow:0_0_0_1.5px_#1d2330,0_0_0_2.5px_#1d2330]";
518return n.jsxs("div",{className:"flex -space-x-1.5",children:[t.map(a=>n.jsx(Hc,{name:a.name,avatarUrl:a.avatarUrl,title:a.name,className:`w-[22px] h-[22px] rounded-full shrink-0 ${r}`,fallbackClassName:`w-[22px] h-[22px] rounded-full shrink-0 bg-surface flex items-center justify-center font-mono text-[10px] text-green ${r}`},a.name)),s>0&&n.jsxs("span",{className:`w-[22px] h-[22px] rounded-full shrink-0 bg-surface flex items-center justify-center font-mono text-[9px] text-green ${r}`,children:["+",s]})]})}function C4(){return n.jsx("div",{className:"h-2",style:{backgroundImage:"radial-gradient(circle at 4px 4px, #2a3142 2.6px, transparent 3px)",backgroundSize:"22px 8px",backgroundRepeat:"repeat-x"}})}function Vue({highlight:e,index:t,cardsByName:s}){const r=s.get(e.cardName),a=$ue[e.kind],o=n.jsxs("div",{className:"relative overflow-hidden flex flex-col min-h-[150px] sm:h-full",style:{clipPath:yb,background:Lo},children:[n.jsxs("div",{className:"absolute inset-y-0 left-0 w-[168px] sm:right-0 sm:w-auto",children:[r&&n.jsx("img",{src:r.imageArtCrop,alt:`${e.cardName} art`,className:"w-full h-full sm:h-[176px] object-cover saturate-[0.72] contrast-[1.02]"}),n.jsx("div",{className:"absolute inset-0 sm:hidden",style:{background:`linear-gradient(to bottom, ${Lo} 0%, color-mix(in srgb, ${Lo} 45%, transparent) 10%, transparent 22%), linear-gradient(to top, ${Lo} 0%, transparent 14%), linear-gradient(to right, ${Lo} 0%, transparent 12%), linear-gradient(to right, transparent 40%, ${Lo} 92%)`}}),n.jsx("div",{className:"absolute inset-0 hidden sm:block",style:{background:`linear-gradient(to bottom, color-mix(in srgb, ${a} 14%, transparent) 0px, transparent 67px), linear-gradient(to bottom, transparent 53px, ${Lo} 169px)`}}),e.kind==="sleeper"&&e.voters.length>0&&n.jsx("div",{className:"absolute bottom-1.5 left-2 sm:left-auto sm:right-2 sm:bottom-auto sm:top-[150px] z-10",children:n.jsx(Gue,{voters:e.voters})})]}),n.jsxs("div",{className:"relative flex-1 flex flex-col ml-[148px] pt-3 pr-4 pb-3.5 sm:ml-0 sm:mt-[124px] sm:pt-0 sm:px-5 sm:pb-4",children:[n.jsx("span",{className:"font-display text-[17px] tracking-[0.2em] [text-shadow:0_1px_2px_#000,0_0_5px_#000a]",style:{color:a},children:Uue[e.kind]}),n.jsxs("div",{className:"font-num font-bold tabular-nums leading-none mt-2 sm:mt-1.5 text-[30px] sm:text-[38px] [text-shadow:0_1px_2px_#000,0_0_5px_#000a,var(--pp-glow)]",style:{color:a,"--pp-glow":`0 0 16px color-mix(in srgb, ${a} 30%, transparent)`},children:[Fue(e),n.jsx("span",{className:"text-[15px] sm:text-[18px]",children:"%"})]}),n.jsx("div",{className:"font-display text-[12px] tracking-[0.2em] text-subtle mt-1",children:zue[e.kind]}),n.jsx("div",{className:"font-semibold text-[15.5px] leading-tight mt-2 sm:mt-2.5 truncate",children:e.cardName}),n.jsxs("div",{className:"font-mono text-[11px] text-muted mt-0.5 truncate",children:[e.slotLabel,", ",Dw(e.gihwr)," GIH"]}),n.jsx("div",{className:"mt-2.5",children:n.jsx("p",{className:"text-[12.5px] leading-[1.45] text-subtle",children:Hue(e)})})]})]});return n.jsx("div",{className:"w-full sm:w-[240px] motion-safe:animate-fadeUpIn relative hover:z-10",style:{animationDelay:`${t*80}ms`},children:n.jsx("article",{className:"block sm:h-full transition-transform duration-150 hover:scale-[1.04]",style:{clipPath:yb,padding:1,background:`linear-gradient(165deg, ${a} 0%, color-mix(in srgb, ${a} 28%, #3b4458) 30%, #3b4458 70%, color-mix(in srgb, ${a} 22%, #3b4458) 100%)`},children:r?n.jsx(ux,{imageUrl:r.imageNormal,alt:r.name,className:"block sm:h-full",children:o}):o})})}function Kue({highlights:e,cardsByName:t}){return e.length===0?null:n.jsxs("div",{className:"flex flex-col",children:[n.jsx(wb,{title:"CARD HIGHLIGHTS"}),n.jsx("div",{className:"flex flex-col sm:flex-row sm:flex-wrap sm:justify-center gap-3.5 px-1 py-3.5 sm:px-3",children:e.map((s,r)=>n.jsx(Vue,{highlight:s,index:r,cardsByName:t},`${s.kind}-${s.slot}-${s.cardName}`))})]})}function hL({ratingsSnapshot:e,pickStats:t,ballots:s,cards:r,cardsByName:a,picksBySlot:o,user:i,hasParticipated:l,stickyTop:c=0}){const{setCode:d}=e,u=p.useMemo(()=>Ft(d),[d]),f=p.useMemo(()=>$m(e),[e]),h=p.useMemo(()=>uv(t,u,f),[t,u,f]),m=p.useMemo(()=>dv(r,u,f),[r,u,f]),y=p.useMemo(()=>{const S=RE(s);return AE(S,f)},[s,f]),b=R6(),w=p.useMemo(()=>PE(y),[y,m,b]),x=p.useMemo(()=>dG(t,s,r,u,f,_ue),[t,s,r,u,f]),g=!!i&&l,v=p.useMemo(()=>g?OE(w,o,i==null?void 0:i.discordId):null,[g,w,o,i]),k=p.useRef(null);return n.jsxs("div",{className:"flex flex-col gap-8",children:[w.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx(wb,{title:"PODIUM"}),n.jsx(S4,{rankedBallots:w,bestTeam:m,crowdTeam:h,setCode:d,userBallotId:(v==null?void 0:v.ballotId)??null,cardsByName:a,ratingsByName:f,mode:"peek",onSeeAll:()=>{var S;return(S=k.current)==null?void 0:S.scrollIntoView({behavior:"smooth"})},stickyTop:c})]}),n.jsx(C4,{}),n.jsx(Kue,{highlights:x,cardsByName:a}),n.jsx(C4,{}),w.length>0&&n.jsxs("div",{ref:k,className:"flex flex-col gap-3 pb-24",style:{scrollMarginTop:c+20},children:[n.jsx(wb,{title:"FULL STANDINGS",children:"Every player ranked alongside the best possible team and the crowd's picks"}),n.jsx(S4,{rankedBallots:w,bestTeam:m,crowdTeam:h,setCode:d,userBallotId:(v==null?void 0:v.ballotId)??null,cardsByName:a,ratingsByName:f,mode:"full",stickyTop:c})]})]})}function que({ballot:e,contests:t,contestHref:s,isCurrent:r}){const{featured:a,cards:o,cardsByName:i,dataReady:l,resultsDataReady:c,user:d,authLoading:u,signIn:f,picksBySlot:h,pickedExcept:m,pickedSlotLabels:y,scoringFilled:b,isComplete:w,isPastDeadline:x,hasParticipated:g,pickStats:v,ballotReady:k,ballotPending:S,handleClearAll:N,clearPending:C,activeSlotKey:_,activeSlot:T,setEditingSlotKey:E,selectAdvance:A,phase:P,ratingsSnapshot:M,ballots:U,contestSlots:F}=e,I=!u&&!d&&P!=="comingSoon",q=Dc(F.length)?"grid-cols-4":"grid-cols-4 landscape:grid-cols-8",O=g&&v?pf(v):void 0,H=x&&!!d&&w,B=x&&!!d&&!w,D=P==="midway",L=P!=="final";return n.jsxs("div",{className:"bg-bg text-text min-h-screen flex flex-col page-fade",children:[n.jsx(St,{subtitle:"P0 P1 Challenge",subt
518itleShort:"P0 P1"}),n.jsxs("main",{className:`flex-1 flex flex-col w-full px-3 pt-3 ${I?"pb-24":"pb-4"}`,children:[n.jsx(Jue,{featured:a,phase:P,dateRange:M==null?void 0:M.dateRange,contests:t,contestHref:s,isCurrent:r}),L&&n.jsx("div",{className:"mb-3 empty:hidden",children:S?n.jsx(oL,{compact:!0}):nL(e,!0)}),P==="comingSoon"?n.jsx("div",{className:"flex-1 flex items-center justify-center py-20",children:n.jsx("span",{className:"font-display tracking-[0.12em] text-muted text-[32px]",children:"COMING SOON"})}):l?n.jsxs(n.Fragment,{children:[!x&&n.jsx("div",{className:"mb-1.5",children:n.jsx($8,{filled:b,total:F.length,isComplete:w,doneLabel:"PICKS SAVED",doneHint:"Edit anytime before deadline"})}),!x&&n.jsx("div",{className:"sticky top-0 z-20 -mx-3 px-2 pt-3 pb-2 bg-bg/95 backdrop-blur border-b border-border",children:n.jsx("div",{className:`grid ${q} gap-1.5`,children:F.map($=>{const V=h.get($.key),z=O==null?void 0:O.get($.key),K=V&&z?z.find(W=>W.cardName===V):void 0;return n.jsx(Zue,{slot:$,card:V?i.get(V):void 0,active:_===$.key,yourStat:K,slotStats:z,onClick:()=>E($.key),setCode:a==null?void 0:a.code},$.key)})})}),P==="loading"?n.jsx(efe,{setCode:a==null?void 0:a.code}):D?c&&M&&o&&v?n.jsx(uL,{ratingsSnapshot:M,pickStats:v,cards:o,cardsByName:i,picksBySlot:h,user:d,hasParticipated:g}):null:P==="final"?c&&M&&o&&v&&U?n.jsx(hL,{ratingsSnapshot:M,pickStats:v,ballots:U,cards:o,cardsByName:i,picksBySlot:h,user:d,hasParticipated:g}):null:P==="postVoting"?v&&v.length>0&&n.jsxs(n.Fragment,{children:[k&&B&&n.jsx(Yue,{}),n.jsx(tL,{pickStats:v,cardsByName:i,picksBySlot:h,setCode:a==null?void 0:a.code,yourPicks:H?n.jsx(sL,{contestSlots:F,pickStats:v,cardsByName:i,picksBySlot:h,setCode:a==null?void 0:a.code}):null})]}):o&&n.jsx("div",{className:"pt-2",children:n.jsx(M8,{slot:T,cards:o,pickedCards:m(T.key),takenBy:y,selectedName:h.get(T.key),onSelect:$=>A(T.key,$),minColW:150,showLabel:!1,autoFocusSearch:!1,leftLabel:n.jsxs(n.Fragment,{children:[n.jsx(mo,{slotKey:T.key,size:20,setCode:a==null?void 0:a.code}),n.jsx("span",{className:"font-display text-[18px] tracking-[0.06em] truncate",children:T.label})]}),footerRight:n.jsx(U8,{onClear:N,clearing:C,visible:b>0,className:"shrink-0"})},T.key)})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"h-2 w-full bg-surface2 animate-pulse mb-3 rounded-full"}),n.jsx("div",{className:`grid ${q} gap-1.5`,children:Array.from({length:F.length},($,V)=>n.jsx("div",{className:"aspect-[5/4] landscape:aspect-auto landscape:h-14 bg-surface2 animate-pulse border border-border2"},V))})]})]}),n.jsx($6,{}),n.jsx(Que,{show:I,signIn:f,text:x?"LOG IN TO VIEW YOUR PICKS":"LOG IN TO SUBMIT PICKS"}),n.jsx(zc,{onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),compact:!0,bottomClass:I?"bottom-20":"bottom-4"})]})}function Zue({slot:e,card:t,active:s,yourStat:r,slotStats:a,onClick:o,setCode:i}){const l=dx[e.key];let c;if(r&&a){const{most:u,least:f}=mf(a);c=fx(r,u,f)}const d=(c==null?void 0:c.state)==="most"?"text-cyan":(c==null?void 0:c.state)==="rogue"?"text-magenta":"text-white";return n.jsxs("button",{type:"button",onClick:o,"aria-label":e.label,className:`relative w-full aspect-[5/4] landscape:aspect-auto landscape:h-14 bg-surface2 overflow-hidden border border-t-0 transition-colors ${s?"border-green":"border-border2"}`,children:[n.jsx("div",{className:`absolute top-0 left-0 right-0 z-10 transition-[height] duration-150 ${s?"h-2":"h-1"}`,style:{background:l}}),t?n.jsx("img",{src:t.imageArtCrop,alt:"",className:"w-full h-full object-cover"}):n.jsx("span",{className:"absolute inset-0 flex items-center justify-center",children:n.jsx(mo,{slotKey:e.key,size:20,setCode:i})}),r&&c&&n.jsx("div",{className:`absolute bottom-0 left-0 right-0 text-center font-num tabular-nums text-[10px] py-0.5 bg-bg/75 ${d}`,children:Fd(r.pickPct)})]})}function Yue(){return n.jsxs("a",{href:Zt.discord,target:"_blank",rel:"noreferrer",className:"h-7 mb-3 rounded-full bg-surface2 border border-border flex items-center justify-between gap-2 px-5 no-underline animate-fadeIn",children:[n.jsx("span",{className:"font-display text-subtle text-[13px] tracking-[0.08em] leading-none whitespace-nowrap",children:"YOU DIDN'T VOTE ON THIS ONE"}),n.jsxs("span",{className:"flex items-center gap-1.5 text-green leading-none whitespace-nowrap",children:[n.jsx(la,{size:14}),n.jsx("span",{className:"font-body text-[12px]",children:"Catch the next"})]})]})}function Que({show:e,signIn:t,text:s}){return e?n.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-40 bg-bg/95 backdrop-blur border-t border-border px-4 py-2.5 flex justify-center",children:n.jsx("button",{type:"button",onClick:t,className:"bg-transparent border-0 cursor-pointer p-0",children:n.jsx(Pw,{size:"lg",icon:n.jsx(la,{size:19}),children:s})})}):null}function Jue({featured:e,phase:t,dateRange:s,contests:r,contestHref:a,isCurrent:o}){const[i,l]=p.useState(!0),c=t!=="voting"&&t!=="comingSoon",d=(e==null?void 0:e.code)??"",u=(e==null?void 0:e.votingDeadline)??new Date,f=(e==null?void 0:e.scoringDate)??new Date,h=e==null?void 0:e.previewsOpen;return n.jsxs("section",{className:"bg-surface border border-border rounded-xl p-4 mb-3 flex flex-col gap-2.5",children:[n.jsxs("div",{className:"flex w-full items-center gap-3",children:[r&&r.length>1&&a?n.jsx(q8,{contests:r,activeCode:d,hrefFor:a,isMobile:!0}):n.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[n.jsx(Ae,{code:d,size:34}),n.jsx("span",{className:"font-display text-text tracking-[0.04em]",style:{fontSize:22,lineHeight:1},children:d})]}),n.jsx("span",{className:"flex-1 min-w-0 text-center font-display text-[16px] text-text tracking-[0.1em] truncate",children:"PACK 0, PICK 1"}),n.jsxs("button",{type:"button",onClick:()=>l(m=>!m),"aria-expanded":i,"aria-label":i?"Hide details":"Show details",className:"flex flex-col items-end gap-1 shrink-0 bg-transparent border-0 p-0 cursor-pointer",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(tfe,{deadline:u,scoringDate:f,opensAt:h,phase:t,isCurrent:o}),n.jsx(Et,{size:22,className:`shrink-0 text-muted transition-transform ${i?"":"-rotate-90"}`})]}),c&&n.jsx("div",{className:"w-full",children:n.jsx(H8,{from:u,to:f,phase:t})})]})]}),i&&n.jsx("p",{className:"text-subtle text-[13.5px] leading-[1.5]",children:n.jsx(V8,{phase:t,dateRange:s,setName:(e==null?void 0:e.name)??"",setCode:(e==null?void 0:e.code)??""})})]})}const _4=[90,75,85,65,80,120,100,110,130],T4=[120,100,110,95,105,130,115,125,140];function Xue({setCode:e=""}){return n.jsx("div",{className:"flex flex-col gap-1.5",children:Array.from({length:Ft(e).length},(t,s)=>n.jsxs("div",{className:"w-full flex items-center gap-4 px-4 py-3 bg-surface border border-border2",children:[n.jsx("div",{className:"w-20 h-12 bg-surface2 animate-pulse shrink-0"}),n.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[n.jsx("div",{className:"h-2 bg-surface2 animate-pulse",style:{width:_4[s%_4.length]}}),n.jsx("div",{className:"h-3 bg-surface2 animate-pulse",style:{width:T4[s%T4.length]}})]})]},s))})}function efe({setCode:e=""}){return n.jsxs("div",{className:"flex flex-col gap-3 mt-3",children:[n.jsxs("div",{className:"flex flex-col items-center gap-2",children:[n.jsx("div",{className:"h-4 w-40 bg-surface2 animate-pulse"}),n.jsx("div",{className:"h-3 w-56 bg-surface2 animate-pulse"})]}),n.jsx(Xue,{setCode:e})]})}function tfe({deadline:e,scoringDate:t,opensAt:s,phase:r,isCurrent:a}){nf(3e4);const o=wi(),i=e.getTime()-o;if(r==="comingSoon")return n.jsxs("div",{className:"flex flex-col items-end leading-tight whitespace-nowrap shrink-0",children:[n.jsx("span",{className:"text-muted text-[11px] tracking-[0.04em]",children:"Opens"}),n.jsx("span",{className:"text-green text-[13px]",children:F8(s??e)})]});if(r==="voting")return n.jsxs("div",{className:"flex flex-col items-end leading-tight whitespace-nowrap shrink-0",children:[n.jsx("span",{className:"text-muted text-[11px] tracking-[0.04em]",children:"Closes in"}),n.jsx("span",{className:"text-green text-[13px]",children:z8(i)})]});if(r==="loading")return n.jsx("div",{className:"flex flex-col items-end leading-tight whitespace-nowrap shrink-0",children:n.jsx("span",{className:"inline-block h-[13px] w-24 bg-surface2 animate-pulse"})});if(r==="final"){const l=!a&&t;return n.jsx("div",{className:"flex flex-col items-end leading-tight whitespace-nowrap shrink-0",children:n.jsx("span",{className:`text-green ${l?"text-[11px]":"text-[13px]"}`,children:l?B8(t):"Results are in!"})})}if(t){const l=t.getTime()-o;if(l>0)return n.jsxs("div",{className:"flex flex-col items-end leading-tight whitespace-nowrap shrink-0",children:[n.jsx("span",{className:"text-muted text-[11px] tracking-[0.04em]",children:"Results in"}),n.jsx("span",{className:"text-green text-[13px]",children:W8(l)}
518)]})}return n.jsxs("div",{className:"flex flex-col items-end leading-tight whitespace-nowrap shrink-0",children:[n.jsx("span",{className:"text-muted text-[11px] tracking-[0.04em]",children:"Entries"}),n.jsx("span",{className:"text-muted text-[13px]",children:"have closed"})]})}function E4(){return null}const R4="".split(",").map(e=>e.trim()).filter(Boolean),sfe={Noya:"237762740532412416",queueknee:"232809189645221888"},nfe=Object.values(sfe),rfe=R4.length>0?R4:nfe;function afe(e){return!!e&&rfe.includes(e)}function ofe({expanded:e,onToggle:t,className:s=""}){return n.jsxs("button",{type:"button",onClick:t,"aria-expanded":e,className:`flex items-center gap-1 bg-transparent border-0 p-0 cursor-pointer text-subtle hover:text-green font-display text-[13px] tracking-[0.1em] whitespace-nowrap ${s}`,children:[e?n.jsx(Yy,{size:17}):n.jsx(fs,{size:17}),e?"COLLAPSE":"EXPAND"]})}function A4(){const{setCode:e}=cn(),t=kJ(e),{featured:s,cards:r,cardsByName:a,dataReady:o,resultsDataReady:i,user:l,authLoading:c,signIn:d,picksBySlot:u,pickedExcept:f,pickedSlotLabels:h,scoringFilled:m,isComplete:y,isPastDeadline:b,hasParticipated:w,pickStats:x,ballotPending:g,handleClearAll:v,clearPending:k,setEditingSlotKey:S,activeSlotKey:N,activeSlot:C,selectAdvance:_,phase:T,ratingsSnapshot:E,ballots:A,contestSlots:P}=t,{user:M}=Qn(),U=afe(M==null?void 0:M.discordId),F=LE(wi(s==null?void 0:s.scoringDate)),I=!F||!s||F.code===s.code,q=bG(wi(s==null?void 0:s.scoringDate)),O=U?q:q.filter(Ie=>Ie.status!=="pre"),H=Ie=>F&&Ie===F.code?"/p0p1":`/p0p1/${Ie.toLowerCase()}`,B=!ut(1024),D=p.useRef(null),L=p.useRef(null),[$,V]=p.useState(0),[z,K]=p.useState(!1),[W,J]=p.useState(!1);if(p.useEffect(()=>{const Ie=D.current;if(!Ie)return;const _e=()=>V(Ie.getBoundingClientRect().height);_e();const We=new ResizeObserver(_e);return We.observe(Ie),()=>We.disconnect()},[]),p.useEffect(()=>{const Ie=L.current;if(!Ie)return;const _e=new IntersectionObserver(([We])=>J(We.intersectionRatio<1),{threshold:[1],rootMargin:`-${Math.round($)+1}px 0px 0px 0px`});return _e.observe(Ie),()=>_e.disconnect()},[$]),p.useEffect(()=>{if(!r)return;const Ie=r.map(_e=>{const We=new Image;return We.src=_e.imageArtCrop,We});return()=>Ie.forEach(_e=>{_e.src=""})},[r]),!s)return n.jsx(pb,{});if(s.status==="pre"&&!s.comingSoon&&!U)return c?n.jsx("div",{className:"bg-bg min-h-screen"}):n.jsx(pb,{});const Z=b&&!!l&&y,Y=b&&!!l&&!y;if(!B)return n.jsxs(n.Fragment,{children:[n.jsx(que,{ballot:t,contests:O,contestHref:H,isCurrent:I}),n.jsx(E4,{})]});if(T==="comingSoon")return n.jsxs("div",{className:"bg-bg text-text min-h-screen flex flex-col page-fade",children:[n.jsx(St,{subtitle:"P0 P1 Challenge",subtitleShort:"P0 P1"}),n.jsx(h4,{featured:s,contests:O,contestHref:H,innerRef:D,cta:null,belowIntro:n.jsx(K8,{next:{code:s.code,name:s.name,previewsOpen:s.previewsOpen},showSet:!1}),phase:T,isCurrent:I}),n.jsx("main",{className:"flex-1 flex items-center justify-center px-10 py-24",children:n.jsx("span",{className:"font-display tracking-[0.12em] text-muted",style:{fontSize:48},children:"COMING SOON"})})]});const ae=!c&&!l&&n.jsx("button",{type:"button",onClick:d,className:"bg-transparent border-0 cursor-pointer p-0",children:n.jsx(Pw,{size:"lg",icon:n.jsx(la,{size:19}),children:b?n.jsx(n.Fragment,{children:"LOG IN TO VIEW YOUR PICKS"}):n.jsx(n.Fragment,{children:"LOG IN TO SUBMIT PICKS"})})}),pe=T==="midway",ye=nL(t),De=Y?n.jsx(ife,{}):null,Fe=g?n.jsx(oL,{setCode:(s==null?void 0:s.code)??""}):ae||(l&&!b?n.jsx(Mde,{complete:y}):null)||ye||De,tt=Dc(P.length),st=tt&&!z,ie=Ie=>n.jsx(ofe,{expanded:z,onToggle:()=>K(_e=>!_e),className:`absolute left-1/2 ${Ie} -translate-x-1/2 z-10`});let Se=null;return b?T==="postVoting"&&tt&&(Se=n.jsx("div",{className:"relative w-full",children:ie("top-2")})):Se=n.jsxs("div",{className:"relative flex items-center gap-3 w-full max-w-[420px]",children:[n.jsx(Xe,{size:13,children:"PICKS"}),n.jsx("div",{className:"flex-1",children:n.jsx($8,{filled:m,total:P.length,isComplete:y})}),tt&&ie("top-full")]}),n.jsxs("div",{className:"bg-bg text-text min-h-screen flex flex-col page-fade",children:[n.jsx(St,{subtitle:"P0 P1 Challenge",subt
518itleShort:"P0 P1"}),s&&n.jsx(h4,{featured:s,contests:O,contestHref:H,innerRef:D,cta:Fe,belowIntro:Se,phase:T,dateRange:E==null?void 0:E.dateRange,isCurrent:I}),n.jsxs("main",{className:"flex-1 px-5 pt-5",children:[!b&&(o?n.jsx("div",{ref:L,className:`-mx-5 px-5 mb-3 bg-bg/95 border-b border-border ${z?"relative pb-5":`sticky z-20 ${W?"pb-2":"pb-5"} backdrop-blur`}`,style:z?void 0:{top:$},children:n.jsx(lfe,{expanded:z,activeSlotKey:N,picksBySlot:u,cardsByName:a,setCode:s==null?void 0:s.code,onSelect:Ie=>S(Ie)})}):n.jsx(dfe,{setCode:s==null?void 0:s.code})),T==="loading"?n.jsx(Wg,{setCode:s==null?void 0:s.code}):pe?i&&E&&r&&x?n.jsx(uL,{ratingsSnapshot:E,pickStats:x,cards:r,cardsByName:a,picksBySlot:u,user:l,hasParticipated:w}):n.jsx(Wg,{setCode:s==null?void 0:s.code}):T==="final"?i&&E&&r&&x&&A?n.jsx(hL,{ratingsSnapshot:E,pickStats:x,ballots:A,cards:r,cardsByName:a,picksBySlot:u,user:l,hasParticipated:w,stickyTop:$}):n.jsx(Wg,{setCode:s==null?void 0:s.code}):T==="postVoting"?x&&x.length>0&&n.jsx(tL,{pickStats:x,cardsByName:a,picksBySlot:u,setCode:s==null?void 0:s.code,compact:st,yourPicks:Z?n.jsx(sL,{contestSlots:P,pickStats:x,cardsByName:a,picksBySlot:u,setCode:s==null?void 0:s.code,compact:st}):null}):n.jsx("div",{className:"mt-4",children:o&&r?n.jsx(OA,{transitionKey:C.key,children:n.jsx(M8,{animateMount:!1,slot:C,cards:r,pickedCards:f(C.key),takenBy:h,selectedName:u.get(C.key),onSelect:Ie=>_(C.key,Ie),minColW:200,setCode:s==null?void 0:s.code,footerRight:n.jsx(U8,{onClear:v,clearing:k,visible:m>0,className:"shrink-0"})},C.key)}):n.jsx(ufe,{})})]}),n.jsx(zc,{onClick:()=>window.scrollTo({top:0,behavior:"smooth"})}),n.jsx(E4,{})]})}function ife(){return n.jsxs(Du,{compact:!1,animate:!0,children:[n.jsx("span",{className:"font-display text-text leading-none tracking-[0.04em]",style:{fontSize:22},children:"YOU DIDN'T VOTE ON THIS ONE"}),n.jsxs("p",{className:"font-body text-subtle text-[12px] leading-snug",children:[n.jsx("a",{href:Zt.discord,target:"_blank",rel:"noreferrer",className:"text-green hover:text-green-2 underline underline-offset-2",children:"Check the Dischord"})," ","to catch the next challenge"]})]})}function lfe({activeSlotKey:e,picksBySlot:t,cardsByName:s,setCode:r,expanded:a,onSelect:o}){const i=Ft(r??""),l=Dc(i.length),c=l&&!a,d=l?a?"grid-cols-6":"grid-cols-12":"grid-cols-8";return n.jsx("div",{className:`grid ${d} gap-2`,children:i.map(u=>{const f=t.get(u.key);return n.jsx(cfe,{slot:u,card:f?s.get(f):void 0,active:e===u.key,setCode:r,compact:c,onClick:()=>o(u.key)},u.key)})})}function cfe({slot:e,card:t,active:s,setCode:r,compact:a=!1,onClick:o}){const i=dx[e.key],l=e.label.toUpperCase(),c=t?(t.manaCost.match(/\{/g)??[]).length:0,d=c>=5?8:c===4?9:c===3?10:11;return n.jsxs("button",{type:"button",onClick:o,className:`group relative flex flex-col aspect-square border border-t-0 overflow-hidden text-left min-w-0 transition-all duration-150 cursor-pointer hover:z-10 hover:scale-[1.04] ${s?"border-green/60 bg-green/5 z-10 scale-[1.04]":"border-border2 bg-surface hover:border-border"}`,children:[n.jsx("div",{className:`w-full shrink-0 transition-[height] duration-150 ${s?"h-2":"h-[4px] group-hover:h-2"}`,style:{background:i}}),n.jsx("div",{className:"relative flex-1 min-h-0 bg-surface2 flex items-center justify-center overflow-hidden",children:t?n.jsx("img",{src:t.imageArtCrop,alt:t.name,className:"w-full h-full object-cover"}):n.jsxs(n.Fragment,{children:[n.jsx(mo,{slotKey:e.key,size:a?34:48,setCode:r}),a&&n.jsx("span",{className:"absolute inset-x-0 bottom-1.5 px-1 text-muted text-[14px] tracking-[0.08em] font-display text-center leading-tight",children:l})]})}),!a&&n.jsxs("div",{className:"px-2 pt-2 pb-1.5 shrink-0",children:[n.jsx("div",{className:"text-subtle text-[13px] tracking-[0.1em] font-display truncate min-w-0 mb-1",children:l}),t?n.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[n.jsx("span",{className:"text-text text-[14px] truncate min-w-0",children:t.name}),n.jsx("span",{className:"ml-auto shrink-0",children:n.jsx(lf,{cost:t.manaCost,size:d})})]}):n.jsx("span",{className:"italic text-dim text-[13px]",children:"Select a card"})]})]})}function pL(){return n.jsxs("div",{className:"flex flex-col aspect-square border-t-0 bg-surface border border-border2",children:[n.jsx("div",{className:"h-1 w-full bg-surface2"}),n.jsx("div",{className:"flex-1 min-h-0 bg-surface2 animate-pulse"}
518),n.jsxs("div",{className:"px-2.5 py-1.5 shrink-0 flex flex-col gap-1",children:[n.jsx("div",{className:"h-2 w-12 bg-surface2 animate-pulse"}),n.jsx("div",{className:"h-2.5 w-16 bg-surface2 animate-pulse"})]})]})}function dfe({setCode:e=""}){const t=Ft(e);return n.jsx("div",{className:`grid ${Dc(t.length)?"grid-cols-6":"grid-cols-8"} gap-2`,children:Array.from({length:t.length},(s,r)=>n.jsx(pL,{},r))})}function Wg({setCode:e=""}){const t=Ft(e);return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsxs("div",{className:"flex flex-col items-center gap-2",children:[n.jsx("div",{className:"h-5 w-52 bg-surface2 animate-pulse"}),n.jsx("div",{className:"h-3 w-72 bg-surface2 animate-pulse"})]}),n.jsx("div",{className:`grid ${Dc(t.length)?"grid-cols-6":"grid-cols-8"} gap-2`,children:Array.from({length:t.length},(s,r)=>n.jsx(pL,{},r))})]})}function ufe(){return n.jsxs("div",{children:[n.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-center gap-2 mb-3",children:[n.jsx("div",{}),n.jsx("div",{className:"h-6 w-56 bg-surface2 animate-pulse"}),n.jsx("div",{className:"ml-auto h-7 w-60 bg-surface2 animate-pulse"})]}),n.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(200px,1fr))] gap-3.5",children:Array.from({length:10},(e,t)=>n.jsx("div",{className:"bg-surface2 animate-pulse rounded-[3%]",style:{aspectRatio:"488 / 680"}},t))})]})}function Ko({rarity:e,size:t}){const s=`/wildcards/${e}.webp`;return n.jsx("img",{src:s,alt:`${e} wildcard`,style:{height:t},className:"shrink-0 w-auto"})}const ffe=250,Mw=4,mL={common:"Commons",uncommon:"Uncommons",rare:"Rares",mythic:"Mythics"};function $w(e){return`${e.setCode} ${xL(e)}`}function xL(e){const t=e.parts>1?` ${e.part}`:"";return`${e.group}${t}`}function gL(e){return e.cards.length*Mw}function hfe(e){const t=["About",`Name ${$w(e)}`,"","Deck"];for(const s of e.cards)t.push(`${Mw} ${s.name} (${e.setCode}) ${s.collectorNumber}`);return t.join(`
519`)}function pfe(e,t){const s=mfe(t),r=[];for(const[a,o]of Object.entries(mL))r.push(...gfe(e,a,o,s.filter(i=>i.rarity===a)));return r}function mfe(e){const t=[];for(const s of[...e].sort(Bne))s.rarity in mL&&t.push({name:xfe(s),collectorNumber:s.collectorNumber,rarity:s.rarity});return t}function xfe(e){return e.layout==="split"?e.name:e.name.split(" // ")[0]}function gfe(e,t,s,r){if(r.length===0)return[];const a=Math.floor(ffe/Mw),o=Math.ceil(r.length/a),i=Math.floor(r.length/o),l=r.length%o,c=[];let d=0;for(let u=0;u<o;u++){const f=d+i+(u<l?1:0);c.push({setCode:e,rarity:t,group:s,part:u+1,parts:o,cards:r.slice(d,f)}),d=f}return c}function bfe(e){const{data:t,isPending:s,isError:r}=AP(e);return{lists:p.useMemo(()=>t?pfe(e,t.cards):[],[e,t]),isPending:s,isError:r}}function P4(){var f,h;const t=[{label:"Copy a list",shortLabel:"Copy",icon:n.jsx(MT,{size:16,strokeWidth:2.25,className:"shrink-0 text-text"})},{label:"Import in Arena",shortLabel:"Import",icon:n.jsx("img",{src:"/platforms/mtga.png",alt:"",className:"h-4 w-auto shrink-0"})},{label:"Craft All",shortLabel:"Craft All",icon:n.jsx(Ko,{rarity:"rare",size:16})}],{data:s}=un(),{setCode:r}=cn(),a=ut(),o=p.useMemo(()=>jfe(s),[s]),i=(r==null?void 0:r.toUpperCase())??((f=o[0])==null?void 0:f.code)??_s,l=o.find(m=>m.code===i),{lists:c,isPending:d,isError:u}=bfe(i);return n.jsx($c,{subtitle:"TOOLS",children:n.jsxs("div",{className:"w-full px-2 md:px-[15px] pt-2 md:pt-3 pb-10 [--craft-chrome:340px]",children:[n.jsxs("div",{className:j("flex flex-col gap-2.5","lg:grid lg:grid-cols-[auto_minmax(0,1fr)_auto] lg:items-center lg:gap-x-6"),children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-2 min-w-0",children:[n.jsxs("div",{className:"flex flex-col min-w-0 shrink-0",children:[n.jsx("div",{className:"font-display tracking-[0.12em] flex items-center leading-none min-w-0",children:n.jsx(ku,{sets:o,activeCode:i,glyphCode:i,label:((h=l==null?void 0:l.name)==null?void 0:h.toUpperCase())??i,isMobile:a,loading:!s,hrefFor:m=>`/tools/craft/${m}`})}),n.jsx("h1",{className:"mt-1 pl-[2px] font-mono text-[11px] tracking-[0.16em] text-muted",children:"BULK CRAFTING DECK LISTS"})]}),c&&c.length>0&&n.jsx("div",{className:j("md:hidden ml-auto basis-1/3 shrink-0 grid grid-cols-2 justify-items-center gap-y-1.5","rounded-xl border border-border bg-surface py-2"),children:n.jsx(O4,{lists:c})})]}),n.jsx("ol",{className:"flex w-full rounded-xl border border-border bg-surface md:w-fit lg:justify-self-center",children:t.map((m,y)=>n.jsxs("li",{className:j("flex flex-1 items-center justify-center gap-2 px-2.5 py-2.5 md:flex-none md:gap-2.5 md:px-5","border-border [&:not(:first-child)]:border-l"),children:[n.jsx("span",{className:"font-display text-green text-[18px] md:text-[20px] leading-none",children:y+1}),n.jsxs("span",{className:j("font-display text-text tracking-[0.06em] leading-none uppercase","text-[15px] md:text-[17px]"),children:[n.jsx("span",{className:"md:hidden",children:m.shortLabel}),n.jsx("span",{className:"hidden md:inline",children:m.label})]}),m.icon]},m.label))}),n.jsxs("div",{className:"hidden min-[1250px]:flex flex-col items-end gap-1.5 text-right text-[13px] leading-tight",children:[n.jsx("span",{className:"text-subtle",children:"More wildcards than you know 
519what to do with?"}),n.jsx("span",{className:"text-muted",children:"Lists split to fit the 250-card deck limit"}),c&&c.length>0&&n.jsx("div",{className:"flex items-center gap-x-5 rounded-xl border border-border bg-surface px-3 py-[3px]",children:n.jsx(O4,{lists:c})})]})]}),n.jsx("div",{className:"mt-4 md:mt-3",children:RP(i)?d?n.jsx(vfe,{}):u?n.jsx(Hg,{text:"Scryfall is unavailable right now. Try again later"}):c.length===0?n.jsx(Hg,{text:`Scryfall has no MTG Arena cards for ${i} yet`}):n.jsx(n.Fragment,{children:n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-3 items-start",children:bL(c).map(m=>n.jsx("div",{className:"flex flex-col gap-3 min-w-0",children:m.map(y=>n.jsx(yfe,{list:y,startExpanded:y===c.at(-1)},$w(y)))},m[0].rarity))})}):n.jsx(Hg,{text:`No set with the code ${i}`})})]})})}function yfe({list:e,startExpanded:t}){const s=$w(e),r=hfe(e),a=ut(),[o,i]=p.useState(t),l=!a||o,c=n.jsxs(n.Fragment,{children:[n.jsx(N6,{code:e.setCode,rarity:e.rarity,size:26}),n.jsx("span",{className:"font-display tracking-[0.12em] text-[17px] leading-none truncate",children:xL(e).toUpperCase()})]});return n.jsxs("div",{className:"flex flex-col border border-border bg-surface min-w-0",children:[n.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-2 px-4 py-2.5",children:[a?n.jsxs("button",{type:"button",onClick:()=>i(d=>!d),"aria-expanded":o,className:"flex items-center gap-2 min-w-0 text-left cursor-pointer",children:[c,n.jsx(rc,{size:16,strokeWidth:2.5,className:j("shrink-0 text-muted transition-transform",o&&"rotate-90")})]}):n.jsx("div",{className:"flex items-center gap-2 min-w-0",children:c}),n.jsxs("span",{className:"flex items-center gap-1 text-subtle text-[13px] leading-none",children:[n.jsx(Ko,{rarity:e.rarity,size:16}),gL(e)]}),n.jsx(ZP,{text:()=>r,label:"COPY",ariaLabel:`Copy ${s} to clipboard`,className:"justify-self-end"})]}),l&&n.jsx("div",{className:"bg-bg border-t border-border px-4 py-2.5",children:n.jsx("pre",{className:j("font-mono text-[12px] leading-[1.6] text-subtle whitespace-pre select-all overflow-auto","[scrollbar-width:thin] max-h-[240px] xl:max-h-[max(8rem,calc((100vh-var(--craft-chrome))/2))]"),children:r})})]})}function O4({lists:e}){return n.jsx(n.Fragment,{children:bL(e).map(t=>{let s=0;for(const r of t)s+=gL(r);return n.jsxs("span",{className:"flex items-center gap-1 tracking-normal text-subtle text-[13px]",children:[n.jsx(Ko,{rarity:t[0].rarity,size:16}),s]},t[0].rarity)})})}function bL(e){const t=new Map;for(const s of e){const r=t.get(s.rarity)??[];r.push(s),t.set(s.rarity,r)}return[...t.values()]}function Hg({text:e}){return n.jsx("p",{className:"py-16 text-center text-muted text-[14px]",children:e})}function vfe(){const e=[2,2,1,1];return n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-3 items-start","aria-label":"Loading lists",children:e.map((t,s)=>n.jsx("div",{className:"flex flex-col gap-3 min-w-0",children:Array.from({length:t},(r,a)=>n.jsx(wfe,{},a))},s))})}function wfe(){const e=["w-1/4","w-1/2","w-0","w-1/4","w-3/4","w-2/3","w-4/5","w-1/2","w-3/5","w-2/3","w-1/2","w-3/4"];return n.jsxs("div",{className:"flex flex-col border border-border bg-surface",children:[n.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-2 px-4 py-2.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"h-[26px] w-[26px] shrink-0 rounded-full bg-surface2 animate-pulse"}),n.jsx("span",{className:"h-3.5 w-24 bg-surface2 animate-pulse"})]}),n.jsx("span",{className:"h-3 w-12 bg-surface2 animate-pulse"}),n.jsx("span",{className:"justify-self-end h-7 w-[72px] rounded-full bg-surface2 animate-pulse"})]}),n.jsx("div",{className:"bg-bg border-t border-border px-4 py-2.5",children:n.jsx("div",{className:j("flex flex-col gap-[7.2px] overflow-hidden","h-[240px] xl:h-[max(8rem,calc((100vh-var(--craft-chrome))/2))]"),children:e.map((t,s)=>n.jsx("span",{className:j("h-3 shrink-0 bg-surface2 animate-pulse",t)},s))})})]})}function jfe(e){const t=new Set(["CHAOS"]),s=(e??[]).filter(o=>!ds(o.code)&&!t.has(o.code)),r=new Set(s.map(o=>o.code)),a=[];for(const[o,i]of Object.entries(Lc))r.has(o)||Date.parse(i.previewsOpen)>Date.now()||a.push({code:o,name:i.name,startDate:i.release.slice(0,10),endDate:"",isActive:!1});return[...a,...s].sort((o,i)=>i.startDate.localeCompare(o.startDate))}function kfe(){const t=[{title:"Bulk Crafting",blurb:"Importable deck lists to craft a whole set in a few clicks",Icon:UT,to:"/tools/craft",extra:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Ko,{rarity:"common",size:22}),n.jsx(Ko,{rarity:"uncommon",size:22}),n.jsx(Ko,{rarity:"rare",size:22}),n.jsx(Ko,{rarity:"mythic",size:22})]})},{title:"Event EV",blurb:"Expected gems and packs per event at your win rate",Icon:iz},{title:"Set Completion",blurb:"Packs and wildcards left to complete a set",Icon:Ph}];return n.jsx($c,{subtitle:"TOOLS",children:n.jsx(Fp,{className:"pt-4 sm:pt-6 lg:pt-10 pb-10",children:n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4 md:gap-5",children:t.map(s=>n.jsx(Sfe,{tool:s},s.title))})})})}function Sfe({tool:e}){const t=!!e.to;return n.jsx(ew,{href:e.to,watermark:e.Icon,watermarkClassName:j("opacity-30",t&&"transition-[opacity,color] duration-300 group-hover:opacity-100 group-hover:text-green/[0.14]"),className:j("min-h-[190p
519x]",!t&&"opacity-60"),children:n.jsxs("div",{className:"relative flex flex-1 flex-col gap-4 p-6",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(e.Icon,{size:26,className:j("shrink-0 text-subtle",t&&"transition-colors group-hover:text-green")}),n.jsx("span",{className:j("font-display text-text text-[26px] leading-[0.95] tracking-[0.03em]",t&&"transition-colors group-hover:text-green"),children:e.title})]}),n.jsx("p",{className:"text-subtle text-[14px] leading-[1.55] max-w-[340px]",children:e.blurb}),n.jsxs("div",{className:"mt-auto flex items-end justify-between gap-3",children:[e.extra??n.jsx("span",{}),t?n.jsxs("span",{className:"inline-flex items-center gap-1.5 font-display text-[15px] tracking-[0.08em] text-green",children:["OPEN",n.jsx(Jt,{size:15})]}):n.jsx("span",{className:"font-display text-[13px] tracking-[0.18em] text-muted",children:"COMING SOON"})]})]})})}const Nfe=["HOME","EPISODES","LEADERBOARD","TIER LIST"],Cfe=["P0 P1","EPISODES","TIER LIST","LEADERBOARD"];function _fe({section:e}){return n.jsx("nav",{className:"flex gap-2 font-display text-[19px] tracking-[0.14em]",children:Cfe.map(t=>n.jsx("span",{className:j("py-2.5 px-5 border whitespace-nowrap",t===e?"bg-green text-bg border-green":"text-text border-transparent"),children:t},t))})}function Tfe(){return n.jsx("span",{className:"w-11 h-11 border border-border2 text-muted flex items-center justify-center shrink-0",children:n.jsx("span",{className:"text-[28px] leading-none",children:"≡"})})}function Efe({section:e,mobile:t}){return t?n.jsxs("div",{className:"flex items-center gap-3 pl-1",children:[n.jsx(yr,{size:40}),n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("span",{className:"font-display text-text text-[18px] tracking-[0.07em] leading-none",children:"LIMITED LEVEL-UPS"}),n.jsx("span",{className:"w-px h-4 bg-border2"}),n.jsx("span",{className:"font-display text-green text-[15px] tracking-[0.14em] leading-none",children:e})]})]}):n.jsxs("div",{className:"flex items-center gap-6",children:[n.jsx(yr,{size:55}),n.jsxs("div",{className:"flex items-center gap-5",children:[n.jsx("span",{className:"font-display text-text text-[27px] tracking-[0.09em] leading-none",children:"LIMITED LEVEL-UPS"}),n.jsx("span",{className:"w-px h-7 bg-border2"}),n.jsx("span",{className:"font-display text-green text-[27px] tracking-[0.18em] leading-none",children:e})]})]})}function Rfe({section:e,mobile:t}){return t?n.jsxs("div",{className:"flex items-center gap-3 pl-1",children:[n.jsx(yr,{size:40}),n.jsxs("div",{className:"flex flex-col justify-center",children:[n.jsx("span",{className:"font-mono text-muted text-[8px] tracking-[0.28em] leading-none mb-1",children:"LIMITEDLEVELUPS"}),n.jsx("span",{className:"font-display text-green text-[20px] tracking-[0.1em] leading-none",children:e})]})]}):n.jsxs("div",{className:"flex items-center gap-6",children:[n.jsx(yr,{size:55}),n.jsxs("div",{className:"flex flex-col justify-center",children:[n.jsx("span",{className:"font-mono text-muted text-[10px] tracking-[0.3em] leading-none mb-1.5",children:"LIMITEDLEVELUPS.COM"}),n.jsx("span",{className:"font-display text-green text-[31px] tracking-[0.08em] leading-none",children:e})]})]})}function Afe({section:e,mobile:t}){return t?n.jsxs("div",{className:"flex items-center gap-3 pl-1",children:[n.jsx(yr,{size:40}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"font-display text-text text-[18px] leading-[0.95] tracking-[0.08em]",children:"LIMITED LEVEL-UPS"}),n.jsx("span",{className:"font-display text-green text-[11px] tracking-[0.22em] leading-none mt-[3px]",children:e})]})]}):n.jsxs("div",{className:"flex items-center gap-6",children:[n.jsx(yr,{size:55}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"font-display text-text text-[26px] leading-[0.95] tracking-[0.09em]",children:"LIMITED LEVEL-UPS"}),n.jsx("span",{className:"font-display text-green text-[14px] tracking-[0.28em] leading-none mt-1",children:e})]})]})}function Pfe({section:e,mobile:t}){return t?n.jsxs("div",{className:"flex items-center gap-2.5 pl-1",children:[n.jsx(yr,{size:40}),n.jsx("span",{className:"font-display text-text text-[18px] tracking-[0.07em] leading-none",children:"LIMITED LEVEL-UPS"}),n.jsx("span",{className:"font-display text-green border border-green/50 px-2 py-0.5 text-[12px] tracking-[0.14em] leading-none",children:e})]}):n.jsxs("div",{className:"flex items-center gap-5",children:[n.jsx(yr,{size:55}),n.jsx("span",{className:"font-display text-text text-[27px] tracking-[0.09em] leading-none",children:"LIMITED LEVEL-UPS"}),n.jsx("span",{className:"font-display text-green border border-green/50 px-2.5 py-1 text-[15px] tracking-[0.18em] leading-none",children:e})]})}const Ofe=[{key:"A",title:"Lockup + rule",note:"Brand and section as siblings split by a vertical hairline. The rule encodes the brand→location relationship instead of decorating it.",render:Efe}
519,{key:"B",title:"Section-first",note:"The logo carries the name; a quiet mono eyebrow keeps it present; the section becomes the hero. Kills the repeated-wordmark redundancy.",render:Rfe},{key:"C",title:"Refined stack",note:"Today's two-line stack, retuned: tighter proportions and open tracking on the green section label.",render:Afe},{key:"D",title:"Section tag",note:"Section rendered as an outlined green chip, echoing the app's existing CategoryTag vernacular.",render:Pfe}];function Lfe({children:e,section:t}){return n.jsxs("header",{className:"border-b border-border flex items-center justify-between bg-bg py-4 pl-10 pr-6",children:[e,n.jsx(_fe,{section:t})]})}function Dfe({children:e}){return n.jsxs("header",{className:"border-b border-border flex items-center justify-between bg-bg py-1.5 px-3",children:[e,n.jsx(Tfe,{})]})}function Ife(){const[e,t]=p.useState("EPISODES");return n.jsx("div",{className:"min-h-screen bg-bg text-text font-body",children:n.jsxs("div",{className:"max-w-[1200px] mx-auto px-6 py-10",children:[n.jsxs("div",{className:"flex items-baseline justify-between flex-wrap gap-4 mb-2",children:[n.jsx("h1",{className:"font-display text-[40px] tracking-[0.06em] leading-none",children:"HEADER / BANNER LAB"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"font-mono text-[11px] text-muted tracking-[0.2em] mr-1",children:"SECTION"}),Nfe.map(s=>n.jsx("button",{type:"button",onClick:()=>t(s),className:j("font-display text-[14px] tracking-[0.14em] px-3 py-1.5 border transition-colors",s===e?"bg-green text-bg border-green":"text-subtle border-border hover:border-border2"),children:s},s))]})]}),n.jsx("p",{className:"text-muted text-sm mb-12 max-w-[680px]",children:"Four header treatments at desktop and mobile width. The logo badge already says LIMITED LEVEL-UPS, so each direction handles the repeated wordmark differently. Switch the active section above to see how each holds up."}),n.jsx("div",{className:"flex flex-col gap-16",children:Ofe.map(s=>n.jsxs("section",{children:[n.jsxs("div",{className:"flex items-baseline gap-3 mb-1",children:[n.jsx("span",{className:"font-display text-green text-[22px] tracking-[0.1em] leading-none",children:s.key}),n.jsx("h2",{className:"font-display text-text text-[22px] tracking-[0.08em] leading-none",children:s.title})]}),n.jsx("p",{className:"text-muted text-sm mb-5 max-w-[680px]",children:s.note}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_390px] gap-6 items-start",children:[n.jsxs("div",{children:[n.jsx("span",{className:"font-mono text-[10px] text-dim tracking-[0.25em] block mb-2",children:"DESKTOP"}),n.jsx("div",{className:"border border-border2 overflow-hidden",children:n.jsx(Lfe,{section:e,children:n.jsx(s.render,{section:e})})})]}),n.jsxs("div",{children:[n.jsx("span",{className:"font-mono text-[10px] text-dim tracking-[0.25em] block mb-2",children:"MOBILE · 390"}),n.jsx("div",{className:"border border-border2 overflow-hidden w-[390px] max-w-full",children:n.jsx(Dfe,{children:n.jsx(s.render,{section:e,mobile:!0})})})]})]})]},s.key))})]})})}function Mfe(){return p.useEffect(()=>{fne()},[]),n.jsxs(gU,{delayDuration:150,skipDelayDuration:0,disableHoverableContent:!0,children:[n.jsx(SY,{}),n.jsxs(UM,{children:[n.jsx(Ze,{path:"/",element:n.jsx(hee,{})}),n.jsx(Ze,{path:"/episodes",element:n.jsx(xg,{})}),n.jsx(Ze,{path:"/episodes/:categorySlug",element:n.jsx(xg,{})}),n.jsx(Ze,{path:"/episodes/:categorySlug/:episodeSlug",element:n.jsx(xg,{})}),n.jsx(Ze,{path:"/community",element:n.jsx(mse,{})}),n.jsx(Ze,{path:"/leaderboard",element:n.jsx(YS,{})}),n.jsx(Ze,{path:"/leaderboard/about",element:n.jsx(jce,{})}),n.jsx(Ze,{path:"/leaderboard/:setCode",element:n.jsx(YS,{})}),n.jsx(Ze,{path:"/player/:slug",element:n.jsx(Cg,{})}),n.jsx(Ze,{path:"/player/:slug/:setCode",element:n.jsx(Cg,{})}),n.jsx(Ze,{path:"/player/:slug/:setCode/:trackerTab",element:n.jsx(Cg,{})}),n.jsx(Ze,{path:"/leaderboard/player/:slug",element:n.jsx(L4,{})}),n.jsx(Ze,{path:"/leaderboard/:setCode/player/:slug",element:n.jsx(L4,{})}),n.jsx(Ze,{path:"/about",element:n.jsx(wn,{to:"/leaderboard/about",replace:!0})}),n.jsx(Ze,{path:"/players",element:n.jsx(wn,{to:"/leaderboard",replace:!0})}),n.jsx(Ze,{path:"/pods/guide",element:n.jsx(Ile,{})}),n.jsx(Ze,{path:"/pods",element:n.jsx(vC,{})}),n.jsx(Ze,{path:"/pods/:board/data",element:n.jsx(r4,{})}),n.jsx(Ze,{path:"/pods/:board/data/:card",element:n.jsx(r4,{})}),n.jsx(Ze,{path:"/pods/:slug",element:n.jsx(vC,{})}),n.jsx(Ze,{path:"/pods/:slug/:who",element:n.jsx(pC,{})}),n.jsx(Ze,{path:"/pods/:slug/:who/:pack/:pick",element:n.jsx(pC,{})}),n.jsx(Ze,{path:"/tier-list",element:n.jsx(fd,{})}),n.jsx(Ze,{path:"/tier-list/:setCode",element:n.jsx(fd,{})}),n.jsx(Ze,{path:"/tier-list/:setCode/archetypes",element:n.jsx(fd,{skeletonsOpen:!0})}),n.jsx(Ze,{path:"/tier-list/:setCode/archetypes/:pair",element:n.jsx(fd,{skeletonsOpen:!0})}),n.jsx(Ze,{path:"/tier-list/:setCode/:card",element:n.jsx(fd,{})}),n.jsx(Ze,{path:"/p0p1",element:n.jsx(A4,{})}),n.jsx(Ze,{path:"/p0p1/:setCode",element:n.jsx(A4,{})}),n.jsx(Ze,{path:"/tools",element:n.jsx(kfe,{})}),n.jsx(Ze,{path:"/tools/craft",element:n.jsx(P4,{})}),n.jsx(Ze,{path:"/tools/craft/:setCode",element:n.jsx(P4,{})}),n.jsx(Ze,{path:"/banner",element:n.jsx(Ife,{})}),n.jsx(Ze,{path:"/leaderboard/archetypes/*",element:n.jsx(wn,{to:"/leaderboard",replace:!0})}),n.jsx(Ze,{path:"/leaderboard/:setCode/archetypes/*",element:n.jsx(wn,{to:"/leaderboard",replace:!0})}),n.jsx(Ze,{path:"*",element:n.jsx(pb,{})})]}),n.jsx(SB,{})]})}const L4=()=>{const{slug:e,setCode:t}=cn(),{search:s}=Rt(),r=t?`${wp}/${e}/${t}`:`${wp}/${e}`;return n.jsx(wn,{to:{pathname:r,search:s},replace:!0})},$fe=new N7({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,gcTime:60*60*1e3}}});Gg.createRoot(document.getElementById("root")).render(n.jsx(wt.StrictMode,{children:n.jsx(C7,{client:$fe,children:n.jsx(KM,{children:n.jsx(dJ,{children:n.jsx(Mfe,{})})})})}));

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.