PageSourceSearch

https://starsarena.com/_next/static/chunks/0w.z3ppbe4vhd.js

js starsarena.com collected 2026-10-05 19:23:48 UTC 215,981 bytes, 11 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,461316,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),s.default=function({html:e,height:t=null,width:s=null,children:i,dataNtpc:n=""}){return(0,r.useEffect)(()=>{n&&performance.mark("mark_feature_usage",{detail:{feature:`next-third-parties-${n}`}})},[n]),(0,a.jsxs)(a.Fragment,{children:[i,e?(0,a.jsx)("div",{style:{height:null!=t?`${t}px`:"auto",width:null!=s?`${s}px`:"auto"},"data-ntpc":n,dangerouslySetInnerHTML:{__html:e}}):null]})};let a=e.r(843476),r=e.r(271645)},808341,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});var a={cancelIdleCallback:function(){return n},requestIdleCallback:function(){return i}};for(var r in a)Object.defineProperty(s,r,{enumerable:!0,get:a[r]});let i="u">typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(window)||function(e){let t=Date.now();return self.setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})},1)},n="u">typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(window)||function(e){return clearTimeout(e)};("function"==typeof s.default||"object"==typeof s.default&&null!==s.default)&&void 0===s.default.__esModule&&(Object.defineProperty(s.default,"__esModule",{value:!0}),Object.assign(s.default,s),t.exports=s.default)},479520,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});var a={default:function(){return v},handleClientScriptLoad:function(){return f},initScriptLoader:function(){return g}};for(var r in a)Object.defineProperty(s,r,{enumerable:!0,get:a[r]});let i=e.r(563141),n=e.r(151836),l=e.r(843476),o=i._(e.r(174080)),c=n._(e.r(271645)),d=e.r(742732),u=e.r(922737),m=e.r(808341),x=new Map,p=new Set,h=e=>{let{src:t,id:s,onLoad:a=()=>{},onReady:r=null,dangerouslySetInnerHTML:i,children:n="",strategy:l="afterInteractive",onError:c,stylesheets:d}=e,m=s||t;if(m&&p.has(m))return;if(x.has(t)){p.add(m),x.get(t).then(a,c);return}let h=()=>{r&&r(),p.add(m)},f=document.createElement("script"),g=new Promise((e,t)=>{f.addEventListener("load",function(t){e(),a&&a.call(this,t),h()}),f.addEventListener("error",function(e){t(e)})}).catch(function(e){c&&c(e)});i?(f.innerHTML=i.__html||"",h()):n?(f.textContent="string"==typeof n?n:Array.isArray(n)?n.join(""):"",h()):t&&(f.src=t,x.set(t,g)),(0,u.setAttributesFromProps)(f,e),"w
1orker"===l&&f.setAttribute("type","text/partytown"),f.setAttribute("data-nscript",l),d&&(e=>{if(o.default.preinit)return e.forEach(e=>{o.default.preinit(e,{as:"style"})});if("u">typeof window){let t=document.head;e.forEach(e=>{let s=document.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=e,t.appendChild(s)})}})(d),document.body.appendChild(f)};function f(e){let{strategy:t="afterInteractive"}=e;"lazyOnload"===t?window.addEventListener("load",()=>{(0,m.requestIdleCallback)(()=>h(e))}):h(e)}function g(e){e.forEach(f),[...document.querySelectorAll('[data-nscript="beforeInteractive"]'),...document.querySelectorAll('[data-nscript="beforePageRender"]')].forEach(e=>{let t=e.id||e.getAttribute("src");p.add(t)})}function y(e){let{id:t,src:s="",onLoad:a=()=>{},onReady:r=null,strategy:i="afterInteractive",onError:n,stylesheets:u,...x}=e,{updateScripts:f,scripts:g,getIsSsr:y,appDir:v,nonce:b}=(0,c.useContext)(d.HeadManagerContext);b=x.nonce||b;let j=(0,c.useRef)(!1);(0,c.useEffect)(()=>{let e=t||s;j.current||(r&&e&&p.has(e)&&r(),j.current=!0)},[r,t,s]);let w=(0,c.useRef)(!1);if((0,c.useEffect)(()=>{if(!w.current){if("afterInteractive"===i)h(e);else"lazyOnload"===i&&("complete"===document.readyState?(0,m.requestIdleCallback)(()=>h(e)):window.addEventListener("load",()=>{(0,m.requestIdleCallback)(()=>h(e))}));w.current=!0}},[e,i]),("beforeInteractive"===i||"worker"===i)&&(f?(g[i]=(g[i]||[]).concat([{id:t,src:s,onLoad:a,onReady:r,onError:n,...x,nonce:b}]),f(g)):y&&y()?p.add(t||s):y&&!y()&&h({...e,nonce:b})),v){if(u&&u.forEach(e=>{o.default.preinit(e,{as:"style"})}),"beforeInteractive"===i)if(!s)return x.dangerouslySetInnerHTML&&(x.children=x.dangerouslySetInnerHTML.__html,delete x.dangerouslySetInnerHTML),(0,l.jsx)("script",{nonce:b,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${JSON.stringify([0,{...x,id:t}])})`}});else return o.default.preload(s,x.integrity?{as:"script",integrity:x.integrity,nonce:b,crossOrigin:x.crossOrigin}:{as:"script",nonce:b,crossOrigin:x.crossOrigin}),(0,l.jsx)("script",{nonce:b,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${JSON.stringify([s,{...x,id:t}])})`}});"afterInteractive"===i&&s&&o.default.preload(s,x.integrity?{as:"script",integrity:x.integrity,nonce:b,crossOrigin:x.crossOrigin}:{as:"script",nonce:b,crossOrigin:x.crossOrigin})}return null}Object.defineProperty(y,"__nextScript",{value:!0});let v=y;("function"==typeof s.default||"object"==typeof s.default&&null!==s.default)&&void 0===s.default.__esModule&&(Object.defineProperty(s.default,"__esModule",{value:!0}),Object.assign(s.default,s),t.exports=s.default)},3303,(e,t,s)=>{t.exports=e.r(479520)},19598,(e,t,s)=>{"use strict";var a=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.sendGTMEvent=void 0,s.GoogleTagManager=function(e){let{gtmId:t,gtmScriptUrl:s,dataLayerName:a="dataLayer",auth:o,preview:c,dataLayer:d,nonce:u}=e;l=a;let m=new URL(s||"https://www.googletagmanager.com/gtm.js");return t&&m.searchParams.set("id",t),"dataLayer"!==a&&m.searchParams.set("l",a),o&&m.searchParams.set("gtm_auth",o),c&&(m.searchParams.set("gtm_preview",c),m.searchParams.set("gtm_cookies_win","x")),(0,i.useEffect)(()=>{performance.mark("mark_feature_usage",{detail:{feature:"next-third-parties-gtm"}})},[]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.default,{id:"_next-gtm-init",dangerouslySetInnerHTML:{__html:`
2      (function(w,l){
3        w[l]=w[l]||[];
4        w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});
5        ${d?`w[l].push(${JSON.stringify(d)})`:""}
6      })(window,'${a}');`},nonce:u}),(0,r.jsx)(n.default,{id:"_next-gtm","data-ntpc":"GTM",src:m.href,nonce:u})]})};let r=e.r(843476),i=e.r(271645),n=a(e.r(3303)),l="dataLayer";s.sendGTMEvent=(e,t)=>{let s=t||l;window[s]=window[s]||[],window[s].push(e)}},654576,(e,t,s)=>{"use strict";let a;var r=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0}),s.GoogleAnalytics=function(e){let{gaId:t,debugMode:s,dataLayerName:r="dataLayer",nonce:o}=e;return void 0===a&&(a=r),(0,n.useEffect)(()=>{performance.mark("mark_feature_usage",{detail:{feature:"next-third-parties-ga"}})},[]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.default,{id:"_next-ga-init",dangerouslySetInnerHTML:{__html:`
7          window['${r}'] = window['${r}'] || [];
8          function gtag(){window['${r}'].push(arguments);}
9          gtag('js', new Date());
10
11          gtag('config', '${t}' ${s?",{ 'debug_mode': true }":""});`},nonce:o}),(0,i.jsx)(l.default,{id:"_next-ga",src:`https://www.googletagmanager.com/gtag/js?i
11d=${t}`,nonce:o})]})},s.sendGAEvent=function(){void 0===a?console.warn("@next/third-parties: GA has not been initialized"):window[a]?window[a].push(arguments):console.warn(`@next/third-parties: GA dataLayer ${a} does not exist`)};let i=e.r(843476),n=e.r(271645),l=r(e.r(3303))},58345,e=>{"use strict";var t=e.i(619273),s=e.i(286491),a=e.i(540143),r=e.i(915823),i=class extends r.Subscribable{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,a,r){let i=a.queryKey,n=a.queryHash??(0,t.hashQueryKeyByOptions)(i,a),l=this.get(n);return l||(l=new s.Query({client:e,queryKey:i,queryHash:n,options:e.defaultQueryOptions(a),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(l)),l}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){a.notifyManager.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let s={exact:!0,...e};return this.getAll().find(e=>(0,t.matchQuery)(s,e))}findAll(e={}){let s=this.getAll();return Object.keys(e).length>0?s.filter(s=>(0,t.matchQuery)(e,s)):s}notify(e){a.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){a.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){a.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}};e.s(["QueryCache",0,i])},346974,e=>{"use strict";var t=e.i(540143),s=e.i(114272),a=e.i(619273),r=e.i(915823),i=class extends r.Subscribable{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#s=new Map,this.#a=0}#t;#s;#a;build(e,t,a){let r=new s.Mutation({mutationCache:this,mutationId:++this.#a,options:e.defaultMutationOptions(t),state:a});return this.add(r),r}add(e){this.#t.add(e);let t=n(e);if("string"==typeof t){let s=this.#s.get(t);s?s.push(e):this.#s.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){let t=n(e);if("string"==typeof t){let s=this.#s.get(t);if(s)if(s.length>1){let t=s.indexOf(e);-1!==t&&s.splice(t,1)}else s[0]===e&&this.#s.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=n(e);if("string"!=typeof t)return!0;{let s=this.#s.get(t),a=s?.find(e=>"pending"===e.state.status);return!a||a===e}}runNext(e){let t=n(e);if("string"!=typeof t)return Promise.resolve();{let s=this.#s.get(t)?.find(t=>
11t!==e&&t.state.isPaused);return s?.continue()??Promise.resolve()}}clear(){t.notifyManager.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#s.clear()})}getAll(){return Array.from(this.#t)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,a.matchMutation)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,a.matchMutation)(e,t))}notify(e){t.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return t.notifyManager.batch(()=>Promise.all(e.map(e=>e.continue().catch(a.noop))))}};function n(e){return e.options.scope?.id}e.s(["MutationCache",0,i])},317751,e=>{"use strict";var t=e.i(619273),s=e.i(58345),a=e.i(346974),r=e.i(175555),i=e.i(814448),n=e.i(540143),l=e.i(992571),o=class{#r;#i;#n;#l;#o;#c;#d;#u;constructor(e={}){this.#r=e.queryCache||new s.QueryCache,this.#i=e.mutationCache||new a.MutationCache,this.#n=e.defaultOptions||{},this.#l=new Map,this.#o=new Map,this.#c=0}mount(){this.#c++,1===this.#c&&(this.#d=r.focusManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#r.onFocus())}),this.#u=i.onlineManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#r.onOnline())}))}unmount(){this.#c--,0===this.#c&&(this.#d?.(),this.#d=void 0,this.#u?.(),this.#u=void 0)}isFetching(e){return this.#r.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#i.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#r.get(t.queryHash)?.state.data}ensureQueryData(e){let s=this.defaultQueryOptions(e),a=this.#r.build(this,s),r=a.state.data;return void 0===r?this.fetchQuery(e):(e.revalidateIfStale&&a.isStaleByTime((0,t.resolveStaleTime)(s.staleTime,a))&&this.prefetchQuery(s),Promise.resolve(r))}getQueriesData(e){return this.#r.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,s,a){let r=this.defaultQueryOptions({queryKey:e}),i=this.#r.get(r.queryHash),n=i?.state.data,l=(0,t.functionalUpdate)(s,n);if(void 0!==l)return this.#r.build(this,r).setData(l,{...a,manual:!0})}setQueriesData(e,t,s){return n.notifyManager.batch(()=>this.#r.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,s)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#r.get(t.queryHash)?.state}removeQueries(e){let t=this.#r;n.notifyManager.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let s=this.#r;return n.notifyManager.batch(()=>(s.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,s={}){let a={revert:!0,...s};return Promise.all(n.notifyManager.batch(()=>this.#r.findAll(e).map(e=>e.cancel(a)))).then(t.noop).catch(t.noop)}invalidateQueries(e,t={}){return n.notifyManager.batch(()=>(this.#r.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,s={}){let a={...s,cancelRefetch:s.cancelRefetch??!0};return Promise.all(n.notifyManager.batch(()=>this.#r.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let s=e.fetch(void 0,a);return a.throwOnError||(s=s.catch(t.noop)),"paused"===e.state.fetchStatus?Promise.resolve():s}))).then(t.noop)}fetchQuery(e){let s=this.defaultQueryOptions(e);void 0===s.retry&&(s.retry=!1);let a=this.#r.build(this,s);return a.isStaleByTime((0,t.resolveStaleTime)(s.staleTime,a))?a.fetch(s):Promise.resolve(a.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(t.noop).catch(t.noop)}fetchInfiniteQuery(e){return e.behavior=(0,l.infiniteQueryBehavior)(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(t.noop).catch(t.noop)}ensureInfiniteQueryData(e){return e.behavior=(0,l.infiniteQueryBehavior)(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return i.onlineManager.isOnline()?this.#i.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#r}getMutationCache(){return this.#i}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,s){this.#l.set((0,t.hashKey)(e),{queryKey:e,defaultOptions:s})}getQueryDefaults(e){let s=[...this.#l.values()],a={};
11return s.forEach(s=>{(0,t.partialMatchKey)(e,s.queryKey)&&Object.assign(a,s.defaultOptions)}),a}setMutationDefaults(e,s){this.#o.set((0,t.hashKey)(e),{mutationKey:e,defaultOptions:s})}getMutationDefaults(e){let s=[...this.#o.values()],a={};return s.forEach(s=>{(0,t.partialMatchKey)(e,s.mutationKey)&&Object.assign(a,s.defaultOptions)}),a}defaultQueryOptions(e){if(e._defaulted)return e;let s={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return s.queryHash||(s.queryHash=(0,t.hashQueryKeyByOptions)(s.queryKey,s)),void 0===s.refetchOnReconnect&&(s.refetchOnReconnect="always"!==s.networkMode),void 0===s.throwOnError&&(s.throwOnError=!!s.suspense),!s.networkMode&&s.persister&&(s.networkMode="offlineFirst"),s.queryFn===t.skipToken&&(s.enabled=!1),s}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#r.clear(),this.#i.clear()}};e.s(["QueryClient",0,o])},578019,e=>{"use strict";var t=e.i(511474),s=e.i(618566),a=e.i(271645);e.s(["useNuqsNextAppRouterAdapter",0,function(){let e=(0,s.useRouter)(),r=(0,s.useSearchParams)(),[i,n]=(0,a.useOptimistic)(r);return{searchParams:i,updateUrl:(0,a.useCallback)((s,r)=>{(0,a.startTransition)(()=>{var a,i;r.shallow||n(s);let l=(a=location.origin+location.pathname,i=s,(a.split("#")[0]??"")+(0,t.renderQueryString)(i)+location.hash);(0,t.debug)("[nuqs queue (app)] Updating url: %s",l),("push"===r.history?history.pushState:history.replaceState).call(history,null,"",l),r.scroll&&window.scrollTo(0,0),r.shallow||e.replace(l,{scroll:!1})})},[]),rateLimitFactor:3}}])},221381,e=>{"use strict";var t=e.i(578019),s=(0,e.i(511474).createAdapterProvider)(t.useNuqsNextAppRouterAdapter);e.s(["NuqsAdapter",0,s])},720565,e=>{"use strict";var t=e.i(604570),s=e.i(271645),a=(0,s.createContext)({client:t.default}),r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])})(e,t)};"function"==typeof SuppressedError&&SuppressedError;var i=function(e){return"function"==typeof e},n={componentStack:null,error:null};!function(e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=l}function l(t){var s=e.call(this,t)||this;return s.state=n,s}r(l,e),l.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t),l.prototype.componentDidCatch=function(e,t){var s,a=t.componentStack,r=this.props.additionalProperties;this.setState({error:e,componentStack:a}),i(r)?s=r(e):"object"==typeof r&&(s=r),this.context.client.captureException(e,s)},l.prototype.render=function(){var e=this.props,t=e.children,a=e.fallback,r=this.state;if(null==r.componentStack)return i(t)?t():t;var n=i(a)?s.default.createElement(a,{error:r.error,componentStack:r.componentStack}):a;return s.default.isValidElement(n)?n:(console.warn("[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."),s.default.createElement(s.default.Fragment,null))},l.contextType=a}(s.default.Component),e.s(["PostHogProvider",0,function(e){var r=e.children,i=e.client,n=e.apiKey,l=e.options,o=(0,s.useRef)(null),c=(0,s.useMemo)(function(){return i?(n&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),l&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),i):(n||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),t.default)},[i,n,JSON.stringify(l)]);return(0,s.useEffect)(function(){if(!i){var e=o.current;e?(n!==e.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),l&&!function e(t,s,a){if(void 0===a&&(a=new WeakMap),t===s)return!0;
11if("object"!=typeof t||null===t||"object"!=typeof s||null===s)return!1;if(a.has(t)&&a.get(t)===s)return!0;a.set(t,s);var r=Object.keys(t),i=Object.keys(s);if(r.length!==i.length)return!1;for(var n=0;n<r.length;n++){var l=r[n];if(!i.includes(l)||!e(t[l],s[l],a))return!1}return!0}(l,e.options)&&t.default.set_config(l)):(t.default.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),t.default.init(n,l)),o.current={apiKey:n,options:null!=l?l:{}}}},[i,n,JSON.stringify(l)]),s.default.createElement(a.Provider,{value:{client:c}},r)}])},213766,e=>{"use strict";let t=e=>`app_prompt_seen:${e}`,s=e=>({shouldShow:s=>{try{return!e().getItem(t(s))}catch{return!0}},markShown:s=>{try{e().setItem(t(s),String(Date.now()))}catch{}}}),a={shouldShow:()=>!0,markShown:()=>{}};e.s(["resolveGate",0,function(e){return"always"===e?a:"once-per-session"===e?s(()=>window.sessionStorage):"once"===e?s(()=>window.localStorage):e}])},466151,e=>{"use strict";var t=e.i(271645),s=e.i(858364);e.i(28856);var a=e.i(807214),r=e.i(453611),i=e.i(565006),n=e.i(327866),l=e.i(772064);let o=(0,i.legacySeed)({legacy:[]});e.s(["stakingFlowPrompt",0,{id:"staking-migration",priority:90,frequency:{shouldShow:e=>{try{let t=Number(window.localStorage.getItem(`app_prompt_seen:${e}`)??0);return Date.now()-t>=r.STAKING_FLOW_PROMPT_INTERVAL_MS}catch{return!0}},markShown:e=>{try{window.localStorage.setItem(`app_prompt_seen:${e}`,String(Date.now()))}catch{}}},usePromptState:function(){let{user:e}=(0,a.useUser)(),{summary:c,isLoading:d}=(0,s.useUserStakingSummary)(),u=(0,n.useStakingFlowSelector)(e=>!(0,i.isFlowResting)(e.value)),m=(0,l.useStakingFlowStore)(e=>e.open),x=JSON.stringify((0,i.legacySeed)(c));return(0,t.useEffect)(()=>{o=JSON.parse(x)},[x]),{eligible:(0,i.isStakingPromptEligible)({enabled:r.STAKING_FLOW_ENABLED,hasUser:!!e,isLoading:d,legacyTotal:c.legacyTotal,legacyReadFailed:c.chainStatus.avalanche.isError,flowActive:u,modalOpen:m}),blocking:!1}},open:()=>l.useStakingFlowStore.getState().actions.open(o)}])},286332,e=>{"use strict";e.i(28856);var t=e.i(807214),s=e.i(55930),a=e.i(349507);e.s(["mpcMigrationPrompt",0,{id:"mpc-wallet-migration",priority:100,frequency:"once",usePromptState:function(){let{user:e}=(0,t.useUser)(),{needsMigration:s}=(0,a.useMpcWalletMigration)();return{eligible:!!e&&s,blocking:!1}},open:e=>s.useMpcWalletMigrationStore.getState().actions.open(e)}])},367027,e=>{"use strict";var t=e.i(466151);let s=[e.i(286332).mpcMigrationPrompt,t.stakingFlowPrompt];e.s(["PROMPT_REGISTRY",0,s])},474758,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(213766),r=e.i(367027);function i({prompt:e,onState:t}){let{eligible:a,blocking:r}=e.usePromptState();return(0,s.useEffect)(()=>{t(e.id,{eligible:a,blocking:r})},[e.id,a,r,t]),null}e.s(["AppPrompts",0,function(){let[e,n]=(0,s.useState)({}),l=(0,s.useRef)(!1),o=(0,s.useCallback)((e,t)=>{n(s=>{let a=s[e];return a&&a.eligible===t.eligible&&a.blocking===t.blocking?s:{...s,[e]:t}})},[]);return(0,s.useEffect)(()=>{if(!l.current)for(let t of r.PROMPT_REGISTRY.filter(t=>e[t.id]?.eligible).sort((e,t)=>t.priority-e.priority)){let s=!!e[t.id]?.blocking,r=(0,a.resolveGate)(t.frequency);if(s||r.shouldShow(t.id)){l.current=!0,r.markShown(t.id),t.open({blocking:s});break}}},[e]),(0,t.jsx)(t.Fragment,{children:r.PROMPT_REGISTRY.map(e=>(0,t.jsx)(i,{prompt:e,onState:o},e.id))})}])},931255,e=>{"use strict";let t=10n**18n,s=10n**12n,a=10n*t;function r(e){return e<=0n?0:Math.round(Math.sqrt(.1*Number(e)/1e6))}e.s(["MIN_ACTION_AMOUNT_WEI",0,10n**12n,"displayPoints",0,r,"formatMultiplier",0,function(e){return`${Number.isInteger(e)?e.toFixed(0):e.toFixed(2)}\xd7`},"previewPoints",0,function(e){var i,n;let l=(i=e.action,n=e.lockMultiplierWad,"stake"===i?t:"burn"===i?a:n);if(null===l)return{multiplier:null,addedPoints:0n,displayGain:null};let o=Number(l)/1e18;if(e.amountWei<=0n)return{multiplier:o,addedPoints:0n,displayGain:0};let c=e.amountWei/s*l/t;return{multiplier:o,addedPoints:c,displayGain:r(e.currentPoints+c)-r(e.currentPoints)}}])},695099,e=>{"use strict";var t=e.i(644616),s=e.i(668375),a=e.i(689298),r=e.i(276518),i=e.i(687024),n=e.i(931255);let l=10n**BigInt(15);function o(e){return(0,t.formatUnits)(e-e%l,18)}function c(e,t){return 0n===t?"none-available":null===e||e<=0n?"enter-amount":e>t?"over-available":null}let d={stake:"staking",lock:"locking",burn:"burning"};e.s(["ARENA_INPUT_DECIMALS",0,3,"actionDraftReducer",0,function(e,t){switch(t.type){case"setAction":return{...e,action:t.action,burnAcknowledged:!1};case"setAmount":return{...e,amount:t.amount};case"setLockDays":return{...e,lockDays:t.days};case"ackBurn":return{...e,burnAcknowledged:t.value}}},"amountIssue",0,c,"amountValue",0,function(e,t){return null!==e?e:null!==t&&t>=l?o(t):""},"ctaLabel",0,function(e,t,s,i,n){switch(s){case"status-loading":return a.ctaCopy.checkingStatus;case"moat-paused":return a.ctaCopy.moatPaused(t);case"action-disabled":return a.ctaCopy.actionDisabled(e.action,t);case"chain-unavailable":return a.chainPaneCopy.chainUnavailable(n??t);case"none-available":return a.ctaCopy.noArenaOn(t);case"enter-amount":return a.ctaCopy.enterAmount;case"below-minimum":return a.ctaCopy.belowMinimum;
11case"over-available":return a.ctaCopy.overAvailable;case"lock-out-of-range":return a.ctaCopy.lockOutOfRange;case"burn-not-acknowledged":return a.ctaCopy.burnNotAcknowledged;case null:return a.actionCopy[e.action].cta((0,r.formatArena)(i??0n))}},"initialActionDraft",0,function(e="stake"){return{action:e,amount:null,lockDays:i.DEFAULT_LOCK_DAYS,burnAcknowledged:!1}},"maxAmountString",0,o,"moatCardIssue",0,function(e){return e?e.paused?"moat-paused":e.staking||e.locking||e.burning?null:"all-disabled":null},"moatCardIssueText",0,function(e){return"moat-paused"===e?a.moatUnavailableCopy.paused:a.moatUnavailableCopy.allOff},"parseAmountWei",0,function(e){let t=e.replace(/,/g,"").trim();if(!t)return null;try{return(0,s.parseUnits)(t,18)}catch{return null}},"validateAction",0,function(e,t){if(!t.status)return"status-loading";if(t.status.paused)return"moat-paused";if(!t.status[d[e.action]])return"action-disabled";if(t.balanceUnavailable)return"chain-unavailable";if(null===t.available)return"status-loading";let s=c(t.amountWei,t.available);return"none-available"===s||"enter-amount"===s?s:t.amountWei<n.MIN_ACTION_AMOUNT_WEI?"below-minimum":s||("lock"!==e.action||(0,i.isLockDaysInRange)(e.lockDays)?"burn"!==e.action||e.burnAcknowledged?null:"burn-not-acknowledged":"lock-out-of-range")}])},166181,e=>{"use strict";var t=e.i(285973),s=e.i(689298),a=e.i(276518),r=e.i(687024),i=e.i(931255),n=e.i(741111),l=e.i(705711),o=e.i(221337),c=e.i(695099);function d(e){return"external"===e?s.flowCopy.confirmInWallet:null}let u=e=>"ready"===e.status?e.wei:null;function m(e,t,s){if(null===s)return null;if(("bridge"===e||"action"===e&&t.moat&&"bridge"!==(0,n.getMoat)(t.moat).route)&&"unstake"===t.path[0]&&t.unstakeAmountWei){let e=BigInt(t.unstakeAmountWei);return e<s?e:s}return s}let x={month:"short",day:"numeric",year:"numeric",timeZone:"UTC"};e.s(["actionScreenModel",0,function(e){let{draft:t,moat:a,status:n}=e,l=u(e.available),o=(0,c.amountValue)(t.amount,m("action",e.flow,l)),p=(0,c.parseAmountWei)(o),h="unavailable"===e.available.status?e.available.chain:null,f=(0,c.validateAction)(t,{amountWei:p,available:l,status:n,balanceUnavailable:null!==h}),g=(0,i.previewPoints)({action:t.action,amountWei:p??0n,lockMultiplierWad:e.lockMultiplierWad??null,currentPoints:e.currentPoints??0n}),y=null===e.currentPoints?{...g,displayGain:null}:g,v=(0,c.ctaLabel)(t,a,f,p,h),b="over-available"===f||"below-minimum"===f,j="lock"===t.action&&(0,r.isLockDaysInRange)(t.lockDays)?s.lockCopy.unlocks(new Date(e.now.getTime()+t.lockDays*r.SECONDS_PER_DAY*1e3).toLocaleDateString("en-US",x)):null;return{available:l,value:o,amountWei:p,issue:f,cta:v,amountInvalid:b,invalidReason:b?v:null,preview:y,gain:null===p||p<=0n?{kind:"hidden"}:e.pointsUnavailable?{kind:"note",text:s.flowUiCopy.pointsUnavailable(e.pointsUnavailable)}:{kind:"text",text:null===y.displayGain?s.flowCopy.previewLoading:s.flowCopy.preview(y.displayGain)},networkLabel:s.flowCopy.networkLabel(a),unlockLine:j,retryBalances:"chain-unavailable"===f,confirmHint:d(e.wallet.kind)}},"actionSubmission",0,function(e,t){return null!==e.issue||null===e.amountWei?null:{action:t.action,lockDays:"lock"===t.action?t.lockDays:null,amountWei:e.amountWei.toString()}},"amountStepModel",0,function(e,t){let r=u(t.available),i=(0,c.amountValue)(t.amount,m(e,t.flow,r)),n=(0,c.parseAmountWei)(i),l="unavailable"===t.available.status?"chain-unavailable":null===r?"loading":(0,c.amountIssue)(n,r),o="unstake"===e?s.stepCopy.unstake:s.stepCopy.bridge,x=(()=>{switch(l){case"loading":return s.ctaCopy.checkingStatus;case"chain-unavailable":return s.chainPaneCopy.chainUnavailable("avalanche");case"none-available":return o.none;case"enter-amount":return s.ctaCopy.enterAmount;case"over-available":return s.ctaCopy.overAvailable;case null:return o.cta((0,a.formatArena)(n??0n))}})();return{available:r,value:i,amountWei:n,issue:l,cta:x,invalidReason:"over-available"===l?x:null,retry:"chain-unavailable"===l,confirmHint:d(t.wallet.kind)}},"amountSubmission",0,function(e){return null!==e.issue||null===e.amountWei?null:e.amountWei.toString()},"bridgeDetails",0,function(e){let r=e.amountWei??0n,i=null!==e.limitWei&&e.limitWei>0n?e.limitWei:r,n=r>0n&&i>0n?(0,o.splitBridgeAmount)(r,i).length:1,l=null===e.nativeFeeWei?null:Number((0,t.formatEther)(e.nativeFeeWei)).toFixed(4);return{fee:s.stepCopy.bridge.feeValue(l,n),partsLine:n>1?s.stepCopy.bridge.parts(n,(0,a.formatArena)(i)):null}},"currentPointsState",0,function(e,t){let s=l.CHAIN_KEYS.find(t=>e.chainStatus[t].isError),a=s?(0,n.moatsOnChain)(s)[0]?.id??null:null;return a?{currentPoints:null,pointsUnavailable:a}:{currentPoints:t?null:e.totalPoints,pointsUnavailable:null}},"modalIdleView",0,function(e){return e.arena?"entry":e.isLoading?"loading":"noWallet"},"resolveFlowWallet",0,function(e){return"external"===e.walletKind?e.external?{status:"ready",wallet:e.external}:e.isLoading?{status:"loading"}:{status:"externalMissing"}:e.arena?{status:"ready",wallet:e.arena}:{status:"loading"}},"showBridgeMore",0,function(e){return"bridge"===(0,n.getMoat)(e.moat).route&&!e.bridged&&!e.errors.arenaError&&(e.balances?.arenaAvalancheWei??0n)>0n},"stepExit",0,function(e,t){let s=!!t.unstakeTxHash||t.bridgeSends.length>0,a=(()=>{switch(e){case"walletSelect":return!1;case"whereTo":return t.pickedWallet&&!s;case"unstakeInput":return t.pickedWallet;case"bridgeInput":return t.bridgeMore||t.pickedChain&&!s;case"actionInput":return t.pickedChain&&!s}})();return{back:a,notNow:!a}},"walletRowBalance",0,function(e,t,r){if(e)return r.legacyError||t?.legacyWei===void 0?null:s.stepCopy.wallet.oldStake((0,a.formatArena)(t.legacyWei));if(r.arenaError||r.warenaError)return null;let i=t?.arenaAvalancheWei,n=t?.warenaRobinhoodWei;return void 0===i||void 0===n?null:s.stepCopy.wallet.arena((0,a.formatArena)(i+n))},"whereToBalance",0,function(e,t,r){let i="bridge"===(0,n.getMoat)(e).route;if(i?r.warenaError:r.arenaError)return null;let l=i?t?.warenaRobinhoodWei:t?.arenaAvalancheWei;return void 0===l?null:{text:s.stepCopy.whereTo.balance((0,a.formatArena)(l)),empty:0n===l}},"whereToStep",0,function(e){if("bridge"!==(0,n.getMoat)(e.moat).route)return"action";if(e.afterUnstake)return"bridge";let{balances:t,errors:s}=e;if(s.warenaError)return"action";let a=t?.warenaRobinhoodWei;if(void 0===a)return null;if(a>0n)return"action";if(s.arenaError)return"bridge";let r=t?.arenaAvalancheWei;return void 0===r?null:r>0n?"bridge":"action"}])},733769,e=>{"use strict";var t=e.i(266027),s=e.i(687024),a=e.i(945767),r=e.i(858364);e.s(["useLockMultiplier",0,function(e,i){return(0,t.useQuery)({queryKey:r.stakingQueryKeys.lockMultiplier(e,i??0),queryFn:()=>(0,a.readLockMultiplierWad)(e,i),enabled:null!==i&&(0,s.isLockDaysInRange)(i),staleTime:1/0})}])},575805,e=>{"use strict";var t=e.i(266027),s=e.i(945767),a=e.i(858364);e.s(["useMoatStatus",0,function(e){return(0,t.useQuery)({queryKey:a.stakingQueryKeys.moatStatus(e),queryFn:()=>(0,s.readMoatStatus)(e),staleTime:6e4})}])},551540,e=>{"use strict";var t=e.i(741111);e.s(["availableForStep",0,function(e,s,a,r){let i="unstake"===e?{key:"legacyWei",error:"legacyError",chain:"avalanche"}:"action"===e&&s&&"bridge"===(0,t.getMoat)(s).route?{key:"warenaRobinhoodWei",error:"warenaError",chain:"robinhood"}:{key:"arenaAvalancheWei",error:"arenaError",chain:"avalanche"};if(r[i.error])return{status:"unavailable",chain:i.chain};let n=a?.[i.key];return void 0===n?{status:"loading"}:{status:"ready",wei:n}},"readFailed",0,function(e){return e.isError&&void 0===e.data}])},43067,e=>{"use strict";var t=e.i(271645),s=e.i(586448),a=e.i(752012),r=e.i(753174),i=e.i(945767),n=e.i(741111),l=e.i(551540);let o=["blockchain","staked-arena","plan-balances"];function c(e){let t=(0,n.getMoat)("avalanche"),c=(0,n.getMoat)("robinhood"),d=e?.toLowerCase(),u={enabled:!!e,staleTime:15e3},m=t=>
11(0,i.moatClient)(t.id).readContract({address:t.stakingToken,abi:a.erc20Abi,functionName:"balanceOf",args:[e]}),[x,p,h]=(0,s.useQueries)({queries:[{...u,queryKey:[...o,"legacy",d],queryFn:()=>(0,r.readLegacyStakeWei)(e)},{...u,queryKey:[...o,"arena",d],queryFn:()=>m(t)},{...u,queryKey:[...o,"warena",d],queryFn:()=>m(c)}]}),f=[x,p,h].every(e=>!e.isLoading);return{data:e&&f?{legacyWei:x.data,arenaAvalancheWei:p.data,warenaRobinhoodWei:h.data}:void 0,isLoading:!!e&&!f,isFetching:[x,p,h].some(e=>e.isFetching),legacyError:(0,l.readFailed)(x),arenaError:(0,l.readFailed)(p),warenaError:(0,l.readFailed)(h),refetch:()=>{x.refetch(),p.refetch(),h.refetch()}}}e.s(["usePlanBalances",0,c,"useStepBalances",0,function(e,s,a){let r=c(a),[i,n]=(0,t.useState)(!1),o=!r.isLoading&&!r.isFetching;(0,t.useEffect)(()=>{o&&n(!0)},[o]);let d={legacyError:r.legacyError,arenaError:r.arenaError,warenaError:r.warenaError},u=i?(0,l.availableForStep)(e,s,r.data,d):{status:"loading"};return{...r,errors:d,available:u,fresh:i}}])},2704,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(935205),r=e.i(689298),i=e.i(276518),n=e.i(88867),l=e.i(695099);e.s(["AmountField",0,function({value:e,available:o,chain:c,networkLabel:d,invalidReason:u,onChange:m,onMax:x}){let p=(0,s.useId)(),h=(0,s.useId)();return(0,t.jsxs)("div",{className:"bg-surface-raised rounded-2xl p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("label",{htmlFor:p,className:"text-text-subtle text-xs",children:r.flowCopy.amountLabel}),null!==o&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:"text-text-subtle text-xs",children:r.flowCopy.available((0,i.formatArena)(o))}),(0,t.jsx)("button",{type:"button",onClick:x,className:"text-brand text-xs font-semibold uppercase",children:r.flowCopy.max})]})]}),(0,t.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-3",children:[(0,t.jsx)("input",{id:p,inputMode:"decimal",autoComplete:"off",placeholder:"0",value:e,onChange:e=>m((0,n.handleNumericInput)(e.target.value,e.target.selectionStart??0,l.ARENA_INPUT_DECIMALS).value),"aria-invalid":null!==u,"aria-describedby":u?h:void 0,className:"text-text-primary placeholder:text-text-subtle aria-invalid:text-danger-vivid w-full min-w-0 bg-transparent text-2xl font-semibold outline-none"}),(0,t.jsxs)("div",{className:"bg-surface-elevated flex shrink-0 items-center gap-2 rounded-full py-1.5 pr-3 pl-1.5",children:[(0,t.jsx)(a.ArenaTokenIcon,{chain:c,size:28}),(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("span",{className:"text-text-primary text-sm font-semibold",children:r.flowCopy.tokenSymbol}),(0,t.jsx)("span",{className:"text-text-subtle text-[11px]",children:d})]})]})]}),u&&(0,t.jsx)("p",{id:h,className:"text-danger-vivid mt-2 text-xs",children:u})]})}])},829134,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(257428),r=e.i(689298);e.s(["BurnAcknowledgement",0,function({checked:e,onChange:i}){let n=(0,s.useId)();return(0,t.jsxs)("div",{className:"bg-surface-raised flex items-start gap-3 rounded-2xl p-4",children:[(0,t.jsx)(a.Checkbox,{id:n,checked:e,onCheckedChange:e=>i(!0===e),className:"mt-0.5"}),(0,t.jsx)("label",{htmlFor:n,className:"text-text-primary text-sm",children:r.flowCopy.burnAck})]})}])},73970,e=>{"use strict";var t=e.i(843476),s=e.i(672310);e.i(732832);var a=e.i(551360);e.s(["SegmentedControl",0,function({label:e,labelledBy:r,options:i,value:n,onValueChange:l,size:o="md"}){return(0,t.jsx)(s.Root,{"aria-label":r?void 0:e,"aria-labelledby":r,orientation:"horizontal",value:n,onValueChange:e=>l(e),className:"bg-surface-raised flex gap-1 rounded-full p-1",children:i.map(e=>(0,t.jsx)(s.Item,{value:e.value,"aria-label":e.ariaLabel,className:(0,a.cn)("focus-visible:ring-brand hover:text-text-primary data-[state=checked]:bg-surface-elevated data-[state=checked]:text-text-primary text-text-subtle min-w-0 flex-1 rounded-full font-semibold transition-colors focus-visible:ring-2 focus-visible:outline-hidden","sm"===o?"px-2 py-1.5 text-xs":"px-3 py-2 text-sm"),children:e.label},e.value))})}])},970731,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(689298),r=e.i(687024),i=e.i(73970);let n=r.LOCK_PRESET_DAYS.map(e=>({value:String(e),label:a.lockCopy.short(e),ariaLabel:a.lockCopy.long(e)}
11));e.s(["LockDurationPicker",0,function({days:e,unlockLine:r,onChange:l}){let o=(0,s.useId)();return(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("span",{id:o,className:"text-text-subtle text-xs",children:a.flowCopy.lockLabel}),(0,t.jsx)(i.SegmentedControl,{labelledBy:o,size:"sm",options:n,value:String(e),onValueChange:e=>l(Number(e))}),r&&(0,t.jsx)("p",{className:"text-text-subtle text-xs","aria-live":"polite",children:r})]})}])},33497,e=>{"use strict";var t=e.i(843476),s=e.i(689298),a=e.i(931255);e.i(732832);var r=e.i(551360);e.s(["PointsPreview",0,function({preview:e,gain:i}){return(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 text-xs","aria-live":"polite",children:[(0,t.jsx)("span",{className:"text-text-subtle",children:s.flowCopy.multiplierLine(null===e.multiplier?null:(0,a.formatMultiplier)(e.multiplier))}),"hidden"!==i.kind&&(0,t.jsx)("span",{className:(0,r.cn)("shrink-0 text-right","note"===i.kind?"text-text-subtle":"text-brand font-semibold"),children:i.text})]})}])},954221,e=>{"use strict";var t=e.i(843476);e.s(["DetailRow",0,function({label:e,value:s}){return(0,t.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,t.jsx)("dt",{className:"text-text-subtle",children:e}),(0,t.jsx)("dd",{className:"text-text-primary text-right font-medium",children:s})]})},"NextLine",0,function({text:e}){return(0,t.jsx)("p",{className:"text-text-subtle text-center text-xs",children:e})},"StepHeader",0,function({title:e,body:s,lead:a}){return(0,t.jsxs)("div",{className:"flex flex-col gap-2 text-center",children:[a&&(0,t.jsx)("p",{role:"status",className:"text-brand text-sm font-medium",children:a}),(0,t.jsx)("h2",{className:"text-text-primary text-xl font-semibold",children:e}),s&&(0,t.jsx)("p",{className:"text-text-subtle text-sm",children:s})]})},"TextButton",0,function({children:e,onClick:s,disabled:a}){return(0,t.jsx)("button",{type:"button",onClick:s,disabled:a,className:"text-text-subtle hover:text-text-primary mx-auto py-1 text-sm font-medium transition-colors disabled:opacity-50",children:e})},"shortAddress",0,function(e){return`${e.slice(0,6)}…${e.slice(-4)}`}])},462864,e=>{"use strict";var t=e.i(843476),s=e.i(689298),a=e.i(166181),r=e.i(954221);e.s(["StepExit",0,function({state:e,context:i,actorRef:n}){let l=(0,a.stepExit)(e,i);return(0,t.jsxs)(t.Fragment,{children:[l.back&&(0,t.jsx)(r.TextButton,{onClick:()=>n.send({type:"BACK"}),children:s.flowCopy.back}),l.notNow&&(0,t.jsx)(r.TextButton,{onClick:()=>n.send({type:"STOP"}),children:s.flowCopy.notNow})]})}])},209951,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(332337),r=e.i(689298),i=e.i(733769),n=e.i(575805),l=e.i(858364),o=e.i(741111),c=e.i(705711),d=e.i(43067),u=e.i(695099),m=e.i(166181),x=e.i(2704),p=e.i(829134),h=e.i(970731),f=e.i(33497),g=e.i(73970),y=e.i(462864);let v=c.MOAT_ACTIONS.map(e=>({value:e,label:r.actionCopy[e].label}));e.s(["ActionScreen",0,function({context:e,actorRef:c}){let b=e.moat,j=e.destination??e.wallet,[w]=(0,s.useState)(()=>new Date),[S,N]=(0,s.useReducer)(u.actionDraftReducer,e.action??"stake",u.initialActionDraft),{data:C}=(0,n.useMoatStatus)(b),{data:k}=(0,i.useLockMultiplier)(b,"lock"===S.action?S.lockDays:null),{available:T,data:I,errors:E,refetch:M}=(0,d.useStepBalances)("action",b,j.address),{currentPoints:A,pointsUnavailable:P}=function(){let{summary:e,isLoading:t}=(0,l.useUserStakingSummary)();return(0,m.currentPointsState)(e,t)}(),O=(0,m.actionScreenModel)({moat:b,draft:S,available:T,flow:e,status:C,lockMultiplierWad:k,currentPoints:A,pointsUnavailable:P,wallet:j,now:w}),L=(0,m.showBridgeMore)({moat:b,balances:I,errors:E,bridged:e.bridgeSends.length>0});return(0,t.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,t.jsx)("h2",{className:"text-text-primary text-center text-xl font-semibold",children:r.flowCopy.howTitle(b)}),(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,t.jsx)(g.SegmentedControl,{label:r.flowUiCopy.groups.action,options:v,value:S.action,onValueChange:e=>N({type:"setAction",action:e})}),(0,t.jsx)("p",{className:"text-text-subtle text-sm",children:r.actionCopy[S.action].body})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(x.AmountField,{value:O.value,available:O.available,chain:(0,o.getMoat)(b).chain,networkLabel:O.networkLabel,invali
11dReason:O.invalidReason,onChange:e=>N({type:"setAmount",amount:e}),onMax:()=>{null!==O.available&&N({type:"setAmount",amount:(0,u.maxAmountString)(O.available)})}}),L&&(0,t.jsx)("button",{type:"button",onClick:()=>c.send({type:"BRIDGE_MORE"}),className:"text-brand self-end text-xs font-semibold",children:r.stepCopy.bridgeMore})]}),"lock"===S.action&&(0,t.jsx)(h.LockDurationPicker,{days:S.lockDays,unlockLine:O.unlockLine,onChange:e=>N({type:"setLockDays",days:e})}),(0,t.jsx)(f.PointsPreview,{preview:O.preview,gain:O.gain}),"burn"===S.action&&(0,t.jsx)(p.BurnAcknowledgement,{checked:S.burnAcknowledged,onChange:e=>N({type:"ackBurn",value:e})}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)(a.Button,{className:"w-full",disabled:null!==O.issue,onClick:()=>{let e=(0,m.actionSubmission)(O,S);e&&c.send({type:"SUBMIT_ACTION",...e})},children:O.cta}),O.retryBalances&&(0,t.jsx)(a.Button,{variant:"outline-ghost",className:"mt-1 w-full",onClick:M,children:r.commonCopy.tryAgain}),O.confirmHint&&(0,t.jsx)("p",{className:"text-text-subtle text-center text-xs",children:O.confirmHint}),(0,t.jsx)(y.StepExit,{state:"actionInput",context:e,actorRef:c})]})]})}])},503785,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(266027),r=e.i(332337),i=e.i(248966),n=e.i(689298),l=e.i(741111),o=e.i(950190),c=e.i(453611),d=e.i(43067),u=e.i(695099),m=e.i(166181),x=e.i(2704),p=e.i(954221),h=e.i(462864);e.s(["BridgeScreen",0,function({context:e,actorRef:f}){let g=e.moat,y=e.wallet,v=(e.destination??y).address,[b,j]=(0,s.useState)(null),{available:w,refetch:S}=(0,d.useStepBalances)("bridge",g,y.address),N=(0,m.amountStepModel)("bridge",{amount:b,available:w,flow:e,wallet:y}),C=function(e,t,s){let r=i.PUBLIC_CLIENTS[c.BRIDGE_SOURCE_CHAIN_ID],n=s??0n,{data:l}=(0,a.useQuery)({queryKey:["bridge-limit",e,t,n.toString()],queryFn:()=>(0,o.getBridgeSendLimit)(r,e,t,n),enabled:n>0n,staleTime:3e4}),d=l&&l>0n&&l<n?l:n,{data:u}=(0,a.useQuery)({queryKey:["bridge-fee",e,t,d.toString()],queryFn:()=>(0,o.quoteBridgeFee)(r,e,t,d),enabled:d>0n,staleTime:3e4});return{limitWei:l??null,nativeFeeWei:u?.nativeFee??null}}((0,l.getMoat)(g).bridgeDirection??"arena-to-warena",v,null===N.issue?N.amountWei:null),k=(0,m.bridgeDetails)({amountWei:N.amountWei,limitWei:C.limitWei,nativeFeeWei:C.nativeFeeWei});return(0,t.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,t.jsx)(p.StepHeader,{title:n.stepCopy.bridge.title(g),body:n.stepCopy.bridge.body(g)}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(x.AmountField,{value:N.value,available:N.available,chain:"avalanche",networkLabel:n.stepCopy.bridge.chip,invalidReason:N.invalidReason,onChange:j,onMax:()=>{null!==N.available&&j((0,u.maxAmountString)(N.available))}}),(0,t.jsxs)("dl",{className:"flex flex-col gap-2 px-1 text-xs",children:[(0,t.jsx)(p.DetailRow,{label:n.stepCopy.bridge.fee,value:k.fee}),(0,t.jsx)(p.DetailRow,{label:n.stepCopy.bridge.arrives,value:n.stepCopy.bridge.arrivesValue})]}),k.partsLine&&(0,t.jsx)("p",{className:"text-text-subtle px-1 text-xs",children:k.partsLine})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)(r.Button,{className:"w-full",disabled:null!==N.issue,onClick:()=>{let e=(0,m.amountSubmission)(N);e&&f.send({type:"SUBMIT_BRIDGE",amountWei:e})},children:N.cta}),N.retry&&(0,t.jsx)(r.Button,{variant:"outline-ghost",className:"mt-1 w-full",onClick:S,children:n.commonCopy.tryAgain}),N.confirmHint&&(0,t.jsx)("p",{className:"text-text-subtle text-center text-xs",children:N.confirmHint}),(0,t.jsx)(p.NextLine,{text:n.stepCopy.bridge.next(g)}),(0,t.jsx)(h.StepExit,{state:"bridgeInput",context:e,actorRef:f})]})]})}])},606503,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(332337),r=e.i(689298),i=e.i(988841),n=e.i(43067),l=e.i(565006),o=e.i(772064),c=e.i(166181),d=e.i(954221);let u=e=>({legacyError:e.legacyError,arenaError:e.arenaError,warenaError:e.warenaError});function m({text:e}){return(0,t.jsx)("p",{role:"status",className:"text-text-subtle py-6 text-center text-sm",children:e})}e.s(["EntryScreen",0,function({seed:e,onStart:x,onClose:p}){let{arena:h,external:f,isLoading:g}=(0,i.useStakingWallets)(),y=(0,n.usePlanBalances)(h?.address),v=(0,n.usePlanBalances)(f?.address),b=(0,l.walletChoiceFor)(e,{arena:{balances:y.data,errors:u(y)},external:f?{balances:v.data,errors:u(v)}:null}),j=(0,c.resolveFlowWallet)({walletKind:e.walletKind??("pick"===b.kind?b.wallet:"arena"),arena:h,external:f,isLoading:g}),w="ready"===j.status?j.wallet:null,S=w?.kind==="external"?v:y,N=u(S),C=w?(0,l.entryStart)(e,S.data,N,b):{kind:"loading"},k=(0,s.useRef)(!1),T="start"===C.kind&&w?`${w.address}:${C.step}:${C.moat??""}:${!!C.move}`:null;return((0,s.useEffect)(()=>{!T||k.current||!w||"start"!==C.kind||(0,l.shouldStartEntry)(o.useStakingFlowStore.getState().open)&&(k.current=!0,x(w,C.step,C.moat,!!C.move))},[T]),"externalMissing"===j.status)?(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)(m,{text:r.flowErrorC
11opy.connectStakingWallet}),(0,t.jsx)(d.TextButton,{onClick:p,children:r.flowCopy.notNow})]}):"empty"===C.kind?(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)(m,{text:r.ctaCopy.noArenaOn(C.moat)}),(0,t.jsx)(d.TextButton,{onClick:p,children:r.flowCopy.notNow})]}):"unavailable"===C.kind?(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)(m,{text:r.chainPaneCopy.chainUnavailable(C.chain)}),(0,t.jsx)(a.Button,{variant:"outline-ghost",onClick:S.refetch,children:r.commonCopy.tryAgain}),(0,t.jsx)(d.TextButton,{onClick:p,children:r.flowCopy.notNow})]}):(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)(m,{text:w?r.ctaCopy.checkingStatus:r.walletCopy.loading}),(0,t.jsx)(d.TextButton,{onClick:p,children:r.flowCopy.notNow})]})}])},30912,e=>{"use strict";var t=e.i(689298),s=e.i(769510),a=e.i(8788);let r={label:t.flowUiCopy.stopHere,kind:"cancel"},i={label:t.flowCopy.notNow,kind:"close"};function n(e){return e.bridgeSends.some(e=>!e.txHash)}e.s(["describeErrorScreen",0,function(e,l){return"failed"===e?function(e){let i,l;if(e.error?.code==="USER_REJECTED")return{tone:"neutral",title:(0,s.softCancelTitle)(e),message:(0,s.softCancelMessage)(e),actions:[{label:t.commonCopy.tryAgain,event:"RETRY",primary:!0}
11],dismiss:r,hint:null,txLink:null};let o=(0,a.failedTitle)(e),c=[];e.error?.code!=="WALLET_MISMATCH"&&(c.push({label:t.commonCopy.tryAgain,event:"RETRY",primary:!0}),e.error?.code==="DELIVERY_TIMEOUT"&&n(e)&&c.push({label:t.flowUiCopy.sendAgain,event:"RETRY_FRESH",primary:!1}));let d=(i=e.error?.message?.trim())&&i!==o?i:null,u=function(e){let s=t.flowUiCopy.failedBody;switch(e.lastActiveState){case"unstaking":return e.unstakeTxHash?{text:s.other,saysWhere:!1}:{text:s.unstaking,saysWhere:!0};case"bridging":case"waitingDelivery":return{text:s.bridging(e.bridgeSends.filter(e=>e.txHash).length,e.bridgeSends.length),saysWhere:e.bridgeSends.every(e=>!e.txHash)};case"toppingUpGas":return{text:s.toppingUpGas(!!e.gasTopupTxHash),saysWhere:!1};case"acting":return e.moat&&e.action&&!e.actionTxHash?{text:s.acting(e.action,(e.destination??e.wallet)?.kind??"arena",e.moat),saysWhere:!0}:{text:s.other,saysWhere:!1};default:return{text:s.other,saysWhere:!1}}}(e);return{tone:"failed",title:o,message:d??u.text,actions:c,dismiss:r,hint:d||!u.saysWhere?(l=(0,s.arenaPlace)(e))?t.flowUiCopy.arenaStays(l):null:null,txLink:"bridging"===e.lastActiveState||"waitingDelivery"===e.lastActiveState?(0,s.stepTxLink)(e):null}}(l):function(e){if(e.error?.reason==="RECEIPT_TIMEOUT")return{tone:"interrupted",title:t.flowErrorCopy.fallback.stillConfirming,message:t.flowErrorCopy.receiptTimeout,actions:[{label:t.flowUiCopy.keepWaiting,event:"CONTINUE_WAITING",primary:!0}
11],dismiss:r,dismissNote:t.flowUiCopy.stopTrackingNote,hint:null,txLink:(0,s.stepTxLink)(e)};let a=t.flowCardCopy.interrupted;return{tone:"interrupted",title:a,message:t.flowUiCopy.interruptedUnknown,actions:"bridging"===e.lastActiveState?[{label:t.flowUiCopy.keepWaiting,event:"CONTINUE_WAITING",primary:!0},...n(e)?[{label:t.flowUiCopy.sendAgain,event:"RETRY_FRESH",primary:!1}]:[]]:[{label:t.flowUiCopy.sendAgain,event:"RETRY_FRESH",primary:!0}],dismiss:i,hint:null,txLink:null}}(l)}])},278130,e=>{"use strict";var t=e.i(843476),s=e.i(332337);e.i(732832);var a=e.i(551360),r=e.i(30912),i=e.i(954221);let n={neutral:"text-text-secondary",interrupted:"text-text-secondary",failed:"text-danger-vivid"};e.s(["ErrorScreen",0,function({stateValue:e,context:l,actorRef:o,onCancel:c,onClose:d}){let u=(0,r.describeErrorScreen)(e,l);return(0,t.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-3 text-center",children:[(0,t.jsx)("h2",{className:"text-text-primary text-xl font-semibold",children:u.title}),(0,t.jsx)("p",{className:(0,a.cn)("text-sm",n[u.tone]),role:"failed"===u.tone?"alert":"status",children:u.message}),u.txLink&&(0,t.jsx)("a",{href:u.txLink.href,target:"_blank",rel:"noopener noreferrer",className:"text-brand mx-auto text-xs font-semibold",children:u.txLink.label})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[u.actions.map(e=>(0,t.jsx)(s.Button,{className:"w-full",variant:e.primary?"default":"outline-ghost",onClick:()=>o.send({type:e.event}),children:e.label},e.event)),(0,t.jsx)(i.TextButton,{onClick:"cancel"===u.dismiss.kind?c:d,children:u.dismiss.label}),u.dismissNote&&(0,t.jsx)("p",{className:"text-text-subtle text-center text-xs",children:u.dismissNote}),u.hint&&(0,t.jsx)("p",{className:"text-text-subtle text-center text-xs",children:u.hint})]})]})}])},552245,e=>{"use strict";var t=e.i(285973),s=e.i(689298),a=e.i(453611);let r=(a.GAS_TOPUP_MIN_AVAX+a.GAS_TOPUP_AVAX_RESERVE).toFixed(2);function i(e){return e.toLocaleString("en-US",{maximumFractionDigits:4})}e.s(["formatGasAmount",0,i,"gasIntroLine",0,function(e,a,r,n){if(void 0===r||null===n)return s.gasCopy.intro(e);let l=Number((0,t.formatEther)(BigInt(n)));return r>=l?s.gasCopy.intro(e):s.gasCopy.shortfall(a,i(r),i(l),e)},"gasNoAvaxCopy",0,function(e,t){return{title:"external"===e?s.gasCopy.externalNoAvaxTitle:s.gasCopy.notEnoughAvax,body:s.gasCopy.arenaHasAvax(i(t),r)}},"gasQuoteFailed",0,function(e){return!e.isLoading&&(e.isError||null===e.quote)},"gasTopUp",0,function(e){let t=Math.floor(1e3*Math.min(a.GAS_TOPUP_MAX_AVAX,e-a.GAS_TOPUP_AVAX_RESERVE))/1e3;return{amountAvax:String(Math.max(t,0)),canTopUp:t>=a.GAS_TOPUP_MIN_AVAX}}])},363486,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(266027),r=e.i(285973),i=e.i(332337),n=e.i(764332),l=e.i(188461),o=e.i(378869),c=e.i(705237),d=e.i(689298),u=e.i(988841),m=e.i(252189);e.i(109831);var x=e.i(698911),p=e.i(78724),h=e.i(390327),f=e.i(400407),g=e.i(732803),y=e.i(453611),v=e.i(552245),b=e.i(954221);let j={address:m.NATIVE_TOKEN_ADDRESS,symbol:"ETH",decimals:18,blockchain:"robinhood",network:l.ROBINHOOD,icon:""};function w({destination:e,moat:l,actorRef:c}){let{arena:m}=(0,u.useStakingWallets)(),p=m?.address,{data:y,isLoading:b}=(0,f.useGasBalance)({userAddress:p,chain:"avalanche"}),S=y?.uiValue??0,{amountAvax:N,canTopUp:C}=(0,v.gasTopUp)(S),k=!!p&&C,T=(0,s.useMemo)(()=>({tokenIn:o.swapTokens.AVAX,tokenOut:j,amountIn:N,slippage:n.LIFI_DEFAULT_SLIPPAGE,userAddress:p??e.address,toAddress:e.address,swapMode:g.SwapMode.EXACT_IN}),[p,e.address,N]),{data:I,isLoading:E,isError:M,refetch:A}=(0,a.useQuery)({queryKey:["gas-topup-quote",p,e.address,N],queryFn:()=>(0,h.getLiFiSwapQuote)(T),enabled:k}),P=I?.amountOut!==void 0?(0,v.formatGasAmount)(Number((0,r.formatEther)(I.amountOut))):d.amountCopy.unknown,O=(0,v.gasQuoteFailed)({isLoading:E,isError:M,quote:I});if(b)return(0,t.jsx)("div",{"aria-hidden":!0,className:"bg-surface-raised h-[120px] animate-pulse rounded-2xl"});if(!k){let s=(0,v.gasNoAvaxCopy)(e.kind,S);return(0,t.jsxs)("div",{className:"bg-surface-raised flex flex-col gap-3 rounded-2xl p-4",children:[(0,t.jsx)("p",{className:"text-text-primary text-sm font-medium",children:s.title}),(0,t.jsx)("p",{className:"text-text-subtle text-xs",children:s.body}),(0,t.jsx)(x.DepositModal,{asChild:!0,children:(0,t.jsx)(i.Button,{className:"w-full",children:d.gasCopy.depositAvax})})]})}return(0,t.jsxs)("div",{className:"bg-surface-raised flex flex-col gap-3 rounded-2xl p-4",children:[(0,t.jsx)("p",{className:"text-text-primary text-sm font-medium",children:d.gasCopy.topUpWith(N)}),O?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"text-text-subtle text-xs",children:d.gasCopy.quoteFailed}),(0,t.jsx)(i.Button,{variant:"outline-ghost",className:"w-full",onClick:()=>A(),children:d.commonCopy.tryAgain})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"text-text-subtle text-xs",children:d.gasCopy.swapFrom(e.kind,P,l,(0,v.formatGasAmount)(S))}),(0,t.jsx)(i.Button,{className:"w-full",disabled:E,onClick:()=>c.send({type:"TOP_UP",amountAvax:N}),children:d.gasCopy.topUp})]})]})}function S({destination:e,moat:a}){let{copied:r,copy:n}
11=function(){let[e,t]=(0,s.useState)(!1);return{copied:e,copy:async e=>{try{await navigator.clipboard.writeText(e),t(!0),setTimeout(()=>t(!1),2e3)}catch{}}}}();return(0,t.jsxs)("div",{className:"bg-surface-raised flex flex-col gap-3 rounded-2xl p-4",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)("p",{className:"text-text-primary text-sm font-medium",children:d.gasCopy.sendTitle(a)}),(0,t.jsx)("p",{className:"text-text-subtle text-xs",children:d.gasCopy.sendTo(e.kind)})]}),(0,t.jsxs)("div",{className:"bg-surface-modal flex items-center justify-between gap-3 rounded-xl px-3 py-2",children:[(0,t.jsx)("span",{className:"text-text-primary font-mono text-xs",title:e.address,children:(0,b.shortAddress)(e.address)}),(0,t.jsx)(i.Button,{size:"xs",variant:"outline-ghost",onClick:()=>n(e.address),children:r?d.gasCopy.copied:d.gasCopy.copyAddress})]})]})}e.s(["GasScreen",0,function({destination:e,moat:s,actorRef:a,onCancel:r,stayHint:n,neededWei:l=null}){let{data:o}=(0,p.useRobinhoodEthBalance)(e.address),u=(0,c.useFlowSelector)(y.STAKING_FLOW_ID,e=>e.context.gasNeededWei);return(0,t.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2 text-center",children:[(0,t.jsx)("h2",{className:"text-text-primary text-xl font-semibold",children:d.flowCardCopy.gasNeeded(s)}),(0,t.jsx)("p",{className:"text-text-subtle text-sm",children:(0,v.gasIntroLine)(s,e.kind,o,l??u)})]}),(0,t.jsx)(w,{destination:e,moat:s,actorRef:a}),(0,t.jsxs)("div",{className:"text-text-subtle flex items-center gap-3 text-xs",children:[(0,t.jsx)("span",{className:"bg-border-default h-px flex-1"}),d.gasCopy.or,(0,t.jsx)("span",{className:"bg-border-default h-px flex-1"})]}),(0,t.jsx)(S,{destination:e,moat:s}),(0,t.jsx)(i.Button,{variant:"outline-ghost",className:"w-full",onClick:()=>a.send({type:"RECHECK_GAS"}),children:d.gasCopy.checkAgain}),(0,t.jsx)(b.TextButton,{onClick:r,children:d.gasCopy.cancel}),n&&(0,t.jsx)("p",{className:"text-text-subtle -mt-3 text-center text-xs",children:n})]})}])},981017,e=>{"use strict";var t=e.i(843476),s=e.i(197081),a=e.i(8788);e.s(["ProgressPane",0,function({stateValue:e,context:r}){let i=(0,a.describeStakingFlowCard)(e,r,!1);return i?(0,t.jsxs)("div",{role:"status",className:"flex flex-col gap-3 py-4 text-center",children:[(0,t.jsx)("h2",{className:"text-text-primary text-lg font-semibold",children:i.title}),i.subtitle&&(0,t.jsx)("p",{className:"text-text-subtle text-sm",children:i.subtitle}),(0,t.jsx)(s.IndeterminateBar,{})]}):null}])},331378,e=>{"use strict";var t=e.i(271645),s=e.i(540143),a=e.i(912598);e.s(["useIsFetching",0,function(e,r){let i=(0,a.useQueryClient)(r),n=i.getQueryCache();return t.useSyncExternalStore(t.useCallback(e=>n.subscribe(s.notifyManager.batchCalls(e)),[n]),()=>i.isFetching(e),()=>i.isFetching(e))}])},272932,e=>{"use strict";var t=e.i(689298),s=e.i(276518),a=e.i(931255),r=e.i(741111),i=e.i(705711);e.s(["successRankLine",0,function(e){return e.loggedIn?e.loading?{kind:"loading"}:e.isError||void 0===e.rank?{kind:"hidden"}:{kind:"text",text:null===e.rank?t.championsCopy.notRanked:t.championsCopy.rank(e.rank)}:{kind:"hidden"}},"successTotalLine",0,function(e){if(e.refreshing)return{kind:"loading"};let n=i.CHAIN_KEYS.find(t=>e.chainStatus[t].isError),l=n?(0,r.moatsOnChain)(n)[0]:void 0;return l?{kind:"unavailable",text:t.chainPaneCopy.chainUnavailable(l.id)}:{kind:"text",text:(0,s.formatMp)((0,a.displayPoints)(e.totalPoints))}}])},512334,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(331378),r=e.i(643531),i=e.i(332337),n=e.i(689298),l=e.i(276518),o=e.i(858364),c=e.i(741111),d=e.i(337104);e.i(28856);var u=e.i(807214);e.i(732832);var m=e.i(551360),x=e.i(769510),p=e.i(8788),h=e.i(272932);
11function f(e){let[t,a]=(0,s.useState)(!e);return(0,s.useEffect)(()=>{e||a(!0)},[e]),t}function g({line:e,className:s,skeleton:a}){return"hidden"===e.kind?null:"loading"===e.kind?(0,t.jsx)("span",{"aria-hidden":!0,className:(0,m.cn)("bg-surface-elevated animate-pulse rounded",a)}):(0,t.jsx)("p",{className:"unavailable"===e.kind?"text-text-subtle text-xs":s,children:e.text})}function y({context:e,onDone:s}){let a=(0,x.arenaPlace)(e,"done");return(0,t.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 text-center",children:[(0,t.jsx)("span",{className:"bg-success-strong flex size-10 items-center justify-center rounded-full",children:(0,t.jsx)(r.Check,{className:"text-brand-foreground size-5",strokeWidth:3})}),(0,t.jsx)("h2",{className:"text-text-primary text-xl font-semibold",children:(0,p.stoppedTitle)(e)}),a&&(0,t.jsx)("p",{className:"text-text-subtle text-sm",children:n.flowUiCopy.arenaIs(a)})]}),(0,t.jsx)(i.Button,{className:"w-full",onClick:s,children:n.flowCopy.done})]})}e.s(["SuccessScreen",0,function({context:e,onDone:s}){let m=function(){let{summary:e,isLoading:t}=(0,o.useUserStakingSummary)(),s=(0,a.useIsFetching)({queryKey:["blockchain","staked-arena"]})>0,r=f(t||s);return(0,h.successTotalLine)({totalPoints:e.totalPoints,chainStatus:e.chainStatus,refreshing:!r})}(),x=function(){let{user:e}=(0,u.useUser)(),t=!!e,{data:s,isPending:a,isFetching:r,isError:i}=(0,d.useMyChampionSummaryQuery)(t),n=f(r);return(0,h.successRankLine)({loggedIn:t,loading:a||!n,isError:i,rank:s?.rank})}(),{moat:p,action:v}=e;if(!e.wallet)return null;if(!e.actionTxHash||!p||!v)return(0,t.jsx)(y,{context:e,onDone:s});let b="lock"===v?e.lockDays:null;return(0,t.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 text-center",children:[(0,t.jsx)("span",{className:"bg-success-strong flex size-10 items-center justify-center rounded-full",children:(0,t.jsx)(r.Check,{className:"text-brand-foreground size-5",strokeWidth:3})}),(0,t.jsx)("h2",{className:"text-text-primary text-xl font-semibold",children:n.flowCardCopy.done(v,p)}),(0,t.jsx)("p",{className:"text-text-subtle text-sm",children:n.flowCopy.successBody})]}),(0,t.jsxs)("div",{className:"bg-surface-raised flex flex-col items-center gap-1.5 rounded-2xl px-4 py-6 text-center","aria-live":"polite",children:[(0,t.jsx)("span",{className:"text-text-subtle text-[11px] font-semibold tracking-[0.12em] uppercase",children:n.flowCopy.successTotal}),(0,t.jsx)(g,{line:m,className:"text-brand text-4xl font-bold tracking-tight",skeleton:"h-10 w-32"}),(0,t.jsx)(g,{line:x,className:"text-text-primary text-sm font-semibold",skeleton:"h-5 w-24"}),(0,t.jsx)("p",{className:"text-text-subtle text-xs",children:n.championsCopy.rankUpdates}),(0,t.jsx)("p",{className:"text-text-subtle text-xs",children:n.flowCopy.successDetail((0,l.formatArena)(e.actionSentWei??e.actionAmountWei??"0"),(e.destination??e.wallet).kind,p,b)})]}),(0,t.jsx)(i.Button,{className:"w-full",onClick:s,children:n.flowCopy.done}),(0,t.jsx)("a",{href:(0,c.getMoat)(p).moatsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-text-subtle hover:text-text-primary mx-auto text-xs font-medium transition-colors",children:n.chainPaneCopy.manageOnMoats})]})}])},970455,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(332337),r=e.i(689298),i=e.i(43067),n=e.i(695099),l=e.i(166181),o=e.i(2704),c=e.i(954221),d=e.i(462864);e.s(["UnstakeScreen",0,function({context:e,actorRef:u}
11){let m=e.wallet,[x,p]=(0,s.useState)(null),{available:h,refetch:f}=(0,i.useStepBalances)("unstake",null,m.address),g=(0,l.amountStepModel)("unstake",{amount:x,available:h,flow:e,wallet:m});return(0,t.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,t.jsx)(c.StepHeader,{title:r.stepCopy.unstake.title,body:r.stepCopy.unstake.body(m.kind)}),(0,t.jsx)(o.AmountField,{value:g.value,available:g.available,chain:"avalanche",networkLabel:r.stepCopy.unstake.chip,invalidReason:g.invalidReason,onChange:p,onMax:()=>{null!==g.available&&p((0,n.maxAmountString)(g.available))}}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)(a.Button,{className:"w-full",disabled:null!==g.issue,onClick:()=>{let e=(0,l.amountSubmission)(g);e&&u.send({type:"SUBMIT_UNSTAKE",amountWei:e})},children:g.cta}),g.retry&&(0,t.jsx)(a.Button,{variant:"outline-ghost",className:"mt-1 w-full",onClick:f,children:r.commonCopy.tryAgain}),g.confirmHint&&(0,t.jsx)("p",{className:"text-text-subtle text-center text-xs",children:g.confirmHint}),(0,t.jsx)(c.NextLine,{text:r.stepCopy.unstake.next}),(0,t.jsx)(d.StepExit,{state:"unstakeInput",context:e,actorRef:u})]})]})}])},565290,e=>{"use strict";var t=e.i(843476),s=e.i(689298),a=e.i(988841),r=e.i(43067),i=e.i(166181),n=e.i(954221),l=e.i(462864);function o({wallet:e,move:a,onPick:n}){let l=(0,r.usePlanBalances)(e.address),c=(0,i.walletRowBalance)(a,l.data,{legacyError:l.legacyError,arenaError:l.arenaError,warenaError:l.warenaError});return(0,t.jsxs)("button",{type:"button",onClick:()=>n(e),className:"bg-surface-raised hover:border-border-default focus-visible:ring-brand flex w-full items-center justify-between gap-3 rounded-2xl border border-transparent p-4 text-left transition-colors focus-visible:ring-2 focus-visible:outline-hidden",children:[(0,t.jsx)("span",{className:"text-text-primary text-sm font-semibold",children:s.walletCopy.label(e.kind)}),c&&(0,t.jsx)("span",{className:"text-text-subtle text-xs tabular-nums",children:c})]})}e.s(["WalletSelectScreen",0,function({context:e,actorRef:r}){let{arena:i,external:c}=(0,a.useStakingWallets)(),d=e=>r.send({type:"SELECT_WALLET",wallet:e});return(0,t.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,t.jsx)(n.StepHeader,{title:s.stepCopy.wallet.title}),(0,t.jsx)("div",{className:"flex flex-col gap-2",children:[i,c].map(s=>s&&(0,t.jsx)(o,{wallet:s,move:e.move,onPick:d},s.kind))}),(0,t.jsx)("div",{className:"flex flex-col gap-1",children:(0,t.jsx)(l.StepExit,{state:"walletSelect",context:e,actorRef:r})})]})}])},825332,e=>{"use strict";var t=e.i(843476),s=e.i(672310),a=e.i(935205),r=e.i(689298),i=e.i(741111);e.i(732832);var n=e.i(551360);e.s(["MoatCard",0,function({moat:e,balance:l=null,disabledReason:o}){let c=r.moatCardCopy[e];return(0,t.jsxs)(s.Item,{value:e,disabled:!!o,className:(0,n.cn)("bg-surface-raised focus-visible:ring-brand flex w-full items-start gap-3 rounded-2xl border p-4 text-left transition-colors focus-visible:ring-2 focus-visible:outline-hidden","data-[state=checked]:border-brand data-[state=unchecked]:hover:border-border-default border-transparent","disabled:cursor-not-allowed disabled:opacity-50"),children:[(0,t.jsx)(a.ArenaTokenIcon,{chain:(0,i.getMoat)(e).chain,size:32}),(0,t.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsxs)("span",{className:"flex items-baseline justify-between gap-2",children:[(0,t.jsx)("span",{className:"text-text-primary text-sm font-semibold",children:c.title}),l&&(0,t.jsx)("span",{className:(0,n.cn)("shrink-0 text-xs tabular-nums",l.empty?"text-text-muted":"text-text-subtle"),children:l.text})]}),(0,t.jsx)("span",{className:"text-text-subtle text-xs",children:c.subtitle}),(0,t.jsx)("span",{className:"text-text-muted text-[11px] leading-4",children:c.detail}),o&&(0,t.jsx)("span",{className:"text-text-primary text-[11px] font-medium",children:o})]})]})}])},596786,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(672310),r=e.i(332337),i=e.i(689298),n=e.i(276518),l=e.i(575805),o=e.i(741111),c=e.i(705711),d=e.i(43067),u=e.i(695099),m=e.i(166181),x=e.i(825332),p=e.i(954221),h=e.i(462864);function f(e){let{data:t}=(0,l.useMoatStatus)(e);return(0,u.moatCardIssue)(t)}function g({moat:e,balance:s}){let a=f(e);return(0,t.jsx)(x.MoatCard,{moat:e,balance:s,disabledReason:a?(0,u.moatCardIssueText)(a):null})}e.s(["WhereToScreen",0,function({context:e,actorRef:l}
11){let[u,x]=(0,s.useState)(e.moat??"avalanche"),y=f(u),v=(0,s.useId)(),b=e.destination??e.wallet,j=(0,d.usePlanBalances)(b.address),w={legacyError:j.legacyError,arenaError:j.arenaError,warenaError:j.warenaError},S=(0,m.whereToStep)({moat:u,afterUnstake:"unstake"===e.path[0],balances:j.data,errors:w});return(0,t.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,t.jsx)("div",{id:v,children:(0,t.jsx)(p.StepHeader,{lead:e.unstakeAmountWei?i.stepCopy.whereTo.unstaked((0,n.formatArena)(e.unstakeAmountWei)):null,title:i.flowCopy.whereTitle,body:i.flowCopy.whereBody})}),(0,t.jsx)(a.Root,{"aria-labelledby":v,value:u,onValueChange:e=>{(0,c.isMoatId)(e)&&x(e)},className:"flex flex-col gap-2",children:o.MOAT_LIST.map(e=>(0,t.jsx)(g,{moat:e.id,balance:(0,m.whereToBalance)(e.id,j.data,w)},e.id))}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)(r.Button,{className:"w-full",disabled:null!==y||null===S,onClick:()=>{S&&l.send({type:"CHOOSE_MOAT",moat:u,step:S})},children:i.flowCopy.continue}),(0,t.jsx)(h.StepExit,{state:"whereTo",context:e,actorRef:l})]})]})}])},392851,e=>{"use strict";var t=e.i(843476),s=e.i(643531),a=e.i(689298);e.i(732832);var r=e.i(551360);e.s(["StepRail",0,function({steps:e,current:i,completed:n}){return e.length<2?null:(0,t.jsx)("ol",{className:"flex w-full items-start",children:e.map((l,o)=>{let c=o<n,d=o===e.length-1;return(0,t.jsxs)("li",{className:(0,r.cn)("flex items-start",!d&&"flex-1"),"aria-current":o===i?"step":void 0,children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-1.5",children:[(0,t.jsx)("div",{"aria-hidden":!0,className:(0,r.cn)("flex size-6 shrink-0 items-center justify-center rounded-full border text-[11px] font-medium",c?"bg-brand border-brand text-brand-foreground":o===i?"border-brand text-text-primary":"border-border-default text-text-muted"),children:c?(0,t.jsx)(s.Check,{className:"size-3.5"}):o+1}),(0,t.jsxs)("span",{className:(0,r.cn)("text-[11px]",o<=i||c?"text-text-primary":"text-text-muted"),children:[l.label,c&&(0,t.jsx)("span",{className:"sr-only",children:`, ${a.flowUiCopy.stepDone}`})]})]}),!d&&(0,t.jsx)("div",{"aria-hidden":!0,className:(0,r.cn)("mt-3 h-px flex-1",c?"bg-brand":"bg-border-default")})]},l.key)})})}])},397174,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(750813),r=e.i(705237),i=e.i(689298),n=e.i(988841),l=e.i(769510),o=e.i(453611),c=e.i(8788),d=e.i(772064),u=e.i(929547),m=e.i(166181),x=e.i(209951),p=e.i(503785),h=e.i(606503),f=e.i(278130),g=e.i(363486),y=e.i(981017),v=e.i(512334),b=e.i(970455),j=e.i(565290),w=e.i(596786),S=e.i(392851);let N=new Set([...u.STAKING_FLOW_ACTIVE_STATES,"walletSelect","unstakeInput","whereTo","bridgeInput","actionInput","gasInput","failed","interrupted"]);e.s(["StakingFlowModal",0,function(){let e=o.STAKING_FLOW_ID,C=(0,d.useStakingFlowStore)(e=>e.open),k=(0,d.useStakingFlowStore)(e=>e.seed),T=(0,d.useStakingFlowStore)(e=>e.actions.close),I=(0,r.useFlowActor)(e),E=(0,r.useFlowSelector)(e,e=>e.value),M=(0,r.useFlowSelector)(e,e=>e.context),{arena:A,isLoading:P}
11=(0,n.useStakingWallets)(),O=(0,m.modalIdleView)({arena:A,isLoading:P});(0,s.useEffect)(()=>{C&&"cancelled"===E&&(I.send({type:"DISMISS"}),T())},[C,E,I,T]);let L=e=>{e||("done"===E||"cancelled"===E?I.send({type:"DISMISS"}):(0,u.isStakingFlowInputState)(E)&&!(0,u.hasMovedArena)(M)&&(I.send({type:"CANCEL"}),I.send({type:"DISMISS"})),T())},D=()=>{I.send({type:"CANCEL"}),I.send({type:"DISMISS"}),T()},R=N.has(E)&&!!M.wallet,F=(0,l.arenaPlace)(M),B=F?i.flowUiCopy.arenaStays(F):null;return(0,t.jsx)(a.ResponsiveModal,{open:C,onOpenChange:L,className:"sm:max-w-[440px]",children:(0,t.jsxs)("div",{className:"flex flex-col gap-5 p-4 sm:p-6",children:[R&&(0,t.jsx)(S.StepRail,{steps:(0,c.cardSteps)(M),current:(0,c.currentStepIndex)(E,M),completed:(0,c.completedSteps)(M)}),(0,t.jsxs)("div",{className:"animate-in fade-in slide-in-from-right-2 duration-200",children:["idle"===E&&"entry"!==O&&(0,t.jsx)("p",{role:"status",className:"text-text-subtle py-8 text-center text-sm",children:"loading"===O?i.walletCopy.loading:i.walletCopy.noArenaWallet}),"idle"===E&&C&&A&&(0,t.jsx)(h.EntryScreen,{seed:k??{},onClose:T,onStart:(e,t,s,a)=>I.send({type:"START",owner:A.address,wallet:e,step:t,moat:s,move:a})},JSON.stringify(k)),(0,u.isStakingFlowActiveState)(E)&&(0,t.jsx)(y.ProgressPane,{stateValue:E,context:M}),"walletSelect"===E&&M.wallet&&(0,t.jsx)(j.WalletSelectScreen,{context:M,actorRef:I}),"unstakeInput"===E&&M.wallet&&(0,t.jsx)(b.UnstakeScreen,{context:M,actorRef:I}),"whereTo"===E&&M.wallet&&(0,t.jsx)(w.WhereToScreen,{context:M,actorRef:I}),"bridgeInput"===E&&M.wallet&&M.moat&&(0,t.jsx)(p.BridgeScreen,{context:M,actorRef:I}),"actionInput"===E&&M.wallet&&M.moat&&(0,t.jsx)(x.ActionScreen,{context:M,actorRef:I}),("failed"===E||"interrupted"===E)&&(0,t.jsx)(f.ErrorScreen,{stateValue:E,context:M,actorRef:I,onCancel:D,onClose:T}),"gasInput"===E&&M.destination&&M.moat&&(0,t.jsx)(g.GasScreen,{destination:M.destination,moat:M.moat,actorRef:I,onCancel:D,stayHint:B}),"done"===E&&(0,t.jsx)(v.SuccessScreen,{context:M,onDone:()=>L(!1)})]},E)]})})}])},681506,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(458866),r=e.i(645274),i=e.i(826507),n=e.i(750813);e.s(["ComposePostModal",0,()=>{let e,l,o,c,d,u=(0,a.useComposeModalStore)(e=>e.open),m=(0,a.useComposeModalStore)(e=>e.closeModal),x=(0,r.usePostStore)(e=>e.type),p=(0,r.usePostStore)(e=>e.thread),h=(0,r.usePostStore)(e=>e.parentCommentId),f=(0,r.usePostStore)(e=>e.community),g=(0,r.usePostStore)(e=>e.referrer),y=(0,r.usePostStore)(e=>e.reset),v=(0,s.useRef)(x),b=(0,s.useRef)(p),j=(0,s.useRef)(h),w=(0,s.useRef)(f),S=(0,s.useRef)(g);(0,s.useEffect)(()=>{u&&(v.current=x,b.current=p,j.current=h,w.current=f,S.current=g)},[u,x,p,h,f,g]);let N=(0,s.useCallback)(()=>{m(),y()},[m,y]),C=(0,s.useCallback)(()=>{m(),y()},[m,y]),k=(0,s.useCallback)(e=>{e||(m(),y())},[m,y]);return(0,t.jsxs)(n.ResponsiveModal,{open:u,onOpenChange:k,dialogClassName:"h-full max-h-[90vh] w-full max-w-[600px] p-0 sm:h-auto sm:bg-background bg-background",drawerClassName:"overflow-hidden p-0 bg-background max-h-[90vh]",children:[(0,t.jsx)("div",{className:"overflow-hidden sm:rounded-[20px]",children:(0,t.jsx)("div",{className:"flex h-full max-h-[90vh] flex-col overflow-y-auto",children:(e=u?x:v.current,l=u?p:b.current,o=u?h:j.current,c=u?f:w.current,d=u?g:S.current,"reply"===e&&l?(0,t.jsx)(i.ReplyPostEditor,{thread:l,parentCommentId:o,community:c,referrer:d,onSuccess:N,onCancel:C,showHeader:!1,className:"border-none pt-0!",contentClassName:"pt-0 pb-4 sm:pb-0",overrides:{autoFocus:!0,focusOnOpen:u,editorInputClassName:"pb-4"},placeholder:"Post your reply"}):"quote"===e&&l?(0,t.jsx)(i.QuotePostEditor,{thread:l,community:c,referrer:d,onSuccess:N,onCancel:C,showHeader:!1,className:"border-none",overrides:{autoFocus:!0,focusOnOpen:u}}):(0,t.jsx)(i.ComposePostEditor,{community:c,referrer:d,onSuccess:N,onCancel:C,showHeader:!1,className:"border-none",overrides:{autoFocus:!0,focusOnOpen:u}}))})}),(0,t.jsx)("div",{id:"compose-post-modal-container"})]})}])},582458,e=>{"use strict";let t=(0,e.i(475254).default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);e.s(["default",0,t])},89128,e=>{"use strict";var t=e.i(582458);
11e.s(["TriangleAlert",()=>t.default])},964215,e=>{"use strict";var t=e.i(843476),s=e.i(89128),a=e.i(37727),r=e.i(332337),i=e.i(750813),n=e.i(516344);e.s(["ExternalLinkNavigationModal",0,function(){let e=(0,n.useExternalLinkNavigationStore)(e=>e.href),l=(0,n.useExternalLinkNavigationStore)(e=>e.close);return(0,t.jsx)(i.ResponsiveModal,{open:!!e,onOpenChange:e=>{e||l()},dialogClassName:"max-w-sm",drawerClassName:"px-5 pt-2 pb-12",children:(0,t.jsxs)("div",{className:"relative flex flex-col items-center text-center",children:[(0,t.jsx)("button",{type:"button","aria-label":"Close",onClick:l,className:"text-text-subtle hover:text-text-primary absolute -top-1 -right-1 flex size-8 items-center justify-center rounded-full transition-colors",children:(0,t.jsx)(a.X,{className:"size-5"})}),(0,t.jsx)(s.TriangleAlert,{className:"text-brand mt-2 size-9"}),(0,t.jsx)("h2",{className:"text-text-primary mt-4 text-lg font-bold",children:"You're Leaving Arena"}),(0,t.jsx)("p",{className:"text-text-subtle mt-2 text-sm leading-relaxed",children:"You're being redirected to an external website. The Arena is not responsible for the content, security, or privacy practices of third-party sites. Proceed at your own discretion."}),(0,t.jsxs)("div",{className:"mt-6 flex w-full gap-3",children:[(0,t.jsx)(r.Button,{type:"button",variant:"outline",className:"flex-1",onClick:l,children:"Cancel"}),(0,t.jsx)(r.Button,{type:"button",className:"flex-1",onClick:()=>{e&&window.open(e,"_blank","noopener,noreferrer"),l()},children:"Continue"})]})]})})}])},219430,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(618566),r=e.i(266027),i=e.i(912598);e.i(156669);var n=e.i(361345),l=e.i(562164),o=e.i(332337),c=e.i(776639);e.i(753366);var d=e.i(484940),u=e.i(434672);e.i(28856);var m=e.i(634079),x=e.i(807214);e.s(["DeleteLivestreamModal",0,function({children:e}){let{user:p}=(0,x.useUser)(),[h,f]=(0,s.useState)(!1),g=(0,m.useCreateStreamStore)(e=>e.livestreamId),y=(0,a.useRouter)(),v=(0,i.useQueryClient)(),{data:b,isLoading:j}=(0,r.useQuery)({...d.livestreamQueries.livestreamSimpleInfo(g??""),enabled:!!g}),{mutateAsync:w,isPending:S}=(0,u.useDeleteThreadMutation)({onMutate:async({threadId:e})=>{l.toast.red("Livestream deleted successfully"),await v.cancelQueries({queryKey:["home","threads","my-feed"]}),await v.cancelQueries({queryKey:["home","threads","trending-feed"]});let t=v.getQueryData(["home","threads","my-feed"]),s=v.getQueryData(["home","threads","trending-feed"]);return v.setQueryData(["home","threads","my-feed"],t=>t?{...t,pages:t.pages.map(t=>({...t,threads:t.threads.filter(t=>t.id!==e)}))}:t),v.setQueryData(["home","threads","trending-feed"],t=>t?{...t,pages:t.pages.map(t=>({...t,threads:t.threads.filter(t=>t.id!==e)}))}:t),y.push("/live?streamTab=livestreams"),v.resetQueries({queryKey:["home","threads","livestreams-feed"]}),{previousMyFeed:t,previousTrendingFeed:s}},onError(e,t,s){v.setQueryData(["home","threads","my-feed"],s?.previousMyFeed),v.setQueryData(["home","threads","trending-feed"],s?.previousTrendingFeed)}});return!g||j||b&&b.livestream.hostId!==p?.id?null:(0,t.jsxs)(c.Dialog,{open:h,onOpenChange:f,children:[(0,t.jsx)(c.DialogTrigger,{asChild:!0,children:e}),(0,t.jsxs)(c.DialogContent,{className:"border-border-default/30 bg-surface-modal/90 shadow-modal max-w-xs gap-6 rounded-[10px] border backdrop-blur-xs",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,t.jsx)(n.TrashOutlineIcon,{className:"text-brand mx-auto 
11size-6"}),(0,t.jsx)("h3",{className:"text-text-primary text-center text-base font-semibold",children:"Delete your scheduled Live Stream"})]}),(0,t.jsx)("div",{className:"text-text-subtle flex flex-col gap-2 text-sm",children:(0,t.jsx)("p",{children:"You can edit every detail of your scheduled Live Stream, are you sure you want to continue?"})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(c.DialogClose,{className:"flex-1",asChild:!0,children:(0,t.jsx)(o.Button,{variant:"outline",children:"Close"})}),(0,t.jsx)(o.Button,{className:"flex-2",loading:S,onClick:()=>{b&&!j&&w({threadId:b.livestream.threadId})},children:"Delete"})]})]})]})}])},511811,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(905519),r=e.i(383900),i=e.i(401851),n=e.i(108957),l=e.i(826514),o=e.i(10676),c=e.i(960858),d=e.i(137906);e.i(156669);var u=e.i(896491),m=e.i(729459),x=e.i(290092),p=e.i(562164),h=e.i(332337),f=e.i(227766),g=e.i(776639),y=e.i(561993),v=e.i(793479),b=e.i(737398),j=e.i(242405);e.i(732832);var w=e.i(551360),S=e.i(153983);function N({date:e,setDate:s,time:l,setTime:o,onClose:c,onSchedule:p,todayDate:g}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex flex-1 items-center justify-start",children:(0,t.jsx)("button",{className:"p-1",onClick:c,children:(0,t.jsx)(u.ArrowBackOutlineIcon,{className:"text-text-primary size-5"})})}),(0,t.jsx)("h3",{className:"text-text-primary text-base leading-[22px] font-semibold",children:"Schedule your Live Stream"}),(0,t.jsx)("div",{className:"flex-1"})]}),(0,t.jsx)("div",{className:"flex flex-col gap-3",children:S.IS_MOBILE?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(v.Input,{type:"date",value:(0,i.format)(e,"yyyy-MM-dd"),min:g,onChange:e=>{let[t,a,r]=e.target.value.split("-");s(new Date(Number(t),Number(a)-1,Number(r),12))},className:(0,w.cn)("time-input-mobile rounded-full px-4 py-3 ps-12 text-left",!S.IS_IOS&&"time-input")}),(0,t.jsx)(v.Input,{type:"time",value:`${l?.hour.toString().padStart(2,"0")}:${l?.minute.toString().padStart(2,"0")}`,onChange:e=>{let[t,s]=e.target.value.split(":");o(new a.Time(parseInt(t),parseInt(s)))},className:(0,w.cn)("time-input-mobile rounded-full py-3 pr-4 pl-12 text-left",!S.IS_IOS&&"time-input")})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(b.Popover,{modal:!0,children:[(0,t.jsx)(b.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(h.Button,{variant:"outline",className:(0,w.cn)("w-full justify-start py-3 text-left font-normal",!e&&"text-muted-foreground"),children:[(0,t.jsx)(m.CalendarOutlineIcon,{className:"mr-2 size-6"}),e?(0,i.format)(e,(0,n.isThisYear)(e)?"E, MMM d":"E, PP"):(0,t.jsx)("span",{children:"Pick a date"})]})}),(0,t.jsx)(b.PopoverContent,{className:"w-full p-0",children:(0,t.jsx)(f.Calendar,{mode:"single",selected:e,onSelect:e=>{e&&s(e)},autoFocus:!0,disabled:e=>e<=(0,r.endOfYesterday)()})})]}),(0,t.jsx)(d.TimeField,{"aria-label":"Time",className:"space-y-2",hourCycle:12,value:l,onChange:o,children:(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"text-text-primary/80 pointer-events-none absolute inset-y-0 inset-s-0 z-10 flex items-center justify-center ps-4",children:(0,t.jsx)(x.ClockOutlineIcon,{className:"text-text-primary size-6","aria-hidden":"true"})}),(0,t.jsx)(d.DateInput,{className:"border-text-subtle relative inline-flex w-full items-center overflow-hidden rounded-full border px-4 py-3 ps-12 text-sm whitespace-nowrap shadow-xs outline-hidden transition-shadow data-disabled:opacity-50 data-focus-within:outline-hidden",children:e=>(0,t.jsx)(d.DateSegment,{segment:e,className:"text-text-primary data-focused:bg-border-default data-focused:data-placeholder:text-text-subtle data-focused:text-text-primary data-invalid:data-focused:data-placeholder:text-text-primary data-invalid:data-placeholder:text-text-primary data-invalid:text-text-primary data-placeholder:text-text-primary/70 data-[type=literal]:text-text-primary/70 data-invalid:data-focused:bg-danger-strong inline rounded-sm p-0.5 caret-transparent outline-0 outline-solid data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[type=literal]:px-0"})})]})})]})}),(0,t.jsx)(h.Button,{onClick:p,children:"Schedule Live Stream"})]})}e.s(["LiveStreamScheduleModal",0,function({children:e,scheduledDate:r,setScheduledDate:n}){let d=(0,o.roundToNearestHours)(new Date,{roundingMethod:"ceil"}
11),[u,m]=(0,s.useState)(!1),[x,h]=(0,s.useState)(()=>r?(0,l.parseISO)(r):d),[f,v]=(0,s.useState)(()=>{if(r){let e=(0,l.parseISO)(r);return new a.Time(e.getHours(),e.getMinutes())}return new a.Time(d.getHours(),d.getMinutes())}),b=(0,j.useMediaQuery)(j.BREAKPOINTS.sm),w=(0,i.format)(d,"yyyy-MM-dd"),S=e=>{if(m(e),!e)if(r){let e=(0,l.parseISO)(r);h(e),v(new a.Time(e.getHours(),e.getMinutes()))}else h(d),v(new a.Time(d.getHours(),d.getMinutes()))},C=()=>{if(!x||!f)return;let e=(0,c.set)(x,{hours:f?.hour,minutes:f?.minute});e<new Date?p.toast.danger("Please select a future date and time"):(n(e.toISOString()),m(!1))};return b?(0,t.jsxs)(g.Dialog,{open:u,onOpenChange:S,children:[(0,t.jsx)(g.DialogTrigger,{asChild:!0,children:e}),(0,t.jsx)(g.DialogContent,{className:"max-w-md",children:(0,t.jsx)(N,{date:x,setDate:h,time:f,setTime:v,onClose:()=>S(!1),onSchedule:C,todayDate:w})})]}):(0,t.jsxs)(y.Drawer,{open:u,onOpenChange:S,dismissible:!1,children:[(0,t.jsx)(y.DrawerTrigger,{asChild:!0,children:e}),(0,t.jsx)(y.DrawerContent,{className:"justify-start gap-8 text-left",children:(0,t.jsx)(N,{date:x,setDate:h,time:f,setTime:v,onClose:()=>S(!1),onSchedule:C,todayDate:w})})]})}])},677478,e=>{"use strict";var t=e.i(843476),s=e.i(618566),a=e.i(672310),r=e.i(741452),i=e.i(912598),n=e.i(401851);e.i(156669);var l=e.i(896491),o=e.i(729459),c=e.i(184282),d=e.i(537224),u=e.i(361345),m=e.i(562164),x=e.i(332337),p=e.i(110204),h=e.i(699375);e.i(753366);var f=e.i(903023);e.i(28856);var g=e.i(634079),y=e.i(807214),v=e.i(56162);e.i(493948);var b=e.i(591909),j=e.i(992251),w=e.i(219430),S=e.i(511811);e.s(["AdditionalSettingsForm",0,function(){let e=(0,i.useQueryClient)(),N=(0,s.useRouter)(),{user:C}=(0,y.useUser)(),k=(0,g.useCreateStreamStore)(e=>e.livestreamId),T=(0,g.useCreateStreamStore)(e=>e.data),I=(0,g.useCreateStreamStore)(e=>e.actions),E=(0,v.useStageStore)(e=>e.actions),M=(0,v.useStageStore)(e=>e.token),A=(0,v.useStageStore)(e=>e.myRole),P=!!(M&&A===j.ROLES.HOST),{mutate:O,isPending:L}=(0,f.useCreateLivestreamMutation)({onSuccess:t=>{m.toast.green("You created a new Stream!"),e.resetQueries({queryKey:["home","threads","livestreams-feed"]}),t.token&&!t.livestream.scheduledStartTime?(N.push(`/live/${C?.handle}`),E.reset()):N.push(`/${C?.handle}/status/${t.livestream.threadId}`),I.reset()}}),{mutateAsync:D,isPending:R}=(0,f.useEditLivestreamMutation)({onSuccess:t=>{m.toast.green("Stream updated successfully!"),e.resetQueries({queryKey:["home","threads","livestreams-feed"]}),N.push(`/${C?.handle}/status/${t.livestream.threadId}`),I.reset()}}),F=(0,r.useForm)({defaultValues:{gate:T.gate,gateType:T.gateType??"TICKET",scheduledStartTime:T.scheduledStartTime??null,nsfw:T.nsfw},onSubmit:async({value:e})=>
11{if(P&&!k){I.setData({gate:e.gate,gateType:e.gateType,nsfw:e.nsfw,scheduledStartTime:e.scheduledStartTime}),E.setIsEndStageModalOpen(!0);return}let t=T?.name,s=T?.type,a=T?.thumbnailUrl;if(!t||!s)return void m.toast.danger("Please enter a name and type before proceeding");if(e.gate&&"BADGE"===e.gateType&&!T.badges?.length)return void m.toast.danger("Please select at least one badge");let r={name:t,thumbnailUrl:a,type:s,privacyType:e.gate&&"TICKET"===e.gateType?b.ThreadPrivacyTypeEnum.SHAREHOLDERS:e.gate&&"BADGE"===e.gateType?b.ThreadPrivacyTypeEnum.BADGEHOLDERS:b.ThreadPrivacyTypeEnum.PUBLIC,badgeTypes:e.gate&&"BADGE"===e.gateType&&T.badges?.length?T.badges.map(e=>e.type):void 0,scheduledStartTime:e.scheduledStartTime??void 0,nsfw:e.nsfw??!1};k?D({livestreamId:k,...r}):O(r)}});return(0,t.jsxs)("div",{className:"flex h-full flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center p-6",children:[(0,t.jsx)("div",{className:"flex flex-1 justify-start",children:(0,t.jsx)("button",{type:"button",onClick:()=>{I.setCurrentStep("CORE");let e=F.state.values;I.setData({gate:e.gate,gateType:e.gateType,nsfw:e.nsfw,scheduledStartTime:e.scheduledStartTime})},children:(0,t.jsx)(l.ArrowBackOutlineIcon,{className:"text-text-primary size-5"})})}),(0,t.jsx)("h3",{className:"text-text-primary text-base leading-5 font-semibold",children:k?"Edit your Live Stream":"Create your Live Stream"}),k?(0,t.jsx)("div",{className:"flex flex-1 justify-end",children:(0,t.jsx)(w.DeleteLivestreamModal,{children:(0,t.jsx)("button",{type:"button",children:(0,t.jsx)(u.TrashOutlineIcon,{className:"text-brand size-5"})})})}):(0,t.jsx)("div",{className:"flex-1"})]}),(0,t.jsx)("form",{onSubmit:e=>{e.preventDefault(),e.stopPropagation(),F.handleSubmit()},children:(0,t.jsx)("div",{className:"flex grow flex-col sm:grow-0",children:(0,t.jsxs)("div",{className:"flex flex-col gap-6 p-6",children:[(0,t.jsx)(F.Field,{name:"gate",children:e=>(0,t.jsxs)(p.Label,{className:"flex w-full items-center justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)("div",{className:"text-text-primary text-sm font-medium normal-case",children:"Gate my Stream"}),(0,t.jsx)("p",{className:"text-text-subtle max-w-48 text-xs font-normal normal-case",children:"Select who can join your Stream"})]}),(0,t.jsx)(h.Switch,{checked:e.state.value,onCheckedChange:t=>{e.handleChange(t)}})]})}),(0,t.jsx)(F.Subscribe,{selector:e=>e.values.gate,children:e=>e&&(0,t.jsx)(F.Field,{name:"gateType",children:e=>(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)(a.Root,{value:e.state.value,onValueChange:t=>e.handleChange(t),className:"flex items-center justify-between gap-4",children:[(0,t.jsxs)(a.Item,{value:"TICKET",className:"border-text-subtle text-text-primary data-[state=checked]:border-brand relative flex-1 justify-start rounded-[10px] border p-4 text-left text-sm font-semibold",children:["Ticket Gated ",(0,t.jsx)("br",{})," Stream",(0,t.jsx)("img",{src:"/images/ticket.png",alt:"Easy Live Stream",className:"pointer-events-none absolute right-2 bottom-2 size-10"})]}),(0,t.jsxs)(a.Item,{value:"BADGE",className:"border-text-subtle text-text-primary data-[state=checked]:border-brand relative flex-1 justify-start rounded-[10px] border p-4 text-left text-sm font-semibold",children:["Badge Gated ",(0,t.jsx)("br",{})," Stream",(0,t.jsx)("img",{src:"/images/sword.png",alt:"Easy Live Stream",className:"pointer-events-none absolute right-2 bottom-2 size-10"})]})]}),"TICKET"===e.state.value&&(0,t.jsxs)("div",{className:"bg-surface-raised rounded-lg p-4 text-center text-xs/5",children:[(0,t.jsx)("h5",{className:"text-text-primary",children:"Make it exclusive"}),(0,t.jsx)("p",{className:"text-text-muted",children:"Treat your ticket holders with an exclusive stream just for them!"})]}),"BADGE"===e.state.value&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"bg-surface-raised rounded-lg p-4 text-center text-xs/5",children:[(0,t.jsx)("h5",{className:"text-text-primary",children:"Target Web3 communities"}),(0,t.jsx)("p",{className:"text-text-muted",children:"Only users from certain communities inside the Arena can join."})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 rounded-[10px] px-10",children:[T.badges?.map(({name:e,image:s,type:a})=>(0,t.jsxs)(x.Button,{type:"button",variant:"outline",className:"border-brand shrink-0 cursor-default gap-1.5 px-3 py-1.5 text-base/5 font-semibold hover:bg-transparent",children:[(0,t.jsx)("div",{className:"w-max",children:(0,t.jsx)("img",{src:s,className:"h-[18px] w-auto",alt:`${e} logo`})}),(0,t.jsx)("span",{children:e})]},a)),(0,t.jsxs)(x.Button,{type:"button",variant:"outline",className:"self-center px-3 py-1.5 text-xs",onClick:()=>{I.setCurrentStep("BADGES");let e=F.state.values;I.setData({gate:e.gate,gateType:e.gateType,nsfw:e.nsfw,scheduledStartTime:e.scheduledStartTime})},children:[(0,t.jsx)(d.PencilAltOutlineIcon,{className:"mr-2 size-5"})," ",T.badges?.length&&T.badges.length>0?"Edit":"Pick Invited Communities"]})]})]})]})})}),(0,t.jsx)(F.Field,{name:"nsfw",children:e=>(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)(p.Label,{className:"flex w-full items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"text-text-primary text-sm font-medium normal-case",children:"NSFW Content"}),(0,t.jsx)(h.Switch,{checked:e.state.value,onCheckedChange:t=>{e.handleChange(t)}
11})]}),(0,t.jsxs)("div",{className:"bg-surface-raised rounded-lg p-4 text-center text-xs/5",children:[(0,t.jsx)("h5",{className:"text-text-primary",children:"Spicy Content?"}),(0,t.jsx)("p",{className:"text-text-muted",children:"Please pick this option or mods can take down your stream."})]})]})}),(0,t.jsx)(F.Field,{name:"scheduledStartTime",children:e=>(0,t.jsxs)("div",{className:"mt-4 flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(F.Subscribe,{selector:e=>({type:e.values.gateType,gate:e.values.gate}),children:({gate:s,type:a})=>(0,t.jsx)(x.Button,{className:"w-full grow",type:"submit",disabled:s&&"BADGE"===a&&(!T.badges||0===T.badges.length),loading:L||R,children:e.state.value?"Save Scheduled Stream":"Start Stream Now"})}),(0,t.jsx)(S.LiveStreamScheduleModal,{scheduledDate:e.state.value,setScheduledDate:e.handleChange,children:(0,t.jsx)(x.Button,{type:"button",variant:"outline",className:"size-11",children:(0,t.jsx)(o.CalendarOutlineIcon,{className:"text-text-primary size-6"})})})]}),e.state.value?(0,t.jsxs)("div",{className:"bg-surface-raised text-text-subtle relative w-full rounded-lg p-2 text-center text-xs",children:["Starting on"," ",(0,n.format)(new Date(e.state.value),"EEEE, MMM d 'at' h:mm a"),k?null:(0,t.jsx)("button",{type:"button",className:"bg-background/25 absolute top-1/2 right-0.5 flex size-7 -translate-y-1/2 items-center justify-center rounded-lg backdrop-blur-md",onClick:()=>{e.handleChange(null)},children:(0,t.jsx)(c.CloseOutlineIcon,{className:"text-text-primary size-5"})})]}):null]})})]})})})]})}])},589091,e=>{"use strict";var t=e.i(843476),s=e.i(271645);e.i(156669);var a=e.i(896491),r=e.i(562164),i=e.i(332337),n=e.i(526424);e.i(28856);var l=e.i(634079);e.i(732832);var o=e.i(551360);e.s(["BadgesForm",0,function(){let e=(0,n.useBadges)(),c=(0,l.useCreateStreamStore)(e=>e.data.badges),d=(0,l.useCreateStreamStore)(e=>e.actions),[u,m]=(0,s.useState)(()=>c||[]);return(0,t.jsxs)("div",{className:"flex h-full flex-col gap-8 p-6",children:[(0,t.jsxs)("div",{className:"flex h-full flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsx)("button",{type:"button",onClick:()=>{d.setCurrentStep("ADDITIONAL-SETTINGS")},className:"flex items-center justify-center",children:(0,t.jsx)(a.ArrowBackOutlineIcon,{className:"text-text-primary size-5"})})}),(0,t.jsx)("h3",{className:"text-text-primary text-base/5 font-semibold",children:"Select Community Badges"}),(0,t.jsx)("div",{className:"flex-1"})]}),(0,t.jsx)("p",{className:"text-text-primary text-center text-xs",children:"Pick up to 3 badges to allow them to join your Stream."})]}),(0,t.jsx)("div",{className:"flex flex-wrap items-center justify-center gap-[14px] rounded-[10px]",children:e.map(({name:e,image:s,type:a})=>{let n=u.some(e=>e.type===a);return(0,t.jsxs)(i.Button,{type:"button",variant:"outline",className:(0,o.cn)("shrink-0 gap-1.5 py-1.5 text-base leading-5 font-medium",n&&"border-brand"),onClick:()=>{n?m(e=>e.filter(e=>e.type!==a)):u.length>=3?r.toast.danger("You can only select up to 3 badges"):m(t=>[...t,{name:e,type:a,image:s}])},children:[(0,t.jsx)("div",{className:"w-max",children:(0,t.jsx)("img",{src:s,className:(0,o.cn)("h-[18px] w-auto",!n&&"grayscale"),alt:`${e} logo`})}),(0,t.jsx)("span",{children:e})]},a)})}),(0,t.jsx)(i.Button,{type:"button",className:"w-full grow sm:w-auto sm:px-8 sm:py-2",onClick:()=>{d.setData({badges:u}),d.setCurrentStep("ADDITIONAL-SETTINGS")},children:"Confirm"})]})}])},947929,e=>{"use strict";var t=e.i(843476),s=e.i(266027),a=e.i(912598),r=e.i(237016);e.i(753366);var i=e.i(484940),n=e.i(903023),l=e.i(955707);e.i(156669);var o=e.i(97521),c=e.i(557832),d=e.i(562164),u=e.i(332337),m=e.i(110204),x=e.i(676729);e.s(["IngressControls",0,function(){let e=(0,l.useLivestreamStore)(e=>e.id),p=(0,a.useQueryClient)(),{data:h}=(0,s.useQuery)(i.livestreamQueries.livestreamIngress()),{mutateAsync:f,isPending:g}=(0,n.useGenerateLivestreamIngressMutation)({onSuccess:()=>{d.toast.green("Ingress generated"),p.invalidateQueries({queryKey:i.livestreamQueries.livestreamIngressKey()})}}),y=h?.server??"",v=h?.streamKey??"",b=async()=>{await f({livestreamId:e})};return h?(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(m.Label,{className:"text-text-primary",children:"SERVER"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(x.TextInput,{value:y,className:"truncate",disabled:!0}),(0,t.jsx)(r.default,{text:y,onCopy:()=>{d.toast.green("Copied to clipboard")},children:(0,t.jsx)("button",{type:"button",className:"absolute top-1/2 right-4 -translate-y-1/2",children:(0,t.jsx)(o.CopyOutlineIcon,{className:"text-text-muted size-5"})})})]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(m.Label,{className:"text-text-primary",children:"STREAMING KEY"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(x.TextInput,{value:v,type:"password",disabled:!0}),(0,t.jsx)(r.default,{text:v,onCopy:()=>{d.toast.green("Copied to clipboard")},children:(0,t.jsx)("button",{type:"button",className:"absolute top-1/2 right-4 -translate-y-1/2",children:(0,t.jsx)(o.CopyOutlineIcon,{className:"text-text-muted size-5"})})})]}),(0,t.jsx)("p",{className:"text-danger-strong text-xs",children:"Warning: Never show your streaming key to anyone."})]}),(0,t.jsx)("div",{className:"flex flex-col items-center gap-2",children:(0,t.jsxs)(u.Button,{type:"button",variant:"outline",className:"px-3 py-1.5 text-xs",onClick:b,disabled:g,children:[(0,t.jsx)(c.ToolOutlineIcon,{className:"mr-2 size-5"})," Reset Streaming Key"]})})]}):(0,t.jsx)("div",{className:"mt-2 flex flex-col items-center gap-2",children:(0,t.jsxs)(u.Button,{type:"button",variant:"outline",className:"px-3 py-1.5 text-xs",onClick:b,disabled:g,children:[(0,t.jsx)(c.ToolOutlineIcon,{className:"mr-2 size-5"})," Generate Streaming Key"]})})}])},42235,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(767660),r=e.i(266027);e.i(156669);var i=e.i(976616),n=e.i(268061),l=e.i(332337),o=e.i(776639);e.i(753366);var c=e.i(484940),d=e.i(947929);e.s(["StreamSettings",0,function(){(0,r.useQuery)(c.livestreamQueries.livestreamIngress());
11let[e,u]=(0,s.useState)(!1),[m,x]=(0,s.useState)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a.Root,{type:"single",value:m,onValueChange:x,collapsible:!0,children:(0,t.jsxs)(a.Item,{value:"stream-settings",className:"border-surface-elevated bg-surface-raised rounded-lg border",children:[(0,t.jsx)(a.Header,{className:"flex",children:(0,t.jsxs)(a.Trigger,{className:"flex flex-1 items-center justify-between p-4 text-sm font-semibold transition-all [&[data-state=open]>svg]:rotate-90",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{children:"Stream Settings"}),(0,t.jsx)("div",{role:"button",tabIndex:0,onClick:e=>{e.stopPropagation(),x("stream-settings"),u(!0)},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&u(!0)},children:(0,t.jsx)(n.InfoCircleOutlineIcon,{className:"text-text-primary size-4"})})]}),(0,t.jsx)(i.ChevronRightOutline,{className:"text-text-primary size-5 shrink-0 transition-transform duration-200"})]})}),(0,t.jsx)(a.Content,{className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm transition-all",children:(0,t.jsx)("div",{className:"px-4 pb-4",children:(0,t.jsx)(d.IngressControls,{})})})]})}),(0,t.jsx)(o.Dialog,{open:e,onOpenChange:u,children:(0,t.jsxs)(o.DialogContent,{className:"max-w-md",children:[(0,t.jsx)(o.DialogHeader,{children:(0,t.jsx)(o.DialogTitle,{className:"text-text-primary text-base font-semibold",children:"How do I setup my Stream?"})}),(0,t.jsxs)("div",{className:"text-text-subtle mt-2 flex flex-col gap-4 text-sm",children:[(0,t.jsxs)("p",{children:["To set your server and streaming key on OBS, go to: ",(0,t.jsx)("br",{})," ","Settings",">"," Stream ",">"," Service ",">"," Custom and copy and paste both items from this Streaming Settings pop-up."]}),(0,t.jsx)("p",{children:"If you are running into problems like layout configuration, audio issues, latency, image quality, etc: this video is an excellent resource to troubleshoot issues."})]}),(0,t.jsxs)("div",{className:"border-brand relative isolate mt-2 w-full overflow-hidden rounded-md border",children:[(0,t.jsx)("img",{src:"/images/stream-tutorial-thumbnail.jpg",alt:"Youtube Tutorial for Stream Setup",className:"aspect-video w-full object-cover"}),(0,t.jsx)("div",{className:"bg-background/50 pointer-events-none absolute inset-0"}),(0,t.jsx)(l.Button,{type:"button",className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 px-7 py-3",asChild:!0,children:(0,t.jsx)("a",{href:"https://youtu.be/fFKs1AMEZS4?si=YvgMqcJ4sM6bQowB",target:"_blank",rel:"noopener noreferrer",children:"Watch Video on YouTube"})})]})]})})]})}])},125399,e=>{"use strict";var t=e.i(843476),s=e.i(672310),a=e.i(741452),r=e.i(510665);e.i(156669);var i=e.i(896491),n=e.i(742763),l=e.i(537224),o=e.i(361345),c=e.i(562164),d=e.i(332337),u=e.i(793479),m=e.i(110204);e.i(28856);var x=e.i(634079);e.i(732832);var p=e.i(551360),h=e.i(219430),f=e.i(203922),g=e.i(42235);e.s(["CoreStreamForm",0,function(){let e=(0,x.useCreateStreamStore)(e=>e.livestreamId),y=(0,x.useCreateStreamStore)(e=>e.actions),{name:v,type:b,thumbnailUrl:j}=(0,x.useCreateStreamStore)(e=>e.data),w=(0,a.useForm)({defaultValues:{name:v??"",type:b??"EASY"},onSubmit:async({value:e})=>{y.setData({name:e.name,type:e.type}),y.setCurrentStep("ADDITIONAL-SETTINGS")}});return(0,t.jsxs)("div",{className:"flex h-full flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center p-6",children:[(0,t.jsx)("div",{className:"flex flex-1 justify-start",children:(0,t.jsx)("button",{type:"button",onClick:()=>{w.reset(),y.reset()},children:(0,t.jsx)(i.ArrowBackOutlineIcon,{className:"text-text-primary size-5"})})}),(0,t.jsx)("h3",{className:"text-text-primary text-base leading-5 font-semibold",children:e?"Edit your Live Stream":"Create your Live Stream"}),e?(0,t.jsx)("div",{className:"flex flex-1 justify-end",children:(0,t.jsx)(h.DeleteLivestreamModal,{children:(0,t.jsx)("button",{type:"button",children:(0,t.jsx)(o.TrashOutlineIcon,{className:"text-brand size-5"})})})}):(0,t.jsx)("div",{className:"flex-1"})]}),(0,t.jsx)("form",{onSubmit:e=>{e.preventDefault(),e.stopPropagation(),w.handleSubmit()},children:(0,t.jsx)("div",{className:"flex grow flex-col sm:grow-0",children:(0,t.jsxs)("div",{className:"flex flex-col gap-6 p-6",children:[(0,t.jsx)(w.Field,{name:"name",validators:{onChange:({value:e})=>
11{if(0===e.trim().length)return"Name is required"}},children:e=>(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("div",{className:"flex items-center justify-between gap-2",children:(0,t.jsx)(m.Label,{htmlFor:"livestream-editor",className:"text-text-primary",children:"Name"})}),(0,t.jsx)(u.Input,{id:"livestream-editor",type:"text",placeholder:"Name for your Live Stream",className:"text-text-primary placeholder:text-text-subtle min-h-[50px] w-full bg-transparent p-4 pr-10 text-sm focus:outline-hidden",value:e.state.value,onChange:t=>{e.handleChange(t.target.value)},maxLength:60,children:(0,t.jsx)("span",{className:"text-text-subtle pointer-events-none absolute top-4 right-4 text-sm",children:60-e.state.value.length})}),!e.state.meta.isValid&&(0,t.jsx)("span",{role:"alert",className:"text-danger text-xs",children:e.state.meta.errors.join(", ")})]})}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("div",{className:"flex items-center justify-between gap-2",children:(0,t.jsx)(m.Label,{htmlFor:"livestream-editor",className:"text-text-primary",children:"Thumbnail (optional)"})}),(0,t.jsx)(r.default,{onDrop:e=>{let t=e[0];if(t){let e=URL.createObjectURL(t);y.setPreviewURL(e);let s=w.state.values;y.setData({name:s.name,type:s.type}),y.setCurrentStep("THUMBNAIL")}},maxFiles:1,maxSize:5242880,onDropRejected:e=>{e.forEach(e=>{e.errors.forEach(e=>{"file-too-large"===e.code?c.toast.danger("Uploaded image file cannot exceed 5 MB"):"file-invalid-type"===e.code?c.toast.danger("Please upload a valid image file (PNG, JPG, JPEG)"):c.toast.danger("File upload failed. Please try again.")})})},accept:{"image/*":[".png",".jpg",".jpeg"]},children:({getRootProps:e,getInputProps:s,isDragActive:a,open:r})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{...s()}),j?(0,t.jsx)(w.Subscribe,{selector:e=>e.values.name,children:e=>(0,t.jsxs)(f.LivestreamCardPreview,{title:e,type:"THUMBNAIL",url:j,children:[(0,t.jsxs)(d.Button,{type:"button",variant:"secondary",className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 py-2 text-xs md:py-3 md:text-sm",onClick:r,children:[(0,t.jsx)(l.PencilAltOutlineIcon,{className:"text-background size-6"}),(0,t.jsx)("span",{children:"Edit Thumbnail"})]}),(0,t.jsx)("button",{type:"button",className:"bg-background/25 absolute top-3 right-3 flex size-[30px] items-center justify-center rounded-lg backdrop-blur-md",onClick:()=>{y.setThumbnailURL(null)},children:(0,t.jsx)(o.TrashOutlineIcon,{className:"text-text-primary size-5"})})]})}):(0,t.jsxs)("div",{...e(),className:(0,p.cn)("border-text-subtle flex cursor-pointer flex-col items-center gap-2.5 rounded-lg border border-dashed p-4 select-none",a&&"border-brand"),children:[(0,t.jsx)(n.ImagePlusOutlineIcon,{className:"text-text-primary size-6"}),(0,t.jsx)("p",{className:"text-text-subtle text-sm",children:"JPEG, PNG, up to 5MB"})]})]})})]}),(0,t.jsx)(w.Field,{name:"type",children:e=>(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)(s.Root,{value:e.state.value,onValueChange:t=>e.handleChange(t),className:"flex items-center justify-between gap-4",children:[(0,t.jsxs)(s.Item,{value:"EASY",className:"border-text-subtle text-text-primary data-[state=checked]:border-brand relative flex-1 justify-start rounded-[10px] border p-4 text-left text-sm font-semibold",children:["Easy ",(0,t.jsx)("br",{})," Live Stream",(0,t.jsx)("img",{src:"/images/easy.png",alt:"Easy Live Stream",className:"pointer-events-none absolute right-2 bottom-2 size-10"})]}),(0,t.jsxs)(s.Item,{value:"PRO",className:"border-text-subtle text-text-primary data-[state=checked]:border-brand relative flex-1 justify-start rounded-[10px] border p-4 text-left text-sm font-semibold",children:["Pro ",(0,t.jsx)("br",{})," Live Stream",(0,t.jsx)("img",{src:"/images/pro.png",alt:"Pro Live Stream",className:"pointer-events-none absolute right-2 bottom-2 size-10"})]})]}),"EASY"===e.state.value&&(0,t.jsxs)("div",{className:"bg-surface-raised rounded-lg p-4 text-center text-xs/5",children:[(0,t.jsx)("h5",{className:"text-text-primary",children:"Don’t know where to start?"}),(0,t.jsx)("p",{className:"text-text-muted",children:"Just share your cam and your screen, like a video call!"})]}),"PRO"===e.state.value&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"bg-surface-raised rounded-lg p-4 text-center text-xs/5",children:[(0,t.jsx)("h5",{className:"text-text-primary",children:"Looks like you are a seasoned streamer!"}),(0,t.jsx)("p",{className:"text-text-muted",children:"Set your server and streaming key and you’ll be good to go."})]}),(0,t.jsx)(g.StreamSettings,{})]})]})}),(0,t.jsx)(w.Subscribe,{selector:e=>({canSubmit:e.values.name.trim().length>0,type:e.values.type}),children:({canSubmit:e,type:s})=>(0,t.jsxs)(d.Button,{className:"mt-4 w-full grow",type:"submit",disabled:!e,children:["Continue ","PRO"===s&&"(Stream Settings are done)"]})})]})})})]})}])},124715,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(88653),r=e.i(846932),i=e.i(465468),n=e.i(219527),l=e.i(422233);e.i(156669);var o=e.i(896491),c=e.i(562164),d=e.i(332337);e.i(28856);var u=e.i(634079);e.i(732832);var m=e.i(573139),x=e.i(560928),p=e.i(203922);e.s(["ThumbnailForm",0,function(){let e=(0,u.useCreateStreamStore)(e=>e.data.name),h=(0,u.useCreateStreamStore)(e=>e.previewURL),f=(0,u.useCreateStreamStore)(e=>
11e.actions),[g,y]=(0,s.useState)({x:0,y:0}),[v,b]=(0,s.useState)(1),[j,w]=(0,s.useState)(null),[S,N]=(0,s.useState)(!1),[C,k]=(0,s.useState)(0),T=i.useMotionTemplate`${C}%`,I=async()=>{if(!j)return;let e=await (0,x.default)(h,j);if(!e)return;e.name="image.jpeg",e.lastModified=new Date;let t=new File([e],`${(0,l.v4)()}.jpg`,{type:"image/jpeg"});N(!0);try{let e=await (0,m.upload)({file:t,onProgressChange:e=>{k(e)}});f.setThumbnailURL(e.url)}catch(e){console.error(e),c.toast.danger("File upload failed"),N(!1),k(0)}};return(0,t.jsxs)("div",{className:"flex h-full flex-col gap-8",children:[(0,t.jsxs)("div",{className:"flex items-center p-6",children:[(0,t.jsx)("div",{className:"flex flex-1 justify-start",children:(0,t.jsx)("button",{type:"button",onClick:()=>f.setPreviewURL(null),children:(0,t.jsx)(o.ArrowBackOutlineIcon,{className:"text-text-primary size-5"})})}),(0,t.jsx)("h3",{className:"text-text-primary text-base leading-5 font-semibold",children:"Crop Thumbnail Image"}),(0,t.jsx)("div",{className:"flex-1"})]}),h?(0,t.jsx)("div",{className:"px-6",children:(0,t.jsxs)("div",{className:"relative aspect-square w-full",children:[(0,t.jsx)(n.default,{showGrid:!1,maxZoom:2,image:h||void 0,crop:g,zoom:v,style:{cropAreaStyle:{borderRadius:"10px",border:"none",color:"transparent"}},aspect:16/9,onCropChange:y,onZoomChange:b,onCropComplete:(e,t)=>{w(t)},objectFit:"horizontal-cover"}),(0,t.jsx)(p.LivestreamCardPreview,{title:e,type:"PLACEHOLDER",children:(0,t.jsx)(d.Button,{type:"button",variant:"secondary",className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 py-2 text-xs disabled:opacity-80 md:py-3 md:text-sm",disabled:!0,children:"Join Live Stream"})}),(0,t.jsx)(a.AnimatePresence,{children:S&&(0,t.jsx)(r.motion.div,{style:{width:T},exit:{opacity:0},className:"bg-brand absolute bottom-0 left-0 z-10 h-1 min-w-4"})})]})}):null,(0,t.jsx)("div",{className:"px-6 py-4",children:(0,t.jsx)(d.Button,{type:"button",className:"w-full grow sm:px-8 sm:py-2",onClick:I,children:"Save"})})]})}])},236997,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(266027),r=e.i(868499),i=e.i(561993),n=e.i(526424),l=e.i(242405);e.i(753366);var o=e.i(484940);e.i(28856);var c=e.i(634079);e.i(493948);var d=e.i(591909);e.i(732832);var u=e.i(551360),m=e.i(677478),x=e.i(589091),p=e.i(125399),h=e.i(124715);let f=()=>{let e=(0,l.useMediaQuery)(l.BREAKPOINTS.sm);switch((0,c.useCreateStreamStore)(e=>e.currentStep)){case"CORE":return(0,t.jsx)(p.CoreStreamForm,{});case"THUMBNAIL":return(0,t.jsx)(h.ThumbnailForm,{});case"ADDITIONAL-SETTINGS":return(0,t.jsx)(m.AdditionalSettingsForm,{});case"BADGES":if(!e)return(0,t.jsx)(m.AdditionalSettingsForm,{});return(0,t.jsx)(x.BadgesForm,{})}},g=(0,s.memo)(()=>{let e=(0,c.useCreateStreamStore)(e=>e.livestreamId),t=(0,c.useCreateStreamStore)(e=>e.actions),{data:r,isLoading:i}=(0,a.useQuery)({...o.livestreamQueries.livestreamSimpleInfo(e??""),enabled:!!e}),l=r?.livestream.badgeTypes?.map(e=>e.badgeType)??[],u=(0,n.useFindBadgesByTypes)(l);return(0,s.useEffect)(()=>{if(e&&r&&!i){let e=r.livestream.privacyType!==d.ThreadPrivacyTypeEnum.PUBLIC,s=r.livestream.privacyType===d.ThreadPrivacyTypeEnum.BADGEHOLDERS?"BADGE":"TICKET";t.setData({name:r.livestream.name,thumbnailUrl:r.livestream.thumbnailUrl,type:r.livestream.type,gate:e,gateType:s,badges:u,scheduledStartTime:r.livestream.scheduledStartTime})}},[r,e,t,i,u]),null});g.displayName="EditLivestreamModalInitialData",e.s(["CreateLivestreamModal",0,function(){let e=(0,l.useMediaQuery)(l.BREAKPOINTS.sm),s=(0,c.useCreateStreamStore)(e=>e.open),a=(0,c.useCreateStreamStore)(e=>e.currentStep),n=(0,c.useCreateStreamStore)(e=>e.actions);return(0,t.jsx)(r.AlertDialog,{open:s,onOpenChange:e=>{n.setOpen(e)},children:(0,t.jsxs)(r.AlertDialogContent,{className:(0,u.cn)("pt-pwa bg-background/75 sm:bg-background/75 flex h-full w-full max-w-md flex-col overflow-y-auto p-0 backdrop-blur-xs transition-colors sm:h-auto sm:max-h-screen","BADGES"===a&&e&&"bg-surface-modal/90 sm:bg-surface-modal/90"),children:[(0,t.jsx)(f,{}),(0,t.jsx)(i.Drawer,{open:"BADGES"===a&&!e,onOpenChange:()=>{n.setCurrentStep("ADDITIONAL-SETTINGS")}
11,disablePreventScroll:!0,children:(0,t.jsx)(i.DrawerContent,{className:"max-h-screen p-0",children:(0,t.jsx)("div",{className:"h-full overflow-y-auto",children:(0,t.jsx)(x.BadgesForm,{})})})}),(0,t.jsx)(g,{})]})})}])},875018,e=>{"use strict";var t=e.i(843476),s=e.i(242405);e.i(753366);var a=e.i(903023),r=e.i(955707),i=e.i(332337),n=e.i(776639),l=e.i(561993);e.s(["EndLivestreamConfirmationModal",0,function(){let e=(0,r.useLivestreamStore)(e=>e.id),o=(0,r.useLivestreamStore)(e=>e.isEndLivestreamModalOpen),c=(0,r.useLivestreamStore)(e=>e.actions),d=(0,s.useMediaQuery)(s.BREAKPOINTS.sm),{mutateAsync:u,isPending:m}=(0,a.useEndLivestreamMutation)({onSuccess:()=>{c.reset()}}),x=async()=>{e&&(await u({livestreamId:e}),c.setIsEndLivestreamModalOpen(!1))},p=()=>{c.setIsEndLivestreamModalOpen(!1)};return d?(0,t.jsx)(n.Dialog,{open:o,onOpenChange:p,children:(0,t.jsxs)(n.DialogContent,{className:"max-w-sm",children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{className:"text-lg font-semibold",children:"Are you sure you want to end the Live Stream?"}),(0,t.jsx)(n.DialogDescription,{className:"text-text-subtle text-sm",children:"This will end the Live Stream and all viewers will be disconnected."})]}),(0,t.jsxs)(n.DialogFooter,{children:[(0,t.jsx)(i.Button,{variant:"outline",className:"flex-1",onClick:p,disabled:m,children:"Cancel"}),(0,t.jsx)(i.Button,{className:"flex-2",onClick:x,loading:m,children:"End Live Stream"})]})]})}):(0,t.jsx)(l.Drawer,{open:o,onOpenChange:p,children:(0,t.jsxs)(l.DrawerContent,{className:"justify-start gap-6 text-left",children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{className:"text-lg font-semibold",children:"Are you sure you want to end the stage?"}),(0,t.jsx)(n.DialogDescription,{className:"text-text-subtle text-sm",children:"This will end the stage and all participants will be disconnected."})]}),(0,t.jsxs)(n.DialogFooter,{className:"flex flex-row items-center gap-2",children:[(0,t.jsx)(i.Button,{variant:"outline",className:"flex-1",onClick:p,disabled:m,children:"Cancel"}),(0,t.jsx)(i.Button,{className:"flex-2",onClick:x,loading:m,children:"End Stage"})]})]})})}])},919558,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(678078),r=e.i(868499),i=e.i(332337),n=e.i(932434),l=e.i(55930);e.i(732832);var o=e.i(551360),c=e.i(349507);let d={evm:{label:"EVM",icon:"/assets/coins/ethereum.png"},solana:{label:"Solana",icon:"/assets/coins/solana.png"}},u=()=>{try{navigator.clipboard?.writeText("")}catch{}};function m({children:e,onClick:s,disabled:a}){return(0,t.jsx)("button",{type:"button",onClick:s,disabled:a,className:"text-text-subtle hover:text-text-primary mx-auto py-1 text-sm font-medium transition-colors disabled:opacity-50",children:e})}function x({wallets:e,blocking:s,copy:a,onUpgrade:r,onLater:n}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2 text-center",children:[(0,t.jsx)("h2",{className:"text-text-primary text-xl font-semibold",children:a?.title??"A safer wallet is ready"}),(0,t.jsx)("p",{className:"text-text-subtle text-sm",children:a?.description??"Upgrade to enhanced security with MPC technology. Your address stays the same."})]}),(0,t.jsx)("ul",{className:"flex flex-col gap-3 px-1",children:["Stronger protection with multi-party computation","Recover access without a seed phrase","Keep your current wallet address"].map(e=>(0,t.jsxs)("li",{className:"text-text-subtle flex items-center gap-3 text-sm",children:[(0,t.jsx)("span",{className:"bg-text-subtle/60 size-1.5 shrink-0 rounded-full"}),(0,t.jsx)("span",{children:e})]},e))}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("p",{className:"text-text-subtle text-xs font-medium tracking-wide uppercase",children:"Wallets to Upgrade"}),(0,t.jsx)("div",{className:"border-surface-elevated divide-surface-elevated flex flex-col divide-y rounded-xl border",children:e.map(e=>{let s;return(0,t.jsxs)("div",{className:"flex items-center gap-3 p-3",children:[(0,t.jsx)("img",{src:d[e.chain].icon,alt:d[e.chain].label,width:24,height:24,className:"size-6 shrink-0 rounded-full"}),(0,t.jsx)("span",{className:"text-text-primary text-sm font-medium",children:d[e.chain].label}),(0,t.jsx)("span",{className:"text-text-subtle ml-auto font-mono text-xs",children:(s=e.address).length>12?`${s.slice(0,6)}...${s.slice(-4)}`:s})]},`${e.chain}-${e.address}`)})})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)(i.Button,{onClick:r,children:"Upgrade Wallet"}),!s&&(0,t.jsx)(m,{onClick:n,children:"Not now"})]})]})}function p({queue:e,index:s,current:r,keyInputRef:n,hasKey:l,onKeyInput:c,isRevealing:u,isUpgrading:x,error:h,onReveal:f,onUpgrade:g,onCancel:y}){let v=async()=>{try{let e=await navigator.clipboard.readText();e&&n.current&&(n.current.value=e.trim(),c())}catch{}};return(0,t.jsxs)(t.Fragment,{children:[e.length>1&&(0,t.jsx)("div",{className:"flex items-center justify-center",children:e.map((a,r)=>
11(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("div",{className:(0,o.cn)("flex size-8 items-center justify-center rounded-full text-sm font-semibold",r<s&&"bg-brand text-brand-foreground",r===s&&"border-brand text-brand border-2",r>s&&"border-surface-elevated text-text-subtle border"),children:r<s?"✓":r+1}),r<e.length-1&&(0,t.jsx)("div",{className:"bg-surface-elevated h-px w-8"})]},`${a.chain}-${a.address}`))}),(0,t.jsxs)("div",{className:"flex flex-col gap-2 text-center",children:[(0,t.jsxs)("h2",{className:"text-text-primary text-xl font-semibold",children:["Upgrade your ",d[r.chain].label," wallet"]}),(0,t.jsx)("p",{className:"text-text-subtle text-sm",children:"Reveal and copy your private key, then paste it below to complete your wallet upgrade. You'll keep full access to your funds. Never share your private key with anyone."})]}),(0,t.jsxs)("button",{type:"button",onClick:f,disabled:u,className:"bg-surface-elevated text-text-primary flex w-full items-center justify-center gap-2.5 rounded-lg px-4 py-3 text-sm transition-opacity hover:opacity-90 disabled:opacity-50",children:[(0,t.jsx)(a.EyeIcon,{className:"size-5"}),"Reveal ",d[r.chain].label," Wallet private key"]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("p",{className:"text-text-primary text-sm",children:"Paste the revealed key above to continue"}),(0,t.jsxs)("div",{className:"border-surface-elevated focus-within:border-text-subtle flex items-center gap-3 rounded-lg border px-4 py-3 transition-colors",children:[(0,t.jsx)("input",{ref:n,type:"password",onChange:c,placeholder:"Paste your private key",className:"text-text-primary placeholder:text-text-subtle min-w-0 flex-1 bg-transparent text-sm outline-none",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":"true"}),(0,t.jsx)("button",{type:"button",onClick:v,className:"text-text-subtle hover:text-text-primary/80 shrink-0 text-sm font-medium underline transition-colors",children:"Paste"})]})]}),h&&(0,t.jsx)("p",{className:"text-danger text-sm",children:h}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)(i.Button,{disabled:!l||x,loading:x,onClick:g,children:"Upgrade wallet"}),(0,t.jsx)(m,{onClick:y,disabled:x,children:"Back"})]})]})}function h({onClose:e}){return(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4 py-4 text-center",children:[(0,t.jsx)("div",{className:"bg-brand/15 text-brand flex size-12 items-center justify-center rounded-full text-2xl",children:"✓"}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"text-text-primary text-xl font-semibold",children:"You're all set"}),(0,t.jsx)("p",{className:"text-text-subtle text-sm",children:"Your wallet is upgraded and your address hasn't changed."})]}),(0,t.jsx)(i.Button,{className:"w-full",onClick:e,children:"Done"})]})}e.s(["MpcWalletMigrationModal",0,function(){let e=(0,l.useMpcWalletMigrationStore)(e=>e.open),a=n.MPC_WALLET_MIGRATION_ENABLED&&e,i=(0,l.useMpcWalletMigrationStore)(e=>e.blocking),o=(0,l.useMpcWalletMigrationStore)(e=>e.copy),d=(0,l.useMpcWalletMigrationStore)(e=>e.onDone),{close:m}=(0,l.useMpcWalletMigrationStore)(e=>e.actions),{walletsNeedingMigration:f,revealPrivateKey:g,upgradeWallet:y}=(0,c.useMpcWalletMigration)(),[v,b]=(0,s.useState)("intro"),[j,w]=(0,s.useState)([]),[S,N]=(0,s.useState)(0),[C,k]=(0,s.useState)(!1),[T,I]=(0,s.use
11State)(!1),[E,M]=(0,s.useState)(null),A=(0,s.useRef)(null),[P,O]=(0,s.useState)(!1),L=(0,s.useRef)(!1),D=()=>{A.current&&(A.current.value=""),O(!1)};(0,s.useEffect)(()=>{a&&(b("intro"),N(0),M(null)),A.current&&(A.current.value=""),O(!1),!a&&L.current&&u(),L.current=a},[a]),(0,s.useEffect)(()=>{a&&"intro"===v&&0===f.length&&m()},[a,v,f.length,m]);let R=j[S],F=async()=>{if(R){M(null),k(!0);try{await g(R)}catch(e){M((e instanceof Error?(0,c.redactSecrets)(e.message):"")||"We couldn't open the secure window. Please try again.")}finally{k(!1)}}},B=async()=>{let e=A.current?.value.trim()??"";if(R&&e){M(null),I(!0);try{await y(R,e),D(),u(),S>=j.length-1?b("done"):N(e=>e+1)}catch(t){let e=t instanceof Error?(0,c.redactSecrets)(t.message):"";M(e?`Upgrade failed: ${e}`:"Upgrade failed. Check that you pasted the right key and try again.")}finally{I(!1)}}},_=()=>{let e="done"===v;m(),e&&d?.()};return(0,t.jsx)(r.AlertDialog,{open:a,onOpenChange:e=>{(e||!i||"done"===v)&&(e||_())},children:(0,t.jsxs)(r.AlertDialogContent,{className:"bg-background flex w-full max-w-md flex-col gap-6 p-6",children:["intro"===v&&(0,t.jsx)(x,{wallets:f,blocking:i,copy:o,onUpgrade:()=>{0===f.length?m():(w(f),N(0),D(),M(null),b("upgrade"))},onLater:()=>m()}),"upgrade"===v&&R&&(0,t.jsx)(p,{queue:j,index:S,current:R,keyInputRef:A,hasKey:P,onKeyInput:()=>O(!!A.current?.value.trim()),isRevealing:C,isUpgrading:T,error:E,onReveal:F,onUpgrade:B,onCancel:()=>i?b("intro"):m()}),"done"===v&&(0,t.jsx)(h,{onClose:_})]})})}])},806788,e=>{"use strict";var t=e.i(843476),s=e.i(271645);e.i(156669);var a=e.i(896491),r=e.i(562164),i=e.i(332337),n=e.i(526424);e.i(28856);var l=e.i(925600);e.i(732832);var o=e.i(551360);e.s(["BadgesForm",0,function(){let e=(0,n.useBadges)(),c=(0,l.useCreateStageStore)(e=>e.data.badges),d=(0,l.useCreateStageStore)(e=>e.actions),[u,m]=(0,s.useState)(()=>c||[]);return(0,t.jsxs)("div",{className:"flex h-full flex-col gap-8 p-6",children:[(0,t.jsxs)("div",{className:"flex h-full flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsx)("button",{type:"button",onClick:()=>{d.setCurrentStep("CORE")},className:"flex items-center justify-center",children:(0,t.jsx)(a.ArrowBackOutlineIcon,{className:"text-text-primary size-5"})})}),(0,t.jsx)("h3",{className:"text-text-primary text-base/5 font-semibold",children:"Select Community Badges"}),(0,t.jsx)("div",{className:"flex-1"})]}),(0,t.jsx)("p",{className:"text-text-primary text-center text-xs",children:"Pick up to 3 badges to allow them to join your Stage."})]}),(0,t.jsx)("div",{className:"flex flex-wrap items-center justify-center gap-[14px] rounded-[10px]",children:e.map(({name:e,image:s,type:a})=>{let n=u.some(e=>e.type===a);return(0,t.jsxs)(i.Button,{type:"button",variant:"outline",className:(0,o.cn)("shrink-0 gap-1.5 py-1.5 text-base leading-5 font-medium",n&&"border-brand"),onClick:()=>{n?m(e=>e.filter(e=>e.type!==a)):u.length>=3?r.toast.danger("You can only select up to 3 badges"):m(t=>[...t,{name:e,type:a,image:s}])},children:[(0,t.jsx)("div",{className:"w-max",children:(0,t.jsx)("img",{src:s,className:(0,o.cn)("h-[18px] w-auto",!n&&"grayscale"),alt:`${e} logo`})}),(0,t.jsx)("span",{children:e})]},a)})}),(0,t.jsx)(i.Button,{type:"button",className:"w-full grow sm:w-auto sm:px-8 sm:py-2",onClick:()=>{d.setData({badges:u}),d.setCurrentStep("CORE")},children:"Confirm"})]})}])},291468,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(618566),r=e.i(266027),i=e.i(912598);e.i(156669);var n=e.i(361345),l=e.i(562164),o=e.i(332337),c=e.i(776639);e.i(753366);var d=e.i(434672),u=e.i(807339);e.i(28856);var m=e.i(925600),x=e.i(807214);e.s(["DeleteStageModal",0,function({children:e}){let{user:p}=(0,x.useUser)(),[h,f]=(0,s.useState)(!1),g=(0,m.useCreateStageStore)(e=>e.stageId),y=(0,a.useRouter)(),v=(0,i.useQueryClient)(),{data:b,isLoading:j}=(0,r.useQuery)({...u.stageQueries.stageInfoSimple(g??""),enabled:!!g}),{mutateAsync:w,isPending:S}=(0,d.useDeleteThreadMutation)({onMutate:async({threadId:e})=>{l.toast.red("Stage deleted successfully"),await v.cancelQueries({queryKey:["home","threads","my-feed"]}),await v.cancelQueries({queryKey:["home","threads","trending-feed"]});let t=v.getQueryData(["home","threads","my-feed"]),s=v.getQueryData(["home","threads","trending-feed"]);return v.setQueryData(["home","threads","my-feed"],t=>t?{...t,pages:t.pages.map(t=>({...t,threads:t.threads.filter(t=>t.id!==e)}))}:t),v.setQueryData(["home","threads","trending-feed"],t=>t?{...t,pages:t.pages.map(t=>({...t,threads:t.threads.filter(t=>t.id!==e)}))}:t),y.push("/live?streamTab=stages"),v.resetQueries({queryKey:["home","threads","stages-feed"]}),{previousMyFeed:t,previousTrendingFeed:s}},onError(e,t,s){v.setQueryData(["home","threads","my-feed"],s?.previousMyFeed),v.setQueryData(["home","threads","trending-feed"],s?.previousTrendingFeed)}});return!g||j||b&&b.stage.hostId!==p?.id?null:(0,t.jsxs)(c.Dialog,{open:h,onOpenChange:f,children:[(0,t.jsx)(c.DialogTrigger,{asChild:!0,children:e}),(0,t.jsxs)(c.DialogContent,{className:"border-border-default/30 bg-surface-modal/90 shadow-modal max-w-xs gap-6 rounded-[10px] border backdrop-blur-xs",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,t.jsx)(n.TrashOutlineIcon,{className:"text-brand mx-auto 
11size-6"}),(0,t.jsx)("h3",{className:"text-text-primary text-center text-base font-semibold",children:"Delete your scheduled Stage"})]}),(0,t.jsx)("div",{className:"text-text-subtle flex flex-col gap-2 text-sm",children:(0,t.jsx)("p",{children:"You can edit every detail of your scheduled Stage, are you sure you want to continue?"})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(c.DialogClose,{className:"flex-1",asChild:!0,children:(0,t.jsx)(o.Button,{variant:"outline",children:"Close"})}),(0,t.jsx)(o.Button,{className:"flex-2",loading:S,onClick:()=>{b&&!j&&w({threadId:b.stage.threadId})},children:"Delete"})]})]})]})}])},230875,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(905519),r=e.i(383900),i=e.i(401851),n=e.i(108957),l=e.i(826514),o=e.i(10676),c=e.i(960858),d=e.i(137906);e.i(156669);var u=e.i(896491),m=e.i(729459),x=e.i(290092),p=e.i(562164),h=e.i(332337),f=e.i(227766),g=e.i(776639),y=e.i(561993),v=e.i(793479),b=e.i(737398),j=e.i(242405);e.i(732832);var w=e.i(551360),S=e.i(153983);function N({date:e,setDate:s,time:l,setTime:o,onClose:c,onSchedule:p,todayDate:g}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex flex-1 items-center justify-start",children:(0,t.jsx)("button",{className:"p-1",onClick:c,children:(0,t.jsx)(u.ArrowBackOutlineIcon,{className:"text-text-primary size-5"})})}),(0,t.jsx)("h3",{className:"text-text-primary text-base leading-[22px] font-semibold",children:"Schedule your Stage"}),(0,t.jsx)("div",{className:"flex-1"})]}),(0,t.jsx)("div",{className:"flex flex-col gap-3",children:S.IS_MOBILE?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(v.Input,{type:"date",value:(0,i.format)(e,"yyyy-MM-dd"),min:g,onChange:e=>{let[t,a,r]=e.target.value.split("-");s(new Date(Number(t),Number(a)-1,Number(r),12))},className:(0,w.cn)("time-input-mobile rounded-full px-4 py-3 ps-12 text-left",!S.IS_IOS&&"time-input")}),(0,t.jsx)(v.Input,{type:"time",value:`${l?.hour.toString().padStart(2,"0")}:${l?.minute.toString().padStart(2,"0")}`,onChange:e=>{let[t,s]=e.target.value.split(":");o(new a.Time(parseInt(t),parseInt(s)))},className:(0,w.cn)("time-input-mobile rounded-full py-3 pr-4 pl-12 text-left",!S.IS_IOS&&"time-input")})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(b.Popover,{modal:!0,children:[(0,t.jsx)(b.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(h.Button,{variant:"outline",className:(0,w.cn)("w-full justify-start py-3 text-left font-normal",!e&&"text-muted-foreground"),children:[(0,t.jsx)(m.CalendarOutlineIcon,{className:"mr-2 size-6"}),e?(0,i.format)(e,(0,n.isThisYear)(e)?"E, MMM d":"E, PP"):(0,t.jsx)("span",{children:"Pick a date"})]})}),(0,t.jsx)(b.PopoverContent,{className:"w-full p-0",children:(0,t.jsx)(f.Calendar,{mode:"single",selected:e,onSelect:e=>{e&&s(e)},autoFocus:!0,disabled:e=>e<=(0,r.endOfYesterday)()})})]}),(0,t.jsx)(d.TimeField,{"aria-label":"Time",className:"space-y-2",hourCycle:12,value:l,onChange:o,children:(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"text-text-primary/80 pointer-events-none absolute inset-y-0 inset-s-0 z-10 flex items-center justify-center ps-4",children:(0,t.jsx)(x.ClockOutlineIcon,{className:"text-text-primary size-6","aria-hidden":"true"})}),(0,t.jsx)(d.DateInput,{className:"border-text-subtle relative inline-flex w-full items-center overflow-hidden rounded-full border px-4 py-3 ps-12 text-sm whitespace-nowrap shadow-xs outline-hidden transition-shadow data-disabled:opacity-50 data-focus-within:outline-hidden",children:e=>(0,t.jsx)(d.DateSegment,{segment:e,className:"text-text-primary data-focused:bg-border-default data-focused:data-placeholder:text-text-subtle data-focused:text-text-primary data-invalid:data-focused:data-placeholder:text-text-primary data-invalid:data-placeholder:text-text-primary data-invalid:text-text-primary data-placeholder:text-text-primary/70 data-[type=literal]:text-text-primary/70 data-invalid:data-focused:bg-danger-strong inline rounded-sm p-0.5 caret-transparent outline-0 outline-solid data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[type=literal]:px-0"})})]})})]})}),(0,t.jsx)(h.Button,{onClick:p,children:"Schedule Stage"})]})}e.s(["StageScheduleModal",0,function({children:e,scheduledDate:r,setScheduledDate:n}){let d=(0,o.roundToNearestHours)(new Date,{roundingMethod:"ceil"}
11),[u,m]=(0,s.useState)(!1),[x,h]=(0,s.useState)(()=>r?(0,l.parseISO)(r):d),[f,v]=(0,s.useState)(()=>{if(r){let e=(0,l.parseISO)(r);return new a.Time(e.getHours(),e.getMinutes())}return new a.Time(d.getHours(),d.getMinutes())}),b=(0,j.useMediaQuery)(j.BREAKPOINTS.sm),w=(0,i.format)(d,"yyyy-MM-dd"),S=e=>{if(m(e),!e)if(r){let e=(0,l.parseISO)(r);h(e),v(new a.Time(e.getHours(),e.getMinutes()))}else h(d),v(new a.Time(d.getHours(),d.getMinutes()))},C=()=>{if(!x||!f)return;let e=(0,c.set)(x,{hours:f?.hour,minutes:f?.minute});e<new Date?p.toast.danger("Please select a future date and time"):(n(e.toISOString()),m(!1))};return b?(0,t.jsxs)(g.Dialog,{open:u,onOpenChange:S,children:[(0,t.jsx)(g.DialogTrigger,{asChild:!0,children:e}),(0,t.jsx)(g.DialogContent,{className:"max-w-md",children:(0,t.jsx)(N,{date:x,setDate:h,time:f,setTime:v,onClose:()=>S(!1),onSchedule:C,todayDate:w})})]}):(0,t.jsxs)(y.Drawer,{open:u,onOpenChange:S,dismissible:!1,children:[(0,t.jsx)(y.DrawerTrigger,{asChild:!0,children:e}),(0,t.jsx)(y.DrawerContent,{className:"justify-start gap-8 text-left",children:(0,t.jsx)(N,{date:x,setDate:h,time:f,setTime:v,onClose:()=>S(!1),onSchedule:C,todayDate:w})})]})}])},187874,e=>{"use strict";var t=e.i(843476),s=e.i(618566),a=e.i(672310),r=e.i(741452),i=e.i(912598),n=e.i(401851);e.i(156669);var l=e.i(896491),o=e.i(729459),c=e.i(184282),d=e.i(537224),u=e.i(361345),m=e.i(562164),x=e.i(332337),p=e.i(793479),h=e.i(110204),f=e.i(699375);e.i(753366);var g=e.i(124171);e.i(28856);var y=e.i(925600),v=e.i(807214),b=e.i(955707),j=e.i(56162);e.i(493948);var w=e.i(591909),S=e.i(63501),N=e.i(291468),C=e.i(230875);e.s(["CoreStageForm",0,function(){let e=(0,s.useRouter)(),{user:k}=(0,v.useUser)(),T=(0,i.useQueryClient)(),I=(0,y.useCreateStageStore)(e=>e.data),E=(0,y.useCreateStageStore)(e=>e.stageId),M=(0,y.useCreateStageStore)(e=>e.actions),A=(0,j.useStageStore)(e=>e.actions),P=(0,b.useLivestreamStore)(e=>e.actions),O=(0,b.useLivestreamStore)(e=>e.token),L=(0,b.useLivestreamStore)(e=>e.myRole),D=!!(O&&L===S.ROLES.HOST),{mutateAsync:R,isPending:F}=(0,g.useCreateStageMutation)({onSuccess:t=>{m.toast.green("You created a new stage!"),T.resetQueries({queryKey:["home","threads","stages-feed"]}),t.token&&!t.stage.scheduledStartTime?(A.reset(),A.setToken(t.token??null),A.setId(t.stage.id),P.reset()):e.push(`/${k?.handle}/status/${t.stage.threadId}`),M.reset()}}),{mutateAsync:B,isPending:_}=(0,g.useEditStageMutation)({onSuccess:t=>{m.toast.green("Stage updated successfully!"),T.resetQueries({queryKey:["home","threads","stages-feed"]}),e.push(`/${k?.handle}/status/${t.stage.threadId}`),M.reset()}}),Q=(0,r.useForm)({defaultValues:{name:I.name??"",record:I.record??!1,gate:I.gate??!1,gateType:I.gateType??"TICKET",scheduledStartTime:I.scheduledStartTime??null},onSubmit:async({value:e})=>
11{if(D&&!E){M.setData({name:e.name,record:e.record,gate:e.gate,gateType:e.gateType,scheduledStartTime:e.scheduledStartTime}),P.setIsEndLivestreamModalOpen(!0);return}if(!e.name)return void m.toast.danger("Please enter a name before proceeding");if(e.gate&&"BADGE"===e.gateType&&!I.badges?.length)return void m.toast.danger("Please select at least one badge");let t=e.gate&&"TICKET"===e.gateType?w.ThreadPrivacyTypeEnum.SHAREHOLDERS:e.gate&&"BADGE"===e.gateType?w.ThreadPrivacyTypeEnum.BADGEHOLDERS:w.ThreadPrivacyTypeEnum.PUBLIC,s=e.gate&&"BADGE"===e.gateType&&I.badges?.length?I.badges.map(e=>e.type):void 0,a={name:e.name,record:e.record,privacyType:t,badgeTypes:s,scheduledStartTime:e.scheduledStartTime??void 0};E?B({stageId:E,...a}):R(a)}});return(0,t.jsxs)("div",{className:"flex h-full flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center p-6",children:[(0,t.jsx)("div",{className:"flex flex-1 justify-start",children:(0,t.jsx)("button",{type:"button",onClick:()=>{Q.reset(),M.reset()},children:(0,t.jsx)(l.ArrowBackOutlineIcon,{className:"text-text-primary size-5"})})}),(0,t.jsx)("h3",{className:"text-text-primary text-base leading-5 font-semibold",children:E?"Edit your Stage":"Create your Stage"}),E?(0,t.jsx)("div",{className:"flex flex-1 justify-end",children:(0,t.jsx)(N.DeleteStageModal,{children:(0,t.jsx)("button",{type:"button",children:(0,t.jsx)(u.TrashOutlineIcon,{className:"text-brand size-5"})})})}):(0,t.jsx)("div",{className:"flex-1"})]}),(0,t.jsxs)("form",{className:"flex grow flex-col sm:grow-0",onSubmit:e=>{e.preventDefault(),e.stopPropagation(),Q.handleSubmit()},children:[(0,t.jsxs)("div",{className:"flex flex-col gap-6 p-6",children:[(0,t.jsx)(Q.Field,{name:"name",validators:{onChange:({value:e})=>
11{if(0===e.trim().length)return"Name is required"}},children:e=>(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("div",{className:"flex items-center justify-between gap-2",children:(0,t.jsx)(h.Label,{htmlFor:"stage-editor",className:"text-text-primary",children:"Name"})}),(0,t.jsx)(p.Input,{id:"stage-editor",type:"text",placeholder:"Name for your Stage",className:"text-text-primary placeholder:text-text-subtle min-h-[50px] w-full bg-transparent p-4 pr-10 text-sm focus:outline-hidden",value:e.state.value,onChange:t=>{e.handleChange(t.target.value)},maxLength:60,children:(0,t.jsx)("span",{className:"text-text-subtle pointer-events-none absolute top-4 right-4 text-sm",children:60-e.state.value.length})}),!e.state.meta.isValid&&(0,t.jsx)("span",{role:"alert",className:"text-danger text-xs",children:e.state.meta.errors.join(", ")})]})}),(0,t.jsx)(Q.Field,{name:"record",children:e=>(0,t.jsxs)(h.Label,{className:"flex w-full items-center justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)("div",{className:"text-text-primary text-sm font-medium normal-case",children:"Record my Stage"}),(0,t.jsx)("p",{className:"text-text-subtle text-xs font-normal normal-case",children:"Allow users to listen to your Stage later"})]}),(0,t.jsx)(f.Switch,{checked:e.state.value,onCheckedChange:t=>{e.handleChange(t)}})]})}),(0,t.jsx)(Q.Field,{name:"gate",children:e=>(0,t.jsxs)(h.Label,{className:"flex w-full items-center justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)("div",{className:"text-text-primary text-sm font-medium normal-case",children:"Gate my Stage"}),(0,t.jsx)("p",{className:"text-text-subtle max-w-48 text-xs font-normal normal-case",children:"Select who can join your Stage"})]}),(0,t.jsx)(f.Switch,{checked:e.state.value,onCheckedChange:t=>{e.handleChange(t)}})]})}),(0,t.jsx)(Q.Subscribe,{selector:e=>e.values.gate,children:e=>e&&(0,t.jsx)(Q.Field,{name:"gateType",children:e=>(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)(a.Root,{value:e.state.value,onValueChange:t=>e.handleChange(t),className:"flex items-center justify-between gap-4",children:[(0,t.jsxs)(a.Item,{value:"TICKET",className:"border-text-subtle text-text-primary data-[state=checked]:border-brand relative flex-1 justify-start rounded-[10px] border p-4 text-left text-sm font-semibold",children:["Ticket Gated ",(0,t.jsx)("br",{})," Stream",(0,t.jsx)("img",{src:"/images/ticket.png",alt:"Easy Live Stream",className:"pointer-events-none absolute right-2 bottom-2 size-10"})]}),(0,t.jsxs)(a.Item,{value:"BADGE",className:"border-text-subtle text-text-primary data-[state=checked]:border-brand relative flex-1 justify-start rounded-[10px] border p-4 text-left text-sm font-semibold",children:["Badge Gated ",(0,t.jsx)("br",{})," Stream",(0,t.jsx)("img",{src:"/images/sword.png",alt:"Easy Live Stream",className:"pointer-events-none absolute right-2 bottom-2 size-10"})]})]}),"TICKET"===e.state.value&&(0,t.jsxs)("div",{className:"bg-surface-raised rounded-lg p-4 text-center text-xs/5",children:[(0,t.jsx)("h5",{className:"text-text-primary",children:"Make it exclusive"}),(0,t.jsx)("p",{className:"text-text-muted",children:"Treat your ticket holders with a Stage just for them!"})]}),"BADGE"===e.state.value&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"bg-surface-raised rounded-lg p-4 text-center text-xs/5",children:[(0,t.jsx)("h5",{className:"text-text-primary",children:"Target Web3 communities"}),(0,t.jsx)("p",{className:"text-text-muted",children:"Only users from certain communities can join."})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 rounded-[10px] px-10",children:[I.badges?.map(({name:e,image:s,type:a})=>(0,t.jsxs)(x.Button,{type:"button",variant:"outline",className:"border-brand shrink-0 cursor-default gap-1.5 px-3 py-1.5 text-base/5 font-semibold hover:bg-transparent",children:[(0,t.jsx)("div",{className:"w-max",children:(0,t.jsx)("img",{src:s,className:"h-[18px] w-auto",alt:`${e} logo`})}),(0,t.jsx)("span",{children:e})]},a)),(0,t.jsxs)(x.Button,{type:"button",variant:"outline",className:"self-center px-3 py-1.5 text-xs",onClick:()=>{M.setCurrentStep("BADGES");let e=Q.state.values;M.setData({name:e.name,record:e.record,gate:e.gate,gateType:e.gateType,scheduledStartTime:e.scheduledStartTime})},children:[(0,t.jsx)(d.PencilAltOutlineIcon,{className:"mr-2 size-5"})," ",I.badges?.length&&I.badges.length>0?"Edit":"Pick Invited Communities"]})]})]})]})})})]}),(0,t.jsx)(Q.Field,{name:"scheduledStartTime",children:e=>(0,t.jsxs)("div",{className:"mt-auto flex shrink-0 flex-col gap-4 px-6 py-4",children:[(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(Q.Subscribe,{selector:e=>({name:e.values.name,type:e.values.gateType,gate:e.values.gate}),children:({name:s,gate:a,type:r})=>(0,t.jsx)(x.Button,{className:"w-full grow",type:"submit",disabled:a&&"BADGE"===r&&(!I.badges||0===I.badges.length)||0===s.length,loading:F||_,children:e.state.value?"Save Scheduled Stage":"Start Stage Now"})}),(0,t.jsx)(C.StageScheduleModal,{scheduledDate:e.state.value,setScheduledDate:e.handleChange,children:(0,t.jsx)(x.Button,{type:"button",variant:"outline",className:"size-11",children:(0,t.jsx)(o.CalendarOutlineIcon,{className:"text-text-primary size-6"})})})]}),e.state.value?(0,t.jsxs)("div",{className:"bg-surface-raised text-text-subtle relative w-full rounded-lg p-2 text-center text-xs",children:["Starting on"," ",(0,n.format)(new Date(e.state.value),"EEEE, MMM d 'at' h:mm a"),E?null:(0,t.jsx)("button",{type:"button",className:"bg-background/25 absolute top-1/2 right-0.5 flex size-7 -translate-y-1/2 items-center justify-center rounded-lg backdrop-blur-md",onClick:()=>{e.handleChange(null)},children:(0,t.jsx)(c.CloseOutlineIcon,{className:"text-text-primary size-5"})})]}):null]})})]})]})}])},332764,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(266027),r=e.i(868499),i=e.i(561993),n=e.i(526424),l=e.i(242405),o=e.i(807339);e.i(28856);var c=e.i(925600);e.i(493948);var d=e.i(591909);e.i(732832);var u=e.i(551360),m=e.i(806788),x=e.i(187874);let p=()=>{let e=(0,l.useMediaQuery)(l.BREAKPOINTS.sm);switch((0,c.useCreateStageStore)(e=>e.currentStep)){case"CORE":return(0,t.jsx)(x.CoreStageForm,{});case"BADGES":if(!e)return(0,t.jsx)(x.CoreStageForm,{});return(0,t.jsx)(m.BadgesForm,{})}},h=()=>{let e=(0,c.useCreateStageStore)(e=>e.stageId),t=(0,c.useCreateStageStore)(e=>e.actions),{data:r,isLoading:i}=(0,a.useQuery)({...o.stageQueries.stageInfoSimple(e??""),enabled:!!e}),l=r?.stage.badgeTypes?.map(e=>e.badgeType)??[],u=(0,n.useFindBadgesByTypes)(l);return(0,s.useEffect)(()=>
11{if(e&&r&&!i){let e=r.stage.privacyType!==d.ThreadPrivacyTypeEnum.PUBLIC,s=r.stage.privacyType===d.ThreadPrivacyTypeEnum.BADGEHOLDERS?"BADGE":"TICKET";t.setData({name:r.stage.name,record:r.stage.isRecorded,gate:e,gateType:s,badges:u,scheduledStartTime:r.stage.scheduledStartTime})}},[r,e,t,i,u]),null};e.s(["CreateStageModal",0,function(){let e=(0,l.useMediaQuery)(l.BREAKPOINTS.sm),s=(0,c.useCreateStageStore)(e=>e.open),a=(0,c.useCreateStageStore)(e=>e.currentStep),n=(0,c.useCreateStageStore)(e=>e.actions);return(0,t.jsx)(r.AlertDialog,{open:s,onOpenChange:e=>{n.setOpen(e)},children:(0,t.jsxs)(r.AlertDialogContent,{className:(0,u.cn)("pt-pwa bg-background/75 sm:bg-background/75 flex h-full w-full max-w-md flex-col overflow-y-auto p-0 backdrop-blur-xs transition-colors sm:h-auto sm:max-h-screen","BADGES"===a&&e&&"bg-surface-modal/90 sm:bg-surface-modal/90"),children:[(0,t.jsx)(p,{}),(0,t.jsx)(i.Drawer,{open:"BADGES"===a&&!e,onOpenChange:()=>{n.setCurrentStep("CORE")},disablePreventScroll:!0,children:(0,t.jsx)(i.DrawerContent,{className:"max-h-screen p-0",children:(0,t.jsx)("div",{className:"h-full overflow-y-auto",children:(0,t.jsx)(m.BadgesForm,{})})})}),(0,t.jsx)(h,{})]})})}])},721543,e=>{"use strict";var t=e.i(843476),s=e.i(266027),a=e.i(912598),r=e.i(242405);e.i(753366);var i=e.i(807339),n=e.i(124171);e.i(28856);var l=e.i(807214),o=e.i(56162),c=e.i(332337),d=e.i(776639),u=e.i(561993),m=e.i(232707);e.s(["EndStageConfirmationModal",0,function(){let{user:e}=(0,l.useUser)(),x=(0,a.useQueryClient)(),p=(0,o.useStageStore)(e=>e.id),h=(0,o.useStageStore)(e=>e.isEndStageModalOpen),f=(0,o.useStageStore)(e=>e.actions),g=(0,r.useMediaQuery)(r.BREAKPOINTS.sm),y=(0,m.useLogSpeakingDuration)(),{data:v}=(0,s.useQuery)({...i.stageQueries.stageInfoSimple(p??""),enabled:!!p}),{mutateAsync:b,isPending:j}=(0,n.useEndStageMutation)({onSuccess:()=>{f.reset()}}),w=async()=>{p&&(y(),v?.host.id===e?.id?await b({stageId:p}):(f.reset(),setTimeout(()=>{x.invalidateQueries({queryKey:i.stageQueries.currentlyListeningKey()}),f.setCanShowCurrentlyListening(!0)},3e3)),f.setIsEndStageModalOpen(!1))},S=()=>{f.setIsEndStageModalOpen(!1)};return g?(0,t.jsx)(d.Dialog,{open:h,onOpenChange:S,children:(0,t.jsxs)(d.DialogContent,{className:"max-w-sm",children:[(0,t.jsxs)(d.DialogHeader,{children:[(0,t.jsx)(d.DialogTitle,{className:"text-lg font-semibold",children:"Are you sure you want to end the stage?"}),(0,t.jsx)(d.DialogDescription,{className:"text-text-subtle text-sm",children:"This will end the stage and all participants will be disconnected."})]}),(0,t.jsxs)(d.DialogFooter,{children:[(0,t.jsx)(c.Button,{variant:"outline",className:"flex-1",onClick:S,disabled:j,children:"Cancel"}),(0,t.jsx)(c.Button,{className:"flex-2",onClick:w,loading:j,children:"End Stage"})]})]})}):(0,t.jsx)(u.Drawer,{open:h,onOpenChange:S,children:(0,t.jsxs)(u.DrawerContent,{className:"justify-start gap-6 text-left",children:[(0,t.jsxs)(d.DialogHeader,{children:[(0,t.jsx)(d.DialogTitle,{className:"text-lg font-semibold",children:"Are you sure you want to end the stage?"}),(0,t.jsx)(d.DialogDescription,{className:"text-text-subtle text-sm",children:"This will end the stage and all participants will be disconnected."})]}),(0,t.jsxs)(d.DialogFooter,{className:"flex flex-row items-center gap-2",children:[(0,t.jsx)(c.Button,{variant:"outline",className:"flex-1",onClick:S,disabled:j,children:"Cancel"}),(0,t.jsx)(c.Button,{className:"flex-2",onClick:w,loading:j,children:"End Stage"})]})]})})}])},414673,e=>{"use strict";var t=e.i(843476),s=e.i(397174),a=e.i(681506),r=e.i(964215),i=e.i(236997),n=e.i(875018),l=e.i(919558),o=e.i(332764),c=e.i(721543);e.s(["GlobalModals",0,function(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.CreateStageModal,{}),(0,t.jsx)(i.CreateLivestreamModal,{}),(0,t.jsx)(n.EndLivestreamConfirmationModal,{}),(0,t.jsx)(c.EndStageConfirmationModal,{}),(0,t.jsx)(a.ComposePostModal,{}),(0,t.jsx)(r.ExternalLinkNavigationModal,{}),(0,t.jsx)(l.MpcWalletMigrationModal,{}),(0,t.jsx)(s.StakingFlowModal,{})]})}])},48057,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(618566),r=e.i(377143),i=e.i(242405),n=e.i(955707);let l=(0,s.memo)(()=>{let e=(0,n.useLivestreamStore)(e=>e.token),l=(0,n.useLivestreamStore)(e=>e.miniNode),o=(0,n.useLivestreamStore)(e=>e.actions),c=(0,i.useMediaQuery)(i.BREAKPOINTS.lg),d=(0,a.useSelectedLayoutSegments)(),u=(0,a.usePathname)(),m=u.startsWith("/live/")&&"/live"!==u,x=d.length>0&&"(messages)"===d[1];return((0,s.useEffect)(()=>{0===d.length&&o.reset()},[d]),e&&c&&l&&!m)?x?(0,t.jsxs)("div",{className:"relative z-10 mx-auto flex max-w-[1350px] flex-nowrap items-stretch justify-end",children:[(0,t.jsx)("div",{className:"relative z-3 hidden sm:flex sm:shrink-0 sm:grow sm:flex-col sm:items-end",children:(0,t.jsx)("div",{className:"flex w-[88px] flex-col items-end xl:w-[154px]"})}),(0,t.jsxs)("div",{className:"flex shrink grow-2 justify-start gap-4 xl:gap-7",children:[(0,t.jsx)("div",{className:"flex w-[450px] flex-col",children:(0,t.jsx)("div",{className:"fixed bottom-5 w-[444px] justify-end",children:(0,t.jsx)(r.OutPortal,{node:l})})}),(0,t.jsx)("div",{className:"relative w-[430px] xl:w-[545px]"})]})]}):(0,t.jsxs)("div",{className:"relative mx-auto flex max-w-[1350px] flex-nowrap items-stretch justify-end",children:[(0,t.jsx)("div",{className:"relative z-3 hidden sm:flex sm:shrink-0 sm:grow sm:flex-col sm:items-end",children:(0,t.jsx)("div",{className:"flex w-[88px] flex-col items-end xl:w-[247px]"})}),(0,t.jsxs)("div",{className:"flex shrink grow-2 justify-start gap-4 xl:gap-7",children:[(0,t.jsx)("div",{className:"relative w-[430px] xl:w-[545px]"}),(0,t.jsx)("div",{className:"flex w-[450px] flex-col",children:(0,t.jsx)("div",{className:"fixed bottom-5 w-[444px] justify-end",children:(0,t.jsx)(r.OutPortal,{node:l})})})]})]}):null});l.displayName="MiniLivestreamContainer",e.s(["MiniLivestreamContainer",0,l])},553539,e=>{"use strict";var t=e.i(843476),s=e.i(377143),a=e.i(955707);e.s(["MiniPlayerContent",0,function(){let e=(0,a.useLivestreamStore)(e=>e.playerPortalNode);return e?(0,t.jsx)(s.OutPortal,{node:e}):null}])},330621,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(657688),r=e.i(266027),i=e.i(912598),n=e.i(799676);e.i(753366);
11var l=e.i(484940),o=e.i(456682),c=e.i(179520),d=e.i(861656),u=e.i(955707);e.i(732832);var m=e.i(443646),x=e.i(551360),p=e.i(609250),h=e.i(742002),f=e.i(772379),g=e.i(562164),y=e.i(484297),v=e.i(332337),b=e.i(809918);let j=(0,s.memo)(()=>{let e=(0,i.useQueryClient)(),j=(0,u.useLivestreamStore)(e=>e.id),w=(0,u.useLivestreamStore)(e=>e.didFollowHost),S=(0,u.useLivestreamStore)(e=>e.actions),{data:N}=(0,r.useQuery)(l.livestreamQueries.livestreamSimpleInfo(j)),{chat:C}=(0,b.useDataChannelsContext)(),{data:k,isLoading:T,refetch:I}=(0,r.useQuery)({...c.userQueries.byHandle(N?.host.user.handle??"")}),{data:E,isLoading:M}=(0,d.useSharesStatsQuery)({userId:N?.host.id}),A=(0,m.abbreviateNumber)(k?.user?.followerCount??0),{mutateAsync:P}=(0,o.useFollowMutation)({onMutate:async()=>{g.toast.green(`You're now following ${N?.host.user.userName}!`),await e.cancelQueries({queryKey:["user","handle",N?.host.user.handle]}),await e.cancelQueries({queryKey:["trade","users","trending"]});let t=e.getQueryData(["user","handle",N?.host.user.handle]),s=e.getQueryData(["trade","users","trending"]);return e.setQueryData(["user","handle",N?.host.user.handle],e=>e?{...e,user:{...e.user,following:!0}}:e),e.setQueryData(["trade","users","trending"],e=>e?{...e,users:e.users.map(e=>e.id===N?.host.id?{...e,following:!0}:e)}:e),{previousUser:t,previousTrendingUsers:s}},onSuccess:()=>{w||(C.send({type:"followed",data:{followedUser:{id:N?.host.id,name:N?.host.user.userName,username:N?.host.user.handle}}}),S.setDidFollowHost(!0)),I()},onError:(t,s,a)=>{g.toast.danger(`Failed to follow ${N?.host.user.userName}.`),e.setQueryData(["user","handle",N?.host.user.handle],a.previousUser),e.setQueryData(["trade","users","trending"],a?.previousTrendingUsers)}}),{mutateAsync:O}=(0,o.useUnfollowMutation)({onMutate:async()=>{await e.cancelQueries({queryKey:["user","handle",N?.host.user.handle]}),await e.cancelQueries({queryKey:["trade","users","trending"]});let t=e.getQueryData(["user","handle",N?.host.user.handle]),s=e.getQueryData(["trade","users","trending"]);return e.setQueryData(["user","handle",N?.host.user.handle],e=>e?{...e,user:{...e.user,following:!1}}:e),e.setQueryData(["trade","users","trending"],e=>e?{...e,users:e.users.map(e=>e.id===N?.host.id?{...e,following:!1}:e)}:e),{previousUser:t,previousTrendingUsers:s}},onSuccess:()=>{I()},onError:(t,s,a)=>{g.toast.danger(`Failed to unfollow ${N?.host.user.userName}.`),e.setQueryData(["user","handle",N?.host.user.handle],a.previousUser),e.setQueryData(["trade","users","trending"],a?.previousTrendingUsers)}}),L=(0,s.useMemo)(()=>{if(T||M)return"";let e=(0,p.formatAvax)(E?.stats?.keyPrice??k?.user?.keyPrice??"");return parseFloat(e)>=1?parseFloat(e).toFixed(2):e},[E?.stats?.keyPrice,k?.user?.keyPrice,T,M]);return(0,t.jsxs)("div",{className:"flex grow gap-2",children:[(0,t.jsxs)("div",{className:"border-surface-elevated bg-surface-hover flex grow items-center justify-between gap-2 overflow-hidden rounded-[10px] border p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n.Avatar,{className:"size-11",children:(0,t.jsxs)(f.ProgressBarLink,{href:`/${N?.host.user.handle}`,children:[(0,t.jsx)(n.AvatarImage,{src:N?.host.user.profilePicture}),(0,t.jsx)(n.AvatarFallback,{})]})}),(0,t.jsxs)("div",{className:"flex w-full min-w-0 flex-col text-sm leading-4",children:[(0,t.jsx)("div",{className:"flex gap-1.5",children:(0,t.jsx)(f.ProgressBarLink,{href:`/${N?.host.user.handle}`,className:"text-text-primary truncate text-sm",children:N?.host.user.userName})}),(0,t.jsxs)(f.ProgressBarLink,{href:`/${N?.host.user.handle}`,className:"text-text-muted truncate text-xs",children:["@",(0,h.maskHandle)(N?.host.user.handle)]})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(y.TradeTicketsModal,{userHandle:N?.host.user.handle,onSuccess:e=>{C.send({type:"bought-ticket",data:{user:{id:N?.host.id,name:N?.host.user.userName,username:N?.host.user.handle},amount:e}})},children:(0,t.jsxs)(v.Button,{className:"h-11 min-w-[160px] flex-1 gap-1 py-2",children:["Buy"," ",(0,t.jsx)(a.default,{src:"/assets/coins/avax.png",className:"ml-0.5 size-3 rounded-full brightness-110 grayscale",alt:"AVAX logo",width:12,height:12}),(0,t.jsx)("span",{className:"text-brand-foreground text-xs leading-5 font-medium",children:L})]})}),(0,t.jsx)(v.Button,{variant:"outline",className:(0,x.cn)("h-11 w-[120px] px-[10px] py-2",!k?.user?.following&&"border-brand"),onClick:()=>{k&&(k?.user?.following?O({userId:k.user.id}):P({userId:k.user.id}))},children:k?.user?.following?"Unfollow":"Follow"})]})]}),(0,t.jsxs)("div",{className:"border-surface-elevated bg-surface-hover flex flex-col items-center justify-center gap-1 overflow-hidden rounded-[10px] border px-6 py-4 font-semibold",children:[(0,t.jsx)("div",{className:"text-text-primary text-2xl leading-none",children:A}),(0,t.jsx)("div",{className:"text-text-muted text-base leading-none",children:"Followers"})]})]})});j.displayName="HostInfo",e.s(["HostInfo",0,j])},112489,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(989438),r=e.i(266027),i=e.i(531779);e.i(753366);var n=e.i(484940),l=e.i(955707);e.i(156669);var o=e.i(290092),c=e.i(461361);e.s(["TimeCounter",0,function(){let e=(0,l.useLivestreamStore)(e=>
11e.id),[a,i]=(0,s.useState)("00:00:00"),{data:c}=(0,r.useQuery)(n.livestreamQueries.livestreamSimpleInfo(e)),d=c?.livestream.startedOn;return(0,s.useEffect)(()=>{if(!d)return;let e=()=>{let e=new Date(d).getTime(),t=new Date().getTime()-e,s=Math.floor(t/36e5),a=Math.floor(t%36e5/6e4),r=Math.floor(t%6e4/1e3);i(`${String(s).padStart(2,"0")}:${String(a).padStart(2,"0")}:${String(r).padStart(2,"0")}`)};e();let t=setInterval(e,1e3);return()=>clearInterval(t)},[d]),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(o.ClockOutlineIcon,{className:"text-brand size-6",strokeWidth:1.5}),(0,t.jsx)("span",{className:"text-text-muted w-[70px] text-sm font-semibold",children:a})]})},"ViewCounter",0,function(){let e=(0,l.useLivestreamStore)(e=>e.id),{data:s}=(0,r.useQuery)(n.livestreamQueries.livestreamSimpleInfo(e)),o=(0,a.useParticipants)({updateOnlyOn:[i.RoomEvent.ParticipantConnected,i.RoomEvent.ParticipantDisconnected]}).filter(e=>e.identity!==s?.livestream.hostId&&!e.identity.includes("-ingress")&&!e.identity.includes("recorder")).length;return(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(c.EyeOutlineIcon,{className:"text-brand size-6",strokeWidth:1.5}),(0,t.jsx)("span",{className:"text-text-muted text-sm font-semibold",children:o})]})}])},516414,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(989438),r=e.i(266027),i=e.i(912598),n=e.i(531779),l=e.i(995077),o=e.i(927158),c=e.i(307501),d=e.i(776639),u=e.i(407204),m=e.i(502771);e.i(753366);var x=e.i(484940),p=e.i(700869),h=e.i(20054);e.i(28856);var f=e.i(807214),g=e.i(955707);e.i(732832);var y=e.i(551360),v=e.i(809918);let b="EVERY_VIEWER",j="TOP_10_SUPPORTERS";e.s(["LivestreamTippingPartyModal",0,({children:e,livestreamId:w,dataChannelsContext:S})=>{let[N,C]=(0,s.useState)(!1);(0,i.useQueryClient)();let{user:k}=(0,f.useUser)(),T=w??(0,g.useLivestreamStore)(e=>e.id),[I,E]=(0,s.useState)(b),[M,A]=(0,s.useState)([]),P=(0,u.useKeyboardVisible)(),[O,L]=(0,s.useState)(1);(0,s.useEffect)(()=>{N&&L(1)},[N]);let{data:D}=(0,r.useQuery)(x.livestreamQueries.livestreamSimpleInfo(T)),{send:R}=(S??(0,v.useDataChannelsContext)()).chat,F=(0,a.useParticipants)({updateOnlyOn:[n.RoomEvent.ParticipantConnected,n.RoomEvent.ParticipantDisconnected]}),B=(0,s.useMemo)(()=>F.map(e=>({id:e.identity,name:e.attributes?.name,avatar:e.attributes?.avatar,username:e.attributes?.username,role:e.attributes?.role})).filter(e=>e.id!==k?.id&&e.id!==D?.host.id&&!e.id.includes("-ingress")&&!e.id.includes("recorder")&&!e.id.startsWith("guest-")),[F,D,k?.id]),{data:_,refetch:Q,isFetching:U}=(0,r.useQuery)({...x.livestreamQueries.topLivestreamTippers(T),staleTime:6e5}),W=(0,s.useMemo)(()=>_?.tippers.filter(e=>e.user.id!==k?.id)??[],[_?.tippers,k]),{data:z,isLoading:H}=(0,p.useTippableCurrenciesQuery)(),{sortedCurrencies:q}=(0,m.useWalletCurrencies)({address:k?.address||"",currenciesData:z,isCurrenciesLoading:H});return(0,s.useEffect)(()=>{N?(A(B),Q()):A([])},[N]),(0,t.jsxs)(d.Dialog,{open:N,onOpenChange:C,children:[(0,t.jsx)(d.DialogTrigger,{asChild:!0,children:e}),(0,t.jsxs)(d.DialogContent,{className:(0,y.cn)("bg-background sm:bg-surface-raised flex h-full w-full grow flex-col px-6 pt-0 backdrop-blur-xs sm:h-fit sm:w-[420px] sm:gap-0 sm:p-6",P?"grow-0 justify-end pb-[calc(142px+env(safe-area-inset-bottom))]":"grow justify-between"),children:[(0,t.jsx)(c.ArenaDialogHeader,{className:"mb-12 sm:mb-8",title:2===O?I===b?"Tip Every Current Viewer":"Tip Top 10 Supporters":"Tipping Party",showBack:!0,onBack:2===O?()=>L(1):()=>C(!1)}),1===O&&(0,t.jsx)(l.TipPartyContent,{options:[{value:b,label:(0,t.jsxs)(t.Fragment,{children:["Tip Every",(0,t.jsx)("br",{}),"Current Viewer"]}),emoji:"📺"},{value:j,label:(0,t.jsxs)(t.Fragment,{children:["Tip Top 10",(0,t.jsx)("br",{}),"Supporters"]}),emoji:"👏"}],selected:I,setSelected:e=>E(e),infoText:(0,t.jsxs)("div",{className:"text-text-subtle text-center text-xs leading-[18px] font-semibold",children:[(0,t.jsx)("h4",{className:"text-xs",children:I===b?"Every current stream viewer will receive the same tip.":"Top 10 stream supporters will receive the same tip."}),(0,t.jsx)("p",{className:"text-text-primary mt-1",children:I===b?`${M.length} tips will be sent`:U?"Loading…":`${W.length} tips will be sent`})]}),onContinue:()=>L(2),continueLabel:"Continue"}),2===O&&(0,t.jsx)(o.TipFormContent,{recepients:I===j?W.slice(0,10).map(e=>{let t=e.user;return{id:t.id,address:t.address||"",userName:t.userName,handle:t.handle,profilePicture:t.profilePicture}}):M.map(e=>({id:e.id,address:e.address||"",userName:e.name,handle:e.username,profilePicture:e.avatar})),setOpen:C,sortedCurrencies:q,setResetForm:void 0,distributionMode:"equal",buttonLabel:"Send tips",customRecipientsSelector:null,TippingType:h.TippingTypeEnum.LIVESTREAM_TIPS,onPartyMessage:async({_values:e})=>{let t=q.find(t=>t.contractAddress===e.contractAddress&&t.blockchain===e.blockchain);R({type:"tip-party",data:{amount:Number(e.tipAmount.replace(/,/g,"")),token:{name:e.currency,icon:t?.photoURL||"",blockchain:t?.blockchain},type:I}})}})]})]})}])},118167,e=>{"use strict";var t=e.i(843476);e.i(732832);var s=e.i(742002),a=e.i(799676),r=e.i(487486);e.s(["ParticipantListItem",0,({user:e,children:i,badge:n})=>(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)(a.Avatar,{className:"size-[42px]",children:[(0,t.jsx)(a.AvatarImage,{src:e.avatar}),(0,t.jsx)(a.AvatarFallback,{})]}),(0,t.jsxs)("div",{className:"flex flex-col overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,t.jsx)("p",{className:"text-text-primary truncate text-sm font-medium",children:e.name}),"invited"===n&&(0,t.jsx)(r.Badge,{className:"shrink-0",children:"Invited"}),"left"===n&&(0,t.jsx)(r.Badge,{className:"shrink-0",variant:"destructive",children:"Left"})]}),(0,t.jsxs)("p",{className:"text-text-subtle truncate text-sm",children:["@",(0,s.maskHandle)(e.username)]})]}),(0,t.jsx)("div",{className:"ml-auto",children:i})]})])},678830,e=>{"use strict";var t=e.i(843476),s=e.i(912598);e.i(753366);var a=e.i(484940),r=e.i(903023),i=e.i(955707),n=e.i(332337),l=e.i(118167);e.s(["ModerateViewerListItem",0,({user:e,blocked:o})=>{let c=(0,s.useQueryClient)(),d=(0,i.useLivestreamStore)(e=>e.id),{mutateAsync:u,isPending:m}=(0,r.useBlockUserLivestreamMutation)({onSuccess:()=>{c.invalidateQueries({queryKey:a.livestreamQueries.blockedViewersKey(d)})}}),{mutateAsync:x,isPending:p}=(0,r.useUnblockUserLivestreamMutation)({onSuccess:()=>{c.invalidateQueries({queryKey:a.livestreamQueries.blockedViewersKey(d)})}}),h=async()=>{await u({livestreamId:d,userId:e.id})},f=async()=>{await x({livestreamId:d,userId:e.id})};return(0,t.jsx)(l.ParticipantListItem,{user:e,children:o?(0,t.jsx)(n.Button,{variant:"secondary",className:"h-[34px] w-24",onClick:f,loading:p,children:"Undo"}):(0,t.jsx)(n.Button,{variant:"outline",className:"h-[34px] w-24",onClick:h,loading:m,children:"Remove"})})}])},153958,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(989438),r=e.i(266027),i=e.i(531779),n=e.i(95261),l=e.i(484940),o=e.i(955707);e.i(156669);var c=e.i(896491),d=e.i(184282),u=e.i(434330),m=e.i(776639),x=e.i(793479),p=e.i(63501),h=e.i(678830);e.s(["ViewersModeration",0,({children:e})=>
11{let[f,g]=(0,s.useState)(!1),[y,v]=(0,s.useState)(""),b=(0,n.default)(y),j=(0,o.useLivestreamStore)(e=>e.id),{data:w}=(0,r.useQuery)({...l.livestreamQueries.blockedViewers(j)}),S=(0,a.useParticipants)({updateOnlyOn:[i.RoomEvent.ParticipantConnected,i.RoomEvent.ParticipantDisconnected,i.RoomEvent.ParticipantAttributesChanged]}),N=(0,s.useMemo)(()=>{let e=w?.blockedViewers.map(e=>({id:e.id,name:e.user.userName,avatar:e.user.profilePicture,username:e.user.handle,role:e.role,blocked:!0}))??[],t=S.map(e=>({id:e.identity,name:e.attributes?.name,avatar:e.attributes?.avatar,username:e.attributes?.username,role:e.attributes?.role,blocked:!1})).filter(t=>!e.some(e=>e.id.includes(t.id)));return[...e,...t].filter(e=>e.role!==p.ROLES.HOST&&!!(e?.name?.toLowerCase()?.includes(b?.toLowerCase())||e?.username?.toLowerCase()?.includes(b?.toLowerCase())))},[S,w?.blockedViewers,b]),C=(0,s.useCallback)(e=>{v(e.target.value)},[]),k=(0,s.useCallback)(e=>{e&&setTimeout(()=>{e.focus()},200)},[]);return(0,t.jsxs)(m.Dialog,{open:f,onOpenChange:e=>{g(e)},children:[(0,t.jsx)(m.DialogTrigger,{asChild:!0,children:e}),(0,t.jsxs)(m.DialogContent,{className:"bg-background sm:bg-background z-50 flex h-full w-full flex-col gap-0 overflow-y-auto px-0 pt-0 pb-16 md:max-h-[700px]",children:[(0,t.jsxs)("div",{className:"bg-background sticky top-0 z-20 px-6 pb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 pt-[calc(1rem+env(safe-area-inset-top))] pb-4",children:[(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsx)(m.DialogClose,{className:"flex shrink-0",children:(0,t.jsx)(c.ArrowBackOutlineIcon,{className:"text-text-primary size-5"})})}),(0,t.jsx)("h2",{className:"text-text-primary text-base leading-[22px] font-semibold",children:"Moderate Viewers"}),(0,t.jsx)("div",{className:"flex-1"})]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(x.Input,{value:y,onChange:C,placeholder:"Search for people and groups",className:"border-border-default placeholder:text-text-subtle h-[47px] rounded-full border bg-transparent py-2 pr-10 pl-11 ring-0",ref:k}),(0,t.jsx)(u.SearchFilledIcon,{className:"fill-text-subtle pointer-events-none absolute top-1/2 left-[20px] size-[14px] -translate-y-1/2 select-none"}),y&&(0,t.jsx)("button",{className:"border-border-default bg-surface-modal/88 absolute top-1/2 right-[10px] -translate-y-1/2 rounded-full border p-1",children:(0,t.jsx)(d.CloseOutlineIcon,{className:"text-text-primary pointer-events-auto size-[14px] select-none",onClick:()=>v("")})})]})]}),N&&N.length>0&&(0,t.jsx)("div",{className:"flex flex-col gap-[32px] px-6 py-5",children:N.map(({blocked:e,...s})=>(0,t.jsx)(h.ModerateViewerListItem,{user:s,blocked:e},s.id+e?"blocked":"not-blocked"))})]})]})}])},814003,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(522016),r=e.i(649320),i=e.i(121251),n=e.i(722624),l=e.i(102386),o=e.i(266027),c=e.i(237016),d=e.i(355750),u=e.i(48314),m=e.i(803368),x=e.i(550075),p=e.i(484940),h=e.i(179520);e.i(28856);var f=e.i(807214),g=e.i(446337),y=e.i(458866),v=e.i(955707),b=e.i(645274);e.i(732832);var j=e.i(551360),w=e.i(746079);e.i(17912);var S=e.i(503734),N=e.i(11416);e.i(156669);var C=e.i(364586),k=e.i(405105),T=e.i(822035),I=e.i(986880),E=e.i(523851),M=e.i(114021),A=e.i(316743),P=e.i(22389),O=e.i(21268),L=e.i(127397),D=e.i(1362);e.i(175156);var R=e.i(459697),F=e.i(172310),B=e.i(562164),_=e.i(755146),Q=e.i(63501),U=e.i(796406),W=e.i(516414),z=e.i(153958);function H(){let e=(0,v.useLivestreamStore)(e=>e.id),r=(0,v.useLivestreamStore)(e=>e.actions),{user:i}
11=(0,f.useUser)(),[x,h]=(0,s.useState)(!1),C=(0,g.useClipStore)(e=>e.actions),k=(0,b.usePostStore)(e=>e.setQuote),I=(0,y.useComposeModalStore)(e=>e.openModal),{data:L}=(0,o.useQuery)({...p.livestreamQueries.livestreamSimpleInfo(e),refetchInterval:e=>!(e.state.data?.livestream.isRecorded||e.state.data?.livestream.recordingUrl)&&5e3}),R=L?.livestream.threadId,{data:_}=(0,o.useQuery)({queryKey:["threads",R],queryFn:()=>(0,u.getThreadById)(R??null),enabled:!!R}),Q=_?.thread,{mutate:U,isPending:H}=(0,S.useOptimisticMutation)({mutationFn:e=>(0,u.postRepost)(e),updaters:[e=>(0,N.threadResponseRepostUpdater)({...e,reposted:!0})],onSuccess:()=>{B.toast.green("Reposted successfully")},onError:()=>{B.toast.red("Failed to repost")}}),{mutate:q,isPending:K}=(0,S.useOptimisticMutation)({mutationFn:e=>(0,u.deleteRepost)(e),updaters:[e=>(0,N.threadResponseRepostUpdater)({...e,reposted:!1})],onSuccess:()=>{B.toast.green("Repost removed")},onError:()=>{B.toast.red("Failed to remove repost")}}),G=[{id:"repost",icon:A.RepostOutlineIcon,label:Q?.reposted?"Undo repost":"Repost",onClick:()=>{Q&&(Q.reposted?q({threadId:Q.id}):U({threadId:Q.id}),h(!1))}},{id:"quote",icon:E.MenuAlt2OutlineIcon,label:"Quote",onClick:()=>{Q&&(k(Q),I(),h(!1))}}],V=L?.livestream.recordingUrl,$=(0,l.useRemoteParticipant)({identity:L?.host.id??""}),{attributes:Y}=(0,n.useParticipantAttributes)({participant:$});return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(c.default,{text:(0,w.addReferralToUrl)(window.location.href,i?.handle),onCopy:()=>{B.toast.green("Copied the stream link to the clipboard")},children:(0,t.jsx)("button",{className:"bg-surface-raised shadow-border hover:bg-surface-hover flex size-10 items-center justify-center rounded-full",children:(0,t.jsx)(O.ShareOutlineV2Icon,{className:"text-text-primary mr-0.5 size-6",strokeWidth:1.5})})}),Q&&(0,t.jsx)(F.ResponsiveMenu,{trigger:(0,t.jsx)("button",{className:(0,j.cn)("bg-surface-raised shadow-border hover:bg-surface-hover flex size-10 items-center justify-center rounded-full"),disabled:H||K,children:(0,t.jsx)(A.RepostOutlineIcon,{className:(0,j.cn)("text-text-primary size-6",Q.reposted&&"text-success"),strokeWidth:1.5})}),items:G,open:x,onOpenChange:h,align:"start"}),(0,t.jsx)(z.ViewersModeration,{children:(0,t.jsx)("button",{className:"bg-surface-raised shadow-border hover:bg-surface-hover flex size-10 items-center justify-center rounded-full",children:(0,t.jsx)(D.UserXOutlineIcon,{className:"text-text-primary mb-0.5 size-6",strokeWidth:1.5})})}),(0,t.jsx)("button",{className:"bg-surface-raised shadow-border hover:bg-surface-hover flex size-10 items-center justify-center rounded-full",onClick:()=>{r.setChatOpenInNewWindow(!0)},children:(0,t.jsx)(T.AnnotationOpenOutlineIcon,{className:"text-text-primary size-6",strokeWidth:1.5})}),V&&(0,t.jsx)(a.default,{href:"/live/clip",target:"_blank",className:"bg-surface-raised shadow-border hover:bg-surface-hover flex size-10 items-center justify-center rounded-full",onClick:()=>{let t,s=L?.livestream.startedOn;if(!s)return;let a=new Date(s).getTime(),r=Math.max(0,(t=Math.floor((new Date().getTime()-a)/1e3)-2)-m.MAX_RANGE_LENGTH);C.reset(),C.setUrl(V),C.setDuration(t),C.setStart(r),C.setEnd(t),C.setLivestreamId(e),C.setHost({id:Y?.id??"",name:Y?.name??"",username:Y?.username??"",avatar:Y?.avatar??""})},children:(0,t.jsx)(P.ScissorsOutlineIcon,{className:"text-text-primary size-7",strokeWidth:1.5})}),(0,t.jsx)(d.ErrorBoundary,{fallback:null,children:(0,t.jsx)(W.LivestreamTippingPartyModal,{children:(0,t.jsx)("button",{className:"bg-surface-raised shadow-border hover:bg-surface-hover flex size-10 items-center justify-center rounded-full",children:(0,t.jsx)(M.PartyOutlineIcon,{className:"text-text-primary size-6",strokeWidth:1.5})})})})]})}function q({user:e,threadId:r}){let i=(0,v.useLivestreamStore)(e=>e.id),d=(0,v.useLivestreamStore)(e=>e.useHls),{user:h}=(0,f.useUser)(),[C,T]=(0,s.useState)(!1),[M,R]=(0,s.useState)(!1),[Q,W]=(0,s.useState)(!1),[H,K]=(0,s.useState)(!1),G=(0,g.useClipStore)(e=>e.actions),V=(0,b.usePostStore)(e=>e.setQuote),$=(0,y.useComposeModalStore)(e=>e.openModal),{data:Y}=(0,o.useQuery)({queryKey:["threads",r],queryFn:()=>(0,u.getThreadById)(r),enabled:!!r}),X=Y?.thread,{mutate:J,isPending:Z}=(0,S.useOptimisticMutation)({mutationFn:e=>(0,u.postRepost)(e),updaters:[e=>(0,N.threadResponseRepostUpdater)({...e,reposted:!0})],onSuccess:()=>{B.toast.green("Reposted successfully")},onError:()=>{B.toast.red("Failed to repost")}}),{mutate:ee,isPending:et}=(0,S.useOptimisticMutation)({mutationFn:e=>(0,u.deleteRepost)(e),updaters:[e=>(0,N.threadResponseRepostUpdater)({...e,reposted:!1})],onSuccess:()=>{B.toast.green("Repost removed")},onError:()=>{B.toast.red("Failed to remove repost")}}),es=[{id:"repost",icon:A.RepostOutlineIcon,label:X?.reposted?"Undo repost":"Repost",onClick:()=>{X&&(X.reposted?ee({threadId:X.id}):J({threadId:X.id}),K(!1))}},{id:"quote",icon:E.MenuAlt2OutlineIcon,label:"Quote",onClick:()=>{X&&(V(X),$(),K(!1))}}],{data:ea}=(0,o.useQuery)({...p.livestreamQueries.livestreamSimpleInfo(i),refetchInterval:e=>!(e.state.data?.livestream.isRecorded||e.state.data?.livestream.recordingUrl)&&5e3}),er=(0,l.useRemoteParticipant)({identity:ea?.host.id??""}),{attributes:ei}=(0,n.useParticipantAttributes)({participant:er}),en=ea?.livestream.recordingUrl;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(_.DropdownMenu,{open:C,onOpenChange:T,children:[(0,t.jsx)(_.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)("button",{className:"bg-surface-raised shadow-border hover:bg-surface-hover flex size-10 items-center justify-center rounded-full",children:(0,t.jsx)(k.AddOutlineIcon,{className:"text-text-primary size-6"})})}),(0,t.jsxs)(_.DropdownMenuContent,{align:"end",side:"top",className:"rounded-sm",children:[(0,t.jsx)(_.DropdownMenuItem,{className:"w-full gap-4",asChild:!0,children:(0,t.jsx)(c.default,{text:(0,w.addReferralToUrl)(window.location.href,h?.handle),onCopy:()=>{B.toast.green("Copied the stream link to the clipboard"),T(!1)},children:(0,t.jsxs)("button",{children:[(0,t.jsx)(O.ShareOutlineV2Icon,{className:"text-text-primary size-5 shrink-0"}),(0,t.jsx)("span",{children:"Share Link"})]})})}),(0,t.jsxs)(_.DropdownMenuItem,{className:"w-full gap-4",onClick:()=>{R(!0),T(!1)},children:[(0,t.jsx)(I.FlagOutlineIcon,{className:"text-text-primary size-5 shrink-0"}),(0,t.jsx)("span",{children:"Report Stream"})]})]})]}),X&&(0,t.jsx)(F.ResponsiveMenu,{trigger:(0,t.jsx)("button",{className:(0,j.cn)("bg-surface-raised shadow-border hover:bg-surface-hover flex size-10 items-center justify-center rounded-full"),disabled:Z||et,children:(0,t.jsx)(A.RepostOutlineIcon,{className:(0,j.cn)("text-text-primary size-6",X.reposted&&"text-success"),strokeWidth:1.5})}),items:es,open:H,onOpenChange:K,align:"start"}
11),h?.isMod&&(0,t.jsx)(z.ViewersModeration,{children:(0,t.jsx)("button",{className:"bg-surface-raised shadow-border hover:bg-surface-hover flex size-10 items-center justify-center rounded-full",children:(0,t.jsx)(D.UserXOutlineIcon,{className:"text-text-primary mb-0.5 size-6",strokeWidth:1.5})})}),en&&(0,t.jsx)(a.default,{href:"/live/clip",target:"_blank",className:"bg-surface-raised shadow-border hover:bg-surface-hover flex size-10 items-center justify-center rounded-full",onClick:()=>{let e;if(d){let t=document.querySelector("video[data-hls-player='true']");if(t){let s=t.seekable.length>0;if(!Number.isFinite(t.duration)&&s)e=Math.floor(t.seekable.end(t.seekable.length-1));else if(Number.isFinite(t.duration))e=Math.floor(t.duration);else{let t=ea?.livestream.startedOn;if(!t)return;let s=new Date(t).getTime();e=Math.floor((new Date().getTime()-s)/1e3)-2}}else{let t=ea?.livestream.startedOn;if(!t)return;let s=new Date(t).getTime();e=Math.floor((new Date().getTime()-s)/1e3)-2}}else{let t=ea?.livestream.startedOn;if(!t)return;let s=new Date(t).getTime();e=Math.floor((new Date().getTime()-s)/1e3)-2}let t=e,s=Math.max(0,e-m.MAX_RANGE_LENGTH);G.reset(),G.setUrl(en),G.setDuration(e),G.setStart(s),G.setEnd(t),G.setLivestreamId(i),G.setHost({id:ei?.id??"",name:ei?.name??"",username:ei?.username??"",avatar:ei?.avatar??""})},children:(0,t.jsx)(P.ScissorsOutlineIcon,{className:"text-text-primary size-7",strokeWidth:1.5})}),(0,t.jsx)("button",{className:"bg-surface-raised shadow-border hover:bg-surface-hover flex size-10 items-center justify-center rounded-full",onClick:()=>W(!0),children:(0,t.jsx)(L.TipOutlineIcon,{className:"text-text-primary size-6"})})]}),(0,t.jsx)(U.CustomTipModal,{userToSend:e,open:Q,setOpen:W}),(0,t.jsx)(x.ReportModal,{open:M,setOpen:R,user:e,threadId:r})]})}e.s(["QuickButtons",0,function(){let e=(0,v.useLivestreamStore)(e=>e.id),{data:s}=(0,o.useQuery)(p.livestreamQueries.livestreamSimpleInfo(e)),a=(0,r.useLocalParticipant)(),n=(0,i.useParticipantAttribute)("role",{participant:a.localParticipant}),{data:l,isLoading:c}=(0,o.useQuery)({...h.userQueries.byHandle(s?.host.user.handle??""),enabled:!!s?.host.user.handle});return(l||!c)&&n?n===Q.ROLES.HOST?(0,t.jsx)(H,{}):l?.user&&s?.livestream.threadId?(0,t.jsx)(q,{user:l?.user,threadId:s?.livestream?.threadId}):null:null}
11,"QuickButtonsMobile",0,function(){let[e,a]=(0,s.useState)(!1),[n,l]=(0,s.useState)(!1),[d,m]=(0,s.useState)(!1),[g,k]=(0,s.useState)(!1),T=(0,v.useLivestreamStore)(e=>e.id),M=(0,v.useLivestreamStore)(e=>e.actions),{user:P}=(0,f.useUser)(),D=(0,b.usePostStore)(e=>e.setQuote),Q=(0,y.useComposeModalStore)(e=>e.openModal),{data:W}=(0,o.useQuery)(p.livestreamQueries.livestreamSimpleInfo(T)),z=(0,r.useLocalParticipant)(),H=(0,i.useParticipantAttribute)("role",{participant:z.localParticipant}),{data:q,isLoading:K}=(0,o.useQuery)({...h.userQueries.byHandle(W?.host.user.handle??""),enabled:!!W?.host.user.handle}),G=W?.livestream.threadId,{data:V}=(0,o.useQuery)({queryKey:["threads",G],queryFn:()=>(0,u.getThreadById)(G??null),enabled:!!G}),$=V?.thread,{mutate:Y,isPending:X}=(0,S.useOptimisticMutation)({mutationFn:e=>(0,u.postRepost)(e),updaters:[e=>(0,N.threadResponseRepostUpdater)({...e,reposted:!0})],onSuccess:()=>{B.toast.green("Reposted successfully")},onError:()=>{B.toast.red("Failed to repost")}}),{mutate:J,isPending:Z}=(0,S.useOptimisticMutation)({mutationFn:e=>(0,u.deleteRepost)(e),updaters:[e=>(0,N.threadResponseRepostUpdater)({...e,reposted:!1})],onSuccess:()=>{B.toast.green("Repost removed")},onError:()=>{B.toast.red("Failed to remove repost")}}),ee=[{id:"repost",icon:A.RepostOutlineIcon,label:$?.reposted?"Undo repost":"Repost",onClick:()=>{$&&($.reposted?J({threadId:$.id}):Y({threadId:$.id}),k(!1))}},{id:"quote",icon:E.MenuAlt2OutlineIcon,label:"Quote",onClick:()=>{$&&(D($),Q(),k(!1))}}];return(q||!K)&&H?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center pb-2",children:[(0,t.jsxs)(_.DropdownMenu,{open:e,onOpenChange:a,children:[(0,t.jsx)(_.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)("button",{className:"p-1.5",onClick:()=>M.toggleChatOpen(),children:(0,t.jsx)(C.AddCircleOutlineIcon,{className:"text-text-primary size-7"})})}),(0,t.jsxs)(_.DropdownMenuContent,{align:"end",side:"top",className:"rounded-sm",children:[(0,t.jsx)(_.DropdownMenuItem,{className:"w-full gap-4",asChild:!0,children:(0,t.jsx)(c.default,{text:(0,w.addReferralToUrl)(window.location.href,P?.handle),onCopy:()=>{B.toast.green("Copied the stream link to the clipboard"),a(!1)},children:(0,t.jsxs)("button",{children:[(0,t.jsx)(O.ShareOutlineV2Icon,{className:"text-text-primary size-5 shrink-0"}),(0,t.jsx)("span",{children:"Share Link"})]})})}),(0,t.jsxs)(_.DropdownMenuItem,{className:"w-full gap-4",onClick:()=>{l(!0),a(!1)},children:[(0,t.jsx)(I.FlagOutlineIcon,{className:"text-text-primary size-5 shrink-0"}),(0,t.jsx)("span",{children:"Report Stream"})]})]})]}),$&&(0,t.jsx)(F.ResponsiveMenu,{trigger:(0,t.jsx)("button",{className:"p-1.5",disabled:X||Z,children:(0,t.jsx)(A.RepostOutlineIcon,{className:(0,j.cn)("text-text-primary size-6",$.reposted&&"text-success"),strokeWidth:1.8})}),items:ee,open:g,onOpenChange:k,align:"end"}),(0,t.jsx)("button",{className:"p-1.5",onClick:()=>m(!0),children:(0,t.jsx)(L.TipOutlineIcon,{strokeWidth:1.8,className:"text-text-primary size-6"})}),(0,t.jsx)("button",{className:"p-1.5",onClick:()=>M.toggleChatOpen(),children:(0,t.jsx)(R.ChatbubbleOutlineIcon,{className:"text-text-primary size-6"})})]}),q&&q.user&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(U.CustomTipModal,{userToSend:q.user,open:d,setOpen:m}),(0,t.jsx)(x.ReportModal,{open:n,setOpen:l,user:q.user,threadId:W?.livestream.threadId})]})]}):null}])},991563,e=>{"use strict";var t=e.i(843476),s=e.i(955707),a=e.i(677572),r=e.i(503661),i=e.i(170202),n=e.i(997055);e.s(["RightPanel",0,function(){return(0,s.useLivestreamStore)(e=>e.chat.isOpenInNewWindow)?(0,t.jsx)("div",{className:"flex h-full items-center justify-center p-4 text-center",children:(0,t.jsx)("div",{className:"text-text-primary text-base",children:"Opened in a separate window"})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.TipCards,{}),(0,t.jsxs)(a.Tabs,{defaultValue:"chat",className:"flex grow flex-col",children:[(0,t.jsxs)(a.TabsList,{className:"w-full",children:[(0,t.jsx)(a.TabsTrigger,{value:"chat",className:"data-[state=active]:after:bg-accent grow",children:"Chat"}),(0,t.jsx)(a.TabsTrigger,{value:"supporters",className:"data-[state=active]:after:bg-accent grow",children:"Supporters"})]}),(0,t.jsx)(a.TabsContent,{value:"chat",className:"grow",children:(0,t.jsx)(r.LivestreamChatContainer,{})}),(0,t.jsx)(a.TabsContent,{value:"supporters",className:"grow",children:(0,t.jsx)(i.SupportersContainer,{})})]})]})}])},508210,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(770703),r=e.i(618566),i=e.i(649320),n=e.i(121251),l=e.i(722624),o=e.i(815894),c=e.i(266027),d=e.i(377143),u=e.i(449198);e.i(156669);var m=e.i(803920),x=e.i(954223),p=e.i(63501),h=e.i(330621),f=e.i(112489),g=e.i(503661),y=e.i(354146),v=e.i(814003),b=e.i(991563),j=e.i(170202),w=e.i(997055),S=e.i(113924),N=e.i(799676),C=e.i(332337),k=e.i(242405);e.i(753366);
11var T=e.i(484940),I=e.i(179520),E=e.i(955707);function M(){let e=(0,E.useLivestreamStore)(e=>e.playerPortalNode);return e?(0,t.jsx)(d.OutPortal,{node:e}):null}let A=(0,a.default)(()=>e.A(644537),{loadableGenerated:{modules:[294989]},ssr:!1});function P(){let e=(0,E.useLivestreamStore)(e=>e.id),s=(0,o.useRoomInfo)(),{data:a}=(0,c.useQuery)(T.livestreamQueries.livestreamSimpleInfo(e)),r=(s.metadata?JSON.parse(s.metadata):{}).name||a?.livestream.name||"",l=(0,i.useLocalParticipant)(),d=(0,n.useParticipantAttribute)("role",{participant:l.localParticipant}),{data:u,isLoading:m}=(0,c.useQuery)({...I.userQueries.byHandle(a?.host.user.handle??""),enabled:!!a?.host.user.handle});return(u||!m)&&d?(0,t.jsxs)("div",{className:"isolate mx-auto flex min-h-svh max-w-[1350px] gap-6 px-4",children:[(0,t.jsx)("header",{className:"relative z-3 hidden sm:flex sm:shrink-0 sm:flex-col sm:items-end",children:(0,t.jsx)(S.SideNav,{variant:"livestream"})}),(0,t.jsx)("div",{className:"absolute mx-auto min-h-svh max-w-[1350px]",children:(0,t.jsx)("div",{className:"absolute top-16 left-48 -z-20 size-[800px] rounded-full bg-[#876CA2] blur-[200px]"})}),(0,t.jsx)("div",{className:"[.light_&]:bg-background/80 absolute inset-0 -z-10 bg-[rgba(28,22,20,0.80)] backdrop-blur-sm"}),(0,t.jsxs)("div",{className:"flex grow-2 flex-nowrap justify-start gap-4 pt-8 xl:gap-7",children:[(0,t.jsxs)("div",{className:"relative flex w-full grow flex-col",children:[(0,t.jsx)(M,{}),d===p.ROLES.HOST&&(0,t.jsx)(A,{}),(0,t.jsxs)("div",{className:"mt-6 flex items-start justify-between gap-6 px-3",children:[(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold",children:r}),(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-4",children:[(0,t.jsx)(f.TimeCounter,{}),(0,t.jsx)(f.ViewCounter,{})]})]}),(0,t.jsx)(v.QuickButtons,{})]}),d!==p.ROLES.HOST&&(0,t.jsx)("div",{className:"mt-6 flex items-start justify-between gap-6",children:(0,t.jsx)(h.HostInfo,{})})]}),(0,t.jsx)("div",{className:"hidden shrink-0 pb-10 lg:flex lg:w-[290px] lg:flex-col xl:w-[380px]",children:(0,t.jsx)("div",{className:"border-border-default bg-background flex h-full max-h-[calc(100svh-64px)] w-full flex-col overflow-hidden rounded-xl border",children:(0,t.jsx)(b.RightPanel,{})})})]})]}):null}function O(){let e=(0,r.useRouter)(),s=(0,E.useLivestreamStore)(e=>e.id),{data:a}=(0,c.useQuery)(T.livestreamQueries.livestreamSimpleInfo(s)),i=(0,E.useLivestreamStore)(e=>e.chat.isOpen),n=(0,E.useLivestreamStore)(e=>e.showBottomBar),l=(0,o.useRoomInfo)(),d=(l.metadata?JSON.parse(l.metadata):{}).name||a?.livestream.name||"",u={id:a?.host.id??"",name:a?.host.user.userName??"",avatar:a?.host.user.profilePicture??"",username:a?.host.user.handle??"",role:p.ROLES.HOST};return(0,t.jsxs)("div",{className:"pt-pwa fixed inset-0 flex flex-col",children:[(0,t.jsxs)("div",{className:"bg-surface-raised relative flex w-full shrink-0 flex-col overflow-hidden pt-2 pr-4 pb-4 pl-2",children:[(0,t.jsx)(x.LogoIcon,{className:"text-text-muted pointer-events-none absolute top-2 -right-6 w-[120px] opacity-5 select-none"}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(C.Button,{variant:"ghost",className:"bg-none p-2 hover:bg-none",onClick:()=>{window.history.length>1?e.back():e.push("/home")},children:(0,t.jsx)(m.ChevronDownFilled,{className:"text-text-primary size-6"})}),(0,t.jsx)("h3",{className:"text-text-primary inline text-lg leading-[22px] font-semibold",children:d})]})]}),(0,t.jsx)(M,{}),(0,t.jsxs)("div",{className:"border-border-subtle bg-surface-raised flex items-center justify-between border-b px-4 py-3",children:[(0,t.jsx)(y.LivestreamUserProfileModal,{user:u,followable:!0,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(N.Avatar,{className:"size-8",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(N.AvatarImage,{src:a?.host.user.profilePicture}),(0,t.jsx)(N.AvatarFallback,{})]})}),(0,t.jsx)("h4",{className:"text-text-primary text-sm font-semibold",children:a?.host.user.userName})]})}),(0,t.jsx)(f.ViewCounter,{})]}),(0,t.jsx)("div",{className:"relative flex h-full w-full grow flex-col",children:i?(0,t.jsx)(g.LivestreamChatContainer,{}):(0,t.jsxs)("div",{className:"flex grow flex-col",children:[(0,t.jsx)(w.TipCards,{}),(0,t.jsx)(j.SupportersContainer,{})]})}),n?(0,t.jsx)("div",{className:"pb-pwa border-border-subtle flex shrink-0 flex-col border-t",children:(0,t.jsx)("div",{className:"flex justify-end px-6 py-4",children:(0,t.jsx)(v.QuickButtonsMobile,{})})}):null]})}e.s(["LivestreamPageContent",0,function(){let e=(0,k.useMediaQuery)(k.BREAKPOINTS.lg),a=(0,E.useLivestreamStore)(e=>e.id),r=(0,E.useLivestreamStore)(e=>e.actions),o=(0,i.useLocalParticipant)(),d=(0,n.useParticipantAttribute)("role",{participant:o.localParticipant}),{attributes:m}=(0,l.useParticipantAttributes)({participant:o.localParticipant});return((0,c.useQuery)({queryKey:["livestream-participant-attributes",a,m],queryFn:async()=>(m&&m?.id&&m?.name&&m?.avatar&&m?.username&&m?.role||await (0,u.postUpdateAttributes)({livestreamId:a}),!0)}),(0,s.useEffect)(()=>{r.setMyRole(d),d===p.ROLES.HOST&&r.setIsMuted(!0)},[d]),e)?(0,t.jsx)(P,{}):(0,t.jsx)(O,{})}])},44947,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(618566),r=e.i(519711),i=e.i(377143),n=e.i(791768),l=e.i(955707),o=e.i(553539),c=e.i(508210),d=e.i(809918),u=e.i(210525);e.s(["LivestreamPortalProvider",0,()=>
11{let[e,m]=(0,s.useState)(!1),x=(0,a.useRouter)(),p=(0,a.useSelectedLayoutSegments)(),h=(0,s.useRef)(p),f=(0,l.useLivestreamStore)(e=>e.token),g=(0,l.useLivestreamStore)(e=>e.isGuestViewer),y=(0,l.useLivestreamStore)(e=>e.isNewStream),v=(0,l.useLivestreamStore)(e=>e.playerNode),b=(0,l.useLivestreamStore)(e=>e.miniNode),j=(0,l.useLivestreamStore)(e=>e.actions),w=(0,a.usePathname)();(0,s.useEffect)(()=>{!f||y||v||j.createPortalNodes()},[f,y,v,j]),(0,s.useEffect)(()=>{!f&&v&&j.resetPortalNodes()},[f,v,j]),(0,s.useEffect)(()=>{h.current!==p&&(e&&j.disconnect(),h.current=p,m(!1))},[p,e,j]),(0,s.useEffect)(()=>{j.forceRefreshMiniNode()},[w]);let S=w.startsWith("/live/")&&"/live"!==w;return(0,t.jsx)(t.Fragment,{children:f&&!g&&!y&&v&&(0,t.jsx)(r.LiveKitRoom,{serverUrl:n.env.NEXT_PUBLIC_LIVEKIT_URL,token:f,audio:!1,onDisconnected:()=>{y||(0,s.startTransition)(()=>{S&&x.push("/live?streamTab=livestreams"),m(!0)})},children:(0,t.jsxs)(d.DataChannelsProvider,{children:[(0,t.jsx)(u.VideoPlayerPortalProvider,{}),S&&(0,t.jsx)(i.InPortal,{node:v,children:(0,t.jsx)(c.LivestreamPageContent,{})}),!S&&b&&(0,t.jsx)(i.InPortal,{node:b,children:(0,t.jsx)(o.MiniPlayerContent,{})})]})})})}])},108289,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(618566),r=e.i(572751),i=e.i(791768),n=e.i(193505),l=e.i(148979);e.i(732832);var o=e.i(909480),c=e.i(155728);let d=(e,t,s)=>({x:Math.random()*e,y:s?.startInViewport?Math.random()*t:-20-Math.random()*t,radius:.8+1.8*Math.random(),fallSpeed:18+42*Math.random(),driftSpeed:12+24*Math.random(),alpha:.2+.5*Math.random(),phase:Math.random()*Math.PI*2});e.s(["SnowOverlay",0,function(){let e=(0,a.usePathname)();if(e.startsWith("/live/")&&"/live"!==e)return null;let u=(0,n.useLocalDay)(),m=i.env.NEXT_PUBLIC_SNOW_FEATURE_ENABLED,x=(0,c.isSnowSeasonActive)(u),p=(0,c.getSnowSeasonId)(u),h=`${r.UI_PREFERENCES.snowEnabled}:${p}`,[f]=(0,l.useLocalStorage)(h,!0),g=function(){let[e,t]=(0,s.useState)(!0);return(0,s.useEffect)(()=>{if(!window.matchMedia)return;let e=window.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>t(e.matches);return(s(),"function"==typeof e.addEventListener)?(e.addEventListener("change",s),()=>e.removeEventListener("change",s)):(e.addListener(s),()=>e.removeListener(s))},[]),e}(),y=m&&(f??!1)&&x&&!g,v=(0,s.useRef)(null),b=(0,s.useRef)(null),j=(0,s.useRef)(0),w=(0,s.useRef)([]),S=(0,s.useRef)({width:0,height:0,dpr:1});return((0,s.useEffect)(()=>{if(!y)return;let e=v.current;if(!e)return;let t=e.getContext("2d");if(!t)return;let s=()=>{null!==b.current&&(cancelAnimationFrame(b.current),b.current=null),j.current=0},a=()=>{let s=window.innerWidth,a=window.innerHeight,r=(0,o.clamp)(window.devicePixelRatio||1,1,1.5);S.current={width:s,height:a,dpr:r},e.width=Math.floor(s*r),e.height=Math.floor(a*r),t.setTransform(r,0,0,r,0,0),w.current=Array.from({length:(0,o.clamp)(Math.round(s/35),8,40)},()=>d(s,a,{startInViewport:!0}))},r=e=>{if(0!==j.current&&e-j.current<33.333333333333336){b.current=requestAnimationFrame(r);return}let s=j.current||e,a=(0,o.clamp)((e-s)/1e3,0,.05);j.current=e;let{width:i,height:n}=S.current;t.clearRect(0,0,i,n);let l=e/1e3;for(let e of(t.fillStyle="#ffffff",w.current)){e.y+=e.fallSpeed*a;let s=6*Math.sin(e.phase+l);e.x+=(e.driftSpeed+s)*a,e.x<-20&&(e.x=i+20),e.x>i+20&&(e.x=-20),e.y>n+20&&Object.assign(e,d(i,n),{y:-20,x:Math.random()*i}),t.globalAlpha=e.alpha,t.beginPath(),t.arc(e.x,e.y,e.radius,0,2*Math.PI),t.fill()}t.globalAlpha=1,b.current=requestAnimationFrame(r)},i=()=>{document.hidden?s():null===b.current&&(b.current=requestAnimationFrame(r))};return a(),b.current=requestAnimationFrame(r),window.addEventListener("resize",a),document.addEventListener("visibilitychange",i),()=>{s(),window.removeEventListener("resize",a),document.removeEventListener("visibilitychange",i);let{width:e,height:r}=S.current;t.clearRect(0,0,e,r),w.current=[]}},[y]),y)?(0,t.jsx)("canvas",{ref:v,"aria-hidden":"true",className:"pointer-events-none fixed inset-0 z-100 h-full w-full"}):null}])},117994,e=>{"use strict";var t=e.i(651722);e.s(["RoomAudioRenderer",()=>t.R])},98737,e=>{"use strict";var t=e.i(843476),s=e.i(618566),a=e.i(266027),r=e.i(88653),i=e.i(846932),n=e.i(807339),l=e.i(184670);e.i(156669);var o=e.i(995239),c=e.i(158979),d=e.i(9393),u=e.i(897122);let m=()=>{let e=(0,l.useStageRecordingPlayerStore)(e=>e.isRecordingPlayerFullScreen);return(0,t.jsx)(r.AnimatePresence,{children:e&&(0,t.jsx)(i.motion.div,{initial:{height:73,opacity:1},animate:{height:780,opacity:1,transition:{opacity:{duration:.1}}},exit:{height:73,opacity:0,overflow:"hidden",transition:{opacity:{duration:.2,delay:.2}}},transition:{type:"spring",bounce:0,duration:.4},className:"border-border-default bg-background [.light_&]:border-border-default absolute bottom-0 flex w-full flex-col overflow-hidden rounded-[20px] border",children:(0,t.jsx)(u.StagePlayerContent,{})})})},x=()=>{let e=(0,l.useStageRecordingPlayerStore)(e=>!!e.url),s=(0,l.useStageRecordingPlayerStore)(e=>e.id),{data:r,isLoading:i}=(0,a.useQuery)({...n.stageQueries.stageInfo(s),enabled:e}),u=(0,l.useStageRecordingPlayerStore)(e=>e.isPlaying),m=(0,l.useStageRecordingPlayerStore)(e=>e.audioRef),x=(0,l.useStageRecordingPlayerStore)(e=>e.actions);return e&&r&&!i?(0,t.jsxs)("div",{className:"border-brand bg-accent-gradient flex cursor-pointer items-center justify-between rounded-[20px] border-t-2 px-6 py-3 select-none",onClick:()=>{x.setIsRecordingPlayerFullScreen(!0)},children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(o.BarChartFilledIcon,{className:"text-brand w-3.5"}),(0,t.jsxs)("span",{className:"text-text-primary mt-0.5 text-xs",children:[r.host.user.userName," (Host)"]})]}),(0,t.jsx)("div",{className:"text-text-primary mt-0.5 truncate text-sm font-semibold",children:r.stage.name})]}),(0,t.jsx)("button",{className:"shrink-0 rounded-full p-2",onClick:e=>{let t;e.stopPropagation(),(t=m.current)&&(u?t.pause():t.play(),x.setIsPlaying(!u))},children:u?(0,t.jsx)(c.PauseFilledIcon,{className:"text-text-primary size-5"}):(0,t.jsx)(d.PlayFilledIcon,{className:"text-text-primary size-5"})})]}):null};e.s(["StagePlayerDesktop",0,()=>
11{let e=(0,s.useSelectedLayoutSegments)();return e.length>0&&"(messages)"===e[1]?(0,t.jsxs)("div",{className:"relative mx-auto flex max-w-[1350px] flex-nowrap items-stretch justify-end",children:[(0,t.jsx)("div",{className:"relative z-3 hidden sm:flex sm:shrink-0 sm:grow sm:flex-col sm:items-end",children:(0,t.jsx)("div",{className:"flex w-[88px] flex-col items-end xl:w-[247px]"})}),(0,t.jsxs)("div",{className:"flex shrink grow-2 justify-start",children:[(0,t.jsx)("div",{className:"relative w-full sm:w-[610px] lg:w-[380px]",children:(0,t.jsxs)("div",{className:"fixed bottom-1 w-[380px] justify-end",children:[(0,t.jsx)(x,{}),(0,t.jsx)(m,{})]})}),(0,t.jsx)("div",{className:"hidden lg:flex lg:w-[536px] lg:flex-col xl:w-[638px]"})]})]}):(0,t.jsxs)("div",{className:"relative mx-auto flex max-w-[1350px] flex-nowrap items-stretch justify-end",children:[(0,t.jsx)("div",{className:"relative z-3 hidden sm:flex sm:shrink-0 sm:grow sm:flex-col sm:items-end",children:(0,t.jsx)("div",{className:"flex w-[88px] flex-col items-end xl:w-[247px]"})}),(0,t.jsxs)("div",{className:"flex shrink grow-2 justify-start gap-4 xl:gap-7",children:[(0,t.jsx)("div",{className:"relative w-[500px] xl:w-[615px]"}),(0,t.jsx)("div",{className:"flex w-[290px] flex-col xl:w-[380px]",children:(0,t.jsxs)("div",{className:"fixed bottom-5 w-[374px] justify-end",children:[(0,t.jsx)(x,{}),(0,t.jsx)(m,{})]})})]})]})}])},531960,e=>{"use strict";var t=e.i(843476),s=e.i(618566),a=e.i(266027),r=e.i(912598),i=e.i(88653),n=e.i(846932),l=e.i(807339);e.i(28856);var o=e.i(807214),c=e.i(56162);e.i(156669);var d=e.i(995239),u=e.i(184282),m=e.i(232707),x=e.i(828541);let p=()=>{let e=(0,c.useStageStore)(e=>e.isFullScreen);return(0,t.jsx)(i.AnimatePresence,{children:e&&(0,t.jsx)(n.motion.div,{initial:{height:73,opacity:1},animate:{height:780,opacity:1,transition:{opacity:{duration:.1}}},exit:{height:73,opacity:0,overflow:"hidden",transition:{opacity:{duration:.2,delay:.2}}},transition:{type:"spring",bounce:0,duration:.4},className:"border-surface-elevated bg-background absolute bottom-0 flex w-full flex-col overflow-hidden rounded-[20px] border",children:(0,t.jsx)(x.StageContent,{})})})},h=()=>{let e=(0,r.useQueryClient)(),{user:s}=(0,o.useUser)(),i=(0,c.useStageStore)(e=>!!e.token),n=(0,c.useStageStore)(e=>e.id),x=(0,c.useStageStore)(e=>e.isGuestViewer),{data:p,isLoading:h}=(0,a.useQuery)({...l.stageQueries.stageInfo(n),enabled:i&&!x}),f=(0,c.useStageStore)(e=>e.actions),g=(0,m.useLogSpeakingDuration)(),y=()=>{x?f.reset():p?.host?.userId===s?.id?f.setIsEndStageModalOpen(!0):(g(),f.reset(),setTimeout(()=>{e.invalidateQueries({queryKey:l.stageQueries.currentlyListeningKey()}),f.setCanShowCurrentlyListening(!0)},3e3))};return i?x?(0,t.jsxs)("div",{className:"border-brand bg-accent-gradient flex cursor-pointer items-center justify-between gap-4 rounded-[20px] border-t-2 px-6 py-3 select-none",onClick:()=>{f.setFullScreen(!0)},children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(d.BarChartFilledIcon,{className:"text-brand w-3.5"}),(0,t.jsx)("span",{className:"text-text-primary mt-0.5 text-xs",children:"Guest"})]}),(0,t.jsx)("div",{className:"text-text-primary mt-0.5 truncate text-sm font-semibold",children:"Listening"})]}),(0,t.jsx)("div",{onClick:e=>{e.stopPropagation()},children:(0,t.jsx)("button",{className:"bg-border-default rounded-full p-2",onClick:y,children:(0,t.jsx)(u.CloseOutlineIcon,{className:"text-text-primary size-5"})})})]}):!p||h?null:(0,t.jsxs)("div",{className:"border-brand bg-accent-gradient flex cursor-pointer items-center justify-between gap-4 rounded-[20px] border-t-2 px-6 py-3 select-none",onClick:()=>{f.setFullScreen(!0)},children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(d.BarChartFilledIcon,{className:"text-brand w-3.5"}),(0,t.jsxs)("span",{className:"text-text-primary mt-0.5 text-xs",children:[p.host.user.userName," (Host)"]})]}),(0,t.jsx)("div",{className:"text-text-primary mt-0.5 truncate text-sm font-semibold",children:p.stage.name})]}),(0,t.jsx)("div",{onClick:e=>{e.stopPropagation()},children:(0,t.jsx)("button",{className:"bg-border-default rounded-full p-2",onClick:y,children:(0,t.jsx)(u.CloseOutlineIcon,{className:"text-text-primary size-5"})})})]}):null};e.s(["StageDesktop",0,()=>
11{let e=(0,s.useSelectedLayoutSegments)();return e.length>0&&"(messages)"===e[1]?(0,t.jsxs)("div",{className:"relative mx-auto flex max-w-[1350px] flex-nowrap items-stretch justify-end",children:[(0,t.jsx)("div",{className:"relative z-3 hidden sm:flex sm:shrink-0 sm:grow sm:flex-col sm:items-end",children:(0,t.jsx)("div",{className:"flex w-[88px] flex-col items-end xl:w-[247px]"})}),(0,t.jsxs)("div",{className:"flex shrink grow-2 justify-start",children:[(0,t.jsx)("div",{className:"relative w-full sm:w-[610px] lg:w-[380px]",children:(0,t.jsxs)("div",{className:"fixed bottom-1 w-[380px] justify-end",children:[(0,t.jsx)(h,{}),(0,t.jsx)(p,{})]})}),(0,t.jsx)("div",{className:"hidden lg:flex lg:w-[536px] lg:flex-col xl:w-[638px]"})]})]}):(0,t.jsxs)("div",{className:"relative mx-auto flex max-w-[1350px] flex-nowrap items-stretch justify-end",children:[(0,t.jsx)("div",{className:"relative z-3 hidden sm:flex sm:shrink-0 sm:grow sm:flex-col sm:items-end",children:(0,t.jsx)("div",{className:"flex w-[88px] flex-col items-end xl:w-[247px]"})}),(0,t.jsxs)("div",{className:"flex shrink grow-2 justify-start gap-4 xl:gap-7",children:[(0,t.jsx)("div",{className:"relative w-[500px] xl:w-[615px]"}),(0,t.jsx)("div",{className:"flex w-[290px] flex-col xl:w-[380px]",children:(0,t.jsxs)("div",{className:"fixed bottom-5 w-[374px] justify-end",children:[(0,t.jsx)(h,{}),(0,t.jsx)(p,{})]})})]})]})}])},664011,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(242405),r=e.i(306952),i=e.i(98737),n=e.i(250391),l=e.i(531960);let o=(0,s.memo)(()=>{let e=(0,a.useMediaQuery)(a.BREAKPOINTS.lg);return(0,t.jsxs)(t.Fragment,{children:[e&&(0,t.jsx)(l.StageDesktop,{}),!e&&(0,t.jsx)(r.StageMobile,{})]})});o.displayName="ResponsiveSwitcher",e.s(["PlayerResponsiveSwitcher",0,()=>{let e=(0,a.useMediaQuery)(a.BREAKPOINTS.lg);return(0,t.jsxs)(t.Fragment,{children:[e&&(0,t.jsx)(i.StagePlayerDesktop,{}),!e&&(0,t.jsx)(n.StagePlayerMobile,{})]})},"ResponsiveSwitcher",0,o])},337362,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(266027),r=e.i(557778),i=e.i(242405);e.i(753366);var n=e.i(124171),l=e.i(807339),o=e.i(56162);e.i(156669);var c=e.i(896491),d=e.i(799676),u=e.i(332337),m=e.i(776639),x=e.i(561993),p=e.i(992251);let h=({isLoading:e,live:s,stage:a,listenersCount:i,handleListen:n,isPending:l})=>(0,t.jsxs)(t.Fragment,{children:[e&&(0,t.jsx)("div",{className:"flex items-center justify-center py-10",children:(0,t.jsx)(r.Loa
11der2Icon,{className:"text-brand size-10 animate-spin"})}),!e&&s&&a&&(0,t.jsxs)(t.Fragment,{children:[a.isRecorded?(0,t.jsxs)("div",{className:"border-text-muted mb-3 flex items-center gap-1 self-start rounded-md border px-1.5 py-0.5",children:[(0,t.jsx)("div",{className:"bg-danger size-3 rounded-full"}),(0,t.jsx)("div",{className:"text-text-primary text-sm font-semibold uppercase select-none",children:"REC"})]}):null,(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)("h3",{className:"text-text-primary text-xl leading-[22px] font-semibold break-all",children:a.name}),(0,t.jsxs)("p",{className:"text-text-subtle mt-1 text-sm",children:[i," listeners"]})]}),0===i&&(0,t.jsx)("div",{className:"flex items-center justify-center py-10",children:(0,t.jsx)("div",{className:"max-w-64 text-center",children:(0,t.jsx)("p",{className:"text-text-muted text-sm leading-[18px]",children:"No one joined yet!"})})}),i>0&&(0,t.jsx)("div",{className:"mt-6 grid grid-cols-4 gap-3",children:s.map(e=>(0,t.jsxs)("div",{className:"flex flex-col text-center",children:[(0,t.jsxs)(d.Avatar,{className:"size-[60px] self-center",children:[(0,t.jsx)(d.AvatarImage,{src:e.user.profilePicture}),(0,t.jsx)(d.AvatarFallback,{})]}),(0,t.jsx)("div",{className:"text-text-primary mt-2 truncate text-sm font-semibold",children:e.user.userName}),(0,t.jsx)("div",{className:"flex items-center gap-1 self-center",children:(0,t.jsx)("span",{className:"text-text-subtle text-sm",children:p.ROLE_NAMES[e.role]})})]},e.id))}),(0,t.jsx)(u.Button,{className:"mt-6",onClick:n,loading:l,children:"Start Listening"})]})]});e.s(["StageContinueListeningModal",0,({stageUser:e})=>{let r=(0,i.useMediaQuery)(i.BREAKPOINTS.sm),[d,u]=(0,s.useState)(!0),{data:p,isLoading:f}=(0,a.useQuery)({...l.stageQueries.stageInfo(e.stageId),refetchInterval:e=>!!(e.state.data?.stage.isActive&&d||e.state.data?.stage.isRecorded&&!e.state.data?.stage.isRecordingComplete)&&3e3}),g=(0,o.useStageStore)(e=>e.actions),{mutateAsync:y,isPending:v}=(0,n.useJoinStageMutation)({onSuccess:t=>{u(!1),g.setId(e.stageId),g.setToken(t.token)}}),b=p?.stage??e.stage,j=(0,s.useMemo)(()=>p?p.live.slice(0,4):[],[p]),w=async()=>{await y({stageId:e.stageId})};return r?(0,t.jsx)(m.Dialog,{open:d,onOpenChange:u,children:(0,t.jsxs)(m.DialogContent,{className:"max-w-md gap-0",children:[(0,t.jsxs)("div",{className:"mb-6 flex items-center gap-2",children:[(0,t.jsx)(m.DialogClose,{children:(0,t.jsx)(c.ArrowBackOutlineIcon,{className:"size-5"})}),(0,t.jsx)("h2",{className:"text-text-primary text-base font-semibold",children:"Live Stage"})]}),(0,t.jsx)(h,{isLoading:f,live:j,stage:b,listenersCount:p?.listenersCount??0,handleListen:w,isPending:v})]})}):(0,t.jsx)(x.Drawer,{open:d,onOpenChange:u,children:(0,t.jsx)(x.DrawerContent,{className:"justify-start gap-0 text-left",children:(0,t.jsx)(h,{isLoading:f,live:j,stage:b,listenersCount:p?.listenersCount??0,handleListen:w,isPending:v})})})}])},816572,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(618566),r=e.i(519711),i=e.i(117994),n=e.i(610062),l=e.i(649320),o=e.i(266027),c=e.i(912598),d=e.i(791768),u=e.i(807339);e.i(28856);var m=e.i(807214),x=e.i(56162),p=e.i(232707),h=e.i(664011),f=e.i(337362),g=e.i(318702);let y=()=>{let e=(0,l.useLocalParticipant)(),t=(0,n.useIsSpeaking)(e.localParticipant),a=(0,x.useStageStore)(e=>e.startedTime),r=(0,x.useStageStore)(e=>e.actions),i=(0,p.useLogSpeakingDuration)();return(0,s.useEffect)(()=>{t?r.setStartedTime(Date.now()):a>0&&!t&&(r.addSpeakingDuration(Date.now()-a),r.setStartedTime(0))},[t]),(0,s.useEffect)(()=>{document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&i()})},[]),null},v=()=>((0,s.useEffect)(()=>{let e=null;return(async()=>{try{"wakeLock"in navigator&&(e=await navigator.wakeLock.request("screen"))}catch(e){console.log("Wake Lock error:",e)}})(),()=>{e&&e.release().catch(e=>console.log("Wake Lock release error:",e))}},[]),null);e.s(["StageContainer",0,()=>{let e=(0,c.useQueryClient)(),{user:n}=(0,m.useUser)(),l=(0,a.useSelectedLayoutSegments)(),b=(0,x.useStageStore)(e=>e.canShowCurrentlyListening),j=(0,x.useStageStore)(e=>e.token),w=(0,x.useStageStore)(e=>e.isGuestViewer),S=(0,x.useStageStore)(e=>e.actions),{data:N,isLoading:C}=(0,o.useQuery)({...u.stageQueries.currentlyListening(),enabled:!!n&&b&&!j}),k=(0,p.useLogSpeakingDuration)();return((0,s.useEffect)(()=>{0===l.length&&S.reset()},[l]),j)?(0,t.jsxs)(r.LiveKitRoom,{audio:!1,token:j,serverUrl:d.env.NEXT_PUBLIC_LIVEKIT_URL,onDisconnected:()=>
11{w||k(),S.reset(),w||e.invalidateQueries({queryKey:u.stageQueries.currentlyListeningKey()})},children:[(0,t.jsx)(g.DataChannelsProvider,{children:(0,t.jsx)(h.ResponsiveSwitcher,{})}),(0,t.jsx)(i.RoomAudioRenderer,{}),w?null:(0,t.jsx)(y,{}),(0,t.jsx)(v,{})]}):N?.stageUser&&!C&&l.length>0&&b?(0,t.jsx)(f.StageContinueListeningModal,{stageUser:N.stageUser}):null}])},119475,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(184670),r=e.i(664011);let i=()=>{let e=(0,a.useStageRecordingPlayerStore)(e=>e.url),i=(0,a.useStageRecordingPlayerStore)(e=>e.audioRef),n=(0,a.useStageRecordingPlayerStore)(e=>e.actions);return(0,s.useEffect)(()=>{let t=new Audio(e);i.current=t;let s=()=>{n.setDuration(t.duration),n.setCurrentTime(t.currentTime),n.setIsLoaded(!0),n.setIsPlaying(!0),t.play()},a=()=>{let e=t.currentTime/t.duration*100;n.setProgress(e),n.setCurrentTime(t.currentTime)};return t.addEventListener("loadedmetadata",s),t.addEventListener("timeupdate",a),t.addEventListener("ended",()=>n.setIsPlaying(!1)),t.addEventListener("play",()=>n.setIsPlaying(!0)),t.addEventListener("pause",()=>n.setIsPlaying(!1)),()=>{t.removeEventListener("loadedmetadata",s),t.removeEventListener("timeupdate",a),t.removeEventListener("ended",()=>n.setIsPlaying(!1)),t.pause(),t.currentTime=0}},[e]),(0,t.jsx)(r.PlayerResponsiveSwitcher,{})};e.s(["StagePlayerContainer",0,()=>(0,a.useStageRecordingPlayerStore)(e=>e.url)?(0,t.jsx)(i,{}):null])},922663,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(618566),r=e.i(19912);e.i(753366);var i=e.i(609683);e.i(28856);var n=e.i(807214),l=e.i(805321);e.i(156669);var o=e.i(114237),c=e.i(868499),d=e.i(332337);e.s(["FirstMessageTutorialDialog",0,()=>{let{user:e,updateUser:u}=(0,n.useUser)(),m=(0,a.useRouter)(),x=(0,a.usePathname)(),p=(0,l.useTutorialStore)(e=>e.isFirstMessageTutorialOpen),h=(0,l.useTutorialStore)(e=>e.actions),[f,g]=(0,s.useState)(!1),{data:y,isLoading:v}=(0,i.useGroupByUserIdQuery)({userId:e?.id});(0,s.useEffect)(()=>{!e?.tutorial||e?.tutorial?.messageTutorialShown||!v&&(!y?.group?.lastUserId||y?.group?.lastUserId===e?.id)?h.setIsFirstMessageTutorialOpen(!1):!e?.tutorial||e?.tutorial?.messageTutorialShown||v||y?.group?.lastUserId===e?.id||h.setIsFirstMessageTutorialOpen(!0)},[y,v]),(0,s.useEffect)(()=>{e?.tutorial?.messageTutorialShown&&h.setIsFirstMessageTutorialOpen(!1)},[e,h]);let b=async()=>{g(!0);try{if(!y?.group)return;(0,r.setTutorialShown)("message"),j(),m.push(`/messages/${y.group.id}`),h.setIsFirstMessageTutorialOpen(!1)}catch(e){console.error(e)}finally{g(!1)}},j=()=>{e&&u({...e,tutorial:{...e.tutorial,messageTutorialShown:!0}})};return(0,t.jsx)(c.AlertDialog,{open:"/messages"===x&&p&&!v&&!e?.tutorial?.messageTutorialShown,onOpenChange:h.setIsFirstMessageTutorialOpen,children:(0,t.jsxs)(c.AlertDialogContent,{overlayNoBG:!0,className:"border-text-primary/20 text-text-primary shadow-modal top-auto bottom-20 w-11/12 max-w-md translate-y-0 rounded-[10px] border p-6 md:bottom-[35vh]",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,t.jsx)(o.ChatAlt2OutlineIcon,{className:"text-text-primary size-7"}),(0,t.jsx)("h2",{className:"text-text-primary mt-2 text-base font-semibold",children:"You got your first message!"}),(0,t.jsx)("p",{className:"text-text-subtle mt-4 text-sm",children:"One of your ticket holders sent a message in your chatroom. Drop by and say hi!"})]}),(0,t.jsxs)(c.AlertDialogFooter,{className:"mt-2 flex-row items-baseline gap-2 pb-2",children:[(0,t.jsx)(d.Button,{onClick:()=>{h.setIsFirstMessageTutorialOpen(!1),(0,r.setTutorialShown)("message"),j()},variant:"outline",className:"text-text-primary h-9 w-1/3",children:"Close"}),(0,t.jsx)(d.Button,{onClick:b,className:"bg-brand-gradient h-9 w-2/3",loading:f,children:"Go to my chatroom"})]})]})})}])},118482,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(618566),r=e.i(912598),i=e.i(19912);e.i(753366);var n=e.i(456682);e.i(28856);var l=e.i(807214),o=e.i(805321);e.i(156669);var c=e.i(289512),d=e.i(562164),u=e.i(868499),m=e.i(332337);e.s(["FollowSuggestionsDialog",0,()=>{let e=(0,a.usePathname)(),{user:x,updateUser:p}=(0,l.useUser)(),h=(0,r.useQueryClient)(),f=(0,o.useTutorialStore)(e=>e.isFollowTutorialOpen),g="/home"===e&&f,y=(0,o.useTutorialStore)(e=>e.actions);(0,s.useEffect)(()=>{x?.tutorial?.followTutorialShown&&y.setIsFollowTutorialOpen(!1)},[x,y]);let{mutateAsync:v,isPending:b}=(0,n.useFollowTopUserMutation)({onSuccess:()=>{h.invalidateQueries({queryKey:["home","threads","my-feed"]})}}),j=async()=>{await v(),y.setIsFollowTutorialOpen(!1),(0,i.setTutorialShown)("follow"),w(),h.invalidateQueries({queryKey:["home","threads","my-feed"]}),d.toast.green("Followed top users successfully!")},w=()=>{x&&p({...x,tutorial:{...x.tutorial,followTutorialShown:!0}})};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.AlertDialog,{open:g&&!x?.tutorial?.followTutorialShown,onOpenChange:y.setIsFollowTutorialOpen,children:(0,t.jsxs)(u.AlertDialogContent,{overlayNoBG:!0,className:"border-text-primary/20 text-text-primary shadow-modal top-auto bottom-[calc(70px+env(safe-area-inset-bottom))] w-11/12 max-w-md translate-y-0 rounded-[10px] border p-6 md:bottom-25 md:bottom-[30vh]",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,t.jsx)(c.UserAddOutlineIcon,{className:"text-text-primary h-6 w-6"}),(0,t.jsx)("h2",{className:"text-text-primary mt-2 text-base font-semibold",children:"Follow some popular accounts!"}),(0,t.jsx)("p",{className:"text-text-subtle mt-4 text-sm",children:"By following some of the top 100 accounts, you'll get the pulse of our community."})]}),(0,t.jsxs)(u.AlertDialogFooter,{className:"mt-2 flex-row items-baseline gap-2 pb-2",children:[(0,t.jsx)(m.Button,{onClick:()=>{y.setIsFollowTutorialOpen(!1),(0,i.setTutorialShown)("follow"),w()},variant:"outline",className:"text-text-primary h-9 w-1/3",children:"Close"}),(0,t.jsx)(m.Button,{onClick:()=>{j()},className:"bg-brand-gradient h-9 w-2/3",loading:b,children:"Follow all"})]})]})}),g&&(0,t.jsx)("div",{className:"bg-background/65 absolute inset-0 z-20"})]})}])},952316,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(657688),r=e.i(618566),i=e.i(19912),n=e.i(242405);e.i(28856);var l=e.i(807214),o=e.i(805321);e.i(732832);var c=e.i(551360);e.i(156669);var d=e.i(568876),u=e.i(130988),m=e.i(868499),x=e.i(332337);let p=()=>(0,t.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,t.jsx)(d.TicketOutlineIcon,{className:"text-text-primary h-6 w-6"}),(0,t.jsx)("h2",{className:"text-text-primary mt-2 text-base font-semibold",children:"See that over there? That's a ticket."}),(0,t.jsx)("p",{className:"text-text-subtle mt-4 text-sm",children:"They give you exclusive access to:"}),(0,t.jsxs)("ul",{className:"text-text-subtle mt-2 flex list-inside list-disc flex-col items-start text-sm",children:[(0,t.jsx)("li",{children:"Private Chatroom with other holders."}),(0,t.jsx)("li",{children:"Private Stages that a user host."}),(0,t.jsx)("li",{children:"Any Stickers created by this user."}),(0,t.jsx)("li",{children:"And much more coming soon!"})]})]}),h=()=>(0,t.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,t.jsx)(a.default,{src:"/assets/coins/avax.png",alt:"AVAX icon",width:30,height:30,className:"size-6 rounded-full"}),(0,t.jsx)("h2",{className:"text-text-primary mt-2 text-base font-semibold",children:"Earn AVAX to use across the app!"}),(0,t.jsx)("p",{className:"text-text-subtle mt-4 text-sm",children:"Each time other users buy or sell your ticket, trading fees are sent to your way."}),(0,t.jsx)("p",{className:"text-text-subtle mt-2 text-sm",children:"You can use them to buy tickets, tip users, or withdraw them to another wallet!"})]}),f=()=>(0,t.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,t.jsx)(u.UserGroupOutlineIcon,{className:"text-text-primary size-6"}),(0,t.jsx)("h2",{className:"text-text-primary mt-2 text-base font-semibold",children:"Start building your network"}),(0,t.jsx)("p",{className:"text-text-subtle mt-4 text-sm",children:"We take pride in being one of the nicest communities of all social media platforms!"}),(0,t.jsx)("p",{className:"text-text-subtle mt-2 text-sm",children:"Tell us a bit about yourself and see how quickly you'll start connecting with others."})]});e.s(["TutorialDialog",0,()=>{let e=(0,r.usePathname)(),a=(0,r.useRouter)(),d=(0,n.useMediaQuery)(n.BREAKPOINTS.sm),{user:u,updateUser:g}=(0,l.useUser)(),y=(0,o.useTutorialStore)(e=>e.isTutorialOpen),v=(0,o.useTutorialStore)(e=>e.actions),b=e==="/"+u?.handle,j="/wallet"===e,w="/compose/post"===e,S=y&&(b||j||w),N=b?1:j?2:3;(0,s.useEffect)(()=>{u?.tutorial?.profileTutorialShown&&v.setIsTutorialOpen(!1)},[u,v]);let C=()=>{u&&g({...u,tutorial:{...u.tutorial,profileTutorialShown:!0}})};return(0,t.jsx)(m.AlertDialog,{open:S,onOpenChange:v.setIsTutorialOpen,children:(0,t.jsxs)(m.AlertDialogContent,{overlayNoBG:!0,className:(0,
11c.cn)("border-text-primary/20 text-text-primary shadow-modal w-11/12 max-w-md translate-y-0 rounded-[10px] border p-6",d?"items-center justify-center":"top-auto bottom-[calc(70px+env(safe-area-inset-bottom))]"),children:[b&&(0,t.jsx)(p,{}),j&&(0,t.jsx)(h,{}),w&&(0,t.jsx)(f,{}),(0,t.jsxs)(m.AlertDialogFooter,{className:"mt-2 flex-row items-baseline gap-2 pb-2",children:[N<3&&(0,t.jsx)(x.Button,{onClick:()=>{v.setIsTutorialOpen(!1),(0,i.setTutorialShown)("profile"),C()},variant:"outline",className:"text-text-primary h-9 w-1/3",children:"Skip"}),(0,t.jsx)(x.Button,{onClick:()=>{1===N&&a.push("/wallet"),2===N&&a.push("/compose/post"),3===N&&(v.setIsTutorialOpen(!1),(0,i.setTutorialShown)("profile"),C())},className:`${3===N?"w-full":"w-2/3"} bg-brand-gradient h-9`,children:3===N?"Done":`Next ${N}/3`})]})]})})}])},575035,e=>{"use strict";var t=e.i(843476),s=e.i(922663),a=e.i(118482),r=e.i(952316);e.s(["Tutorials",0,()=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.TutorialDialog,{}),(0,t.jsx)(a.FollowSuggestionsDialog,{}),(0,t.jsx)(s.FirstMessageTutorialDialog,{})]})])},558340,e=>{"use strict";var t=e.i(843476),s=e.i(271645);e.i(732832);var a=e.i(551360),r=e.i(705237);let i=["bottom-[calc(76px+env(safe-area-inset-bottom))] sm:bottom-4","bottom-[calc(76px+env(safe-area-inset-bottom)+72px)] sm:bottom-20","bottom-[calc(76px+env(safe-area-inset-bottom)+144px)] sm:bottom-36","bottom-[calc(76px+env(safe-area-inset-bottom)+216px)] sm:bottom-52","bottom-[calc(76px+env(safe-area-inset-bottom)+288px)] sm:bottom-68"];function n({offsetClass:e,children:s}){return(0,t.jsx)("div",{className:(0,a.cn)("pointer-events-none fixed inset-x-3 z-9999 flex justify-end sm:inset-x-auto sm:right-4",e),children:s})}function l({def:e,offsetClass:a,onVisibilityChange:i}){let o=(0,r.useFlowActor)(e.id),c=(0,r.useFlowSelector)(e.id,e=>e),d=e.useCardEnv?.(),u=e.renderCard({snapshot:c,actorRef:o,env:d}),m=null!==u;return((0,s.useEffect)(()=>{i(e.id,m)},[e.id,m,i]),null!==u&&a)?(0,t.jsx)(n,{offsetClass:a,children:u}):null}e.s(["FlowWidgets",0,function(){let e=(0,r.useFlowDefinitions)(),[a,n]=(0,s.useState)({}),o=(0,s.useCallback)((e,t)=>{n(s=>s[e]===t?s:{...s,[e]:t})},[]),c=0,d=new Map;for(let t of e)a[t.id]&&(d.set(t.id,i[c]),c+=1);return(0,t.jsx)(t.Fragment,{children:e.map(e=>(0,t.jsx)(l,{def:e,offsetClass:d.get(e.id),onVisibilityChange:o},e.id))})}])},330029,e=>{"use strict";var t=e.i(348396),s=e.i(54165),a=e.i(761610),r=e.i(327866);let i=[t.createHlDepositFlow,a.createHlWithdrawFlow,s.createVdexDepositFlow,r.createStakingFlow];e.s(["FLOW_REGISTRY",0,i])},562621,e=>{"use strict";e.s(["mergeNetworks",0,(e,t)=>{let s=[...e];return t.forEach(e=>{s.some(t=>t.chainId===e.chainId)||s.push(e)}),s}])},129485,e=>{"use strict";var t=e.i(271645);e.i(650601);var s=e.i(562621),a=e.i(248966),r=e.i(98148),i=e.i(232973),n=e.i(304591);e.s(["useDynamicNetworkOverrides",0,function(e=!0){let{data:l,isLoading:o}=(0,r.useNetworksByType)(i.NetworkType.EVM,{enabled:e}),[c,d]=(0,t.useState)(0);return(0,t.useEffect)(()=>n.rpcHealthChecker.subscribe(()=>{d(e=>e+1)}),[]),(0,t.useEffect)(()=>{l?.networks&&(0,a.setNetworksByChainId)(l.networks)},[l]),{evmNetworkOverride:(0,t.useMemo)(()=>e=>{if(!l?.networks)return e;let t=l.networks.map(e=>{let t=n.rpcHealthChecker.getHealthyRpcUrls(e),s=e.fallbackRpcUrl.split(";").map(e=>e.trim()).filter(Boolean),a=[e.rpcUrl,...s],r=t.length>0?t:a;return{blockExplorerUrls:[e.blockExplorerUrl],chainId:e.chainId,iconUrls:[e.icon],name:e.displayName,nativeCurrency:{decimals:18,name:e.name,symbol:e.name},networkId:e.chainId,rpcUrls:r,vanityName:e.displayName}});return(0,s.mergeNetworks)(t,e)},[l?.networks,c]),isLoading:o}}])},280051,e=>{"use strict";var t=e.i(271645),s=e.i(98148),a=e.i(232973),r=e.i(304591);e.s(["RpcHealthMonitor",0,function(){let{data:e}=(0,s.useNetworksByType)(a.NetworkType.EVM,{enabled:!0});return(0,t.useEffect)(()=>{if(!e?.networks)return;let t=e.networks.filter(e=>"avalanche"!==e.shortName&&"solana"!==e.shortName),s=r.rpcHealthChecker.getCacheInfo();return r.ENABLE_LOGS&&console.log("[RPC Health] Cache status:",{hasCache:s.hasCache,ageMinutes:s.ageMinutes,networks:s.networks,totalStatuses:s.totalStatuses,isLocalStorageAvailable:s.isLocalStorageAvailable}),r.ENABLE_LOGS&&console.log(`[RPC Health] Starting monitoring for ${t.length}
11 networks`),t.forEach(e=>{r.rpcHealthChecker.startMonitoring(e)}),()=>{r.rpcHealthChecker.stopMonitoring()}},[e?.networks?.length]),null}])},492100,e=>{"use strict";var t=e.i(271645),s=e.i(878128),a=e.i(77513);e.s(["GlobalWalletRuntimeManager",0,()=>{let e=(0,a.useConnectedEvmWallet)();return(0,t.useEffect)(()=>{if(!e)return;let t=!1,a=(0,s.registerArenaWalletSynchronizer)(e),r=async()=>{try{await (0,s.initializeArenaGlobalWallet)(e)}catch(e){t||console.error("[GlobalWalletRuntime] Failed to synchronize wallet",{error:e})}},i=()=>{document.hidden||r()},n=()=>void r();return r(),document.addEventListener("visibilitychange",i),window.addEventListener("online",n),()=>{t=!0,a(),document.removeEventListener("visibilitychange",i),window.removeEventListener("online",n)}},[e]),null}])},544636,e=>{"use strict";var t=e.i(843476),s=e.i(271645),a=e.i(770703),r=e.i(618566);e.i(238073);var i=e.i(256749);e.i(650601);var n=e.i(498336);e.i(397231);var l=e.i(632680),o=e.i(317751),c=e.i(912598),d=e.i(191476),u=e.i(363178),m=e.i(221381),x=e.i(604570),p=e.i(720565),h=e.i(556624),f=e.i(596924),g=e.i(846696),y=e.i(899528),v=e.i(474758),b=e.i(414673),j=e.i(48057),w=e.i(44947),S=e.i(772379),N=e.i(108289),C=e.i(816572),k=e.i(119475),T=e.i(562164),I=e.i(575035),E=e.i(791768),M=e.i(705237),A=e.i(558340),P=e.i(330029),O=e.i(129485),L=e.i(463816),D=e.i(838520),R=e.i(955707),F=e.i(402495),B=e.i(293700),_=e.i(103121),Q=e.i(520429),U=e.i(56162),W=e.i(184670),z=e.i(807214),H=e.i(878128),q=e.i(280051),K=e.i(492100);let G=(0,a.default)(()=>e.A(196783),{loadableGenerated:{modules:[869519]},ssr:!1});function V({children:e,onLogoutCb:a,user:r,twitterUser:o,token:c,enabledNetworks:d=!0}){let{evmNetworkOverride:u}=(0,O.useDynamicNetworkOverrides)(d),g=(0,s.useMemo)(()=>({environmentId:E.env.NEXT_PUBLIC_DYNAMIC_ENVIRONMENT_ID,walletConnectors:[i.EthereumWalletConnectors,l.SolanaWalletConnectors],walletConnectorExtensions:[H.ArenaGlobalWalletExtension],overrides:{evmNetworks:u},events:{onAuthInit:e=>(0,B.sendLoginEvent)({type:"AUTH_STARTED",method:e?.type??null}),onAuthSuccess:()=>(0,B.sendLoginEvent)({type:"AUTH_SUCCESS"}),onAuthFailure:()=>(0,B.sendLoginEvent)({type:"AUTH_CANCELLED"}),onAuthFlowCancel:()=>(0,B.sendLoginEvent)({type:"AUTH_CANCELLED"}),onLogout:a,onWalletConnectionFailed:(e,t)=>{console.error("Wallet connection failed",{error:t})}}}),[a,u]);return(0,t.jsx)(n.DynamicContextProvider,{settings:g,children:(0,t.jsx)(F.LoginMachineProvider,{hasBackendToken:!!c,children:(0,t.jsx)(m.NuqsAdapter,{children:(0,t.jsx)(h.CookiesProvider,{children:(0,t.jsx)(z.UserProvider,{user:r,twitterUser:o,token:c,children:(0,t.jsx)(Q.SocketProvider,{children:(0,t.jsx)(p.PostHogProvider,{client:x.default,children:(0,t.jsx)($,{children:(0,t.jsx)(S.ProgressBar,{className:"top-pwa bg-brand fixed inset-x-0 top-0 z-999 h-0.5",children:(0,t.jsx)(U.StageStoreProvider,{children:(0,t.jsx)(_.PerpsStoreProvider,{children:(0,t.jsx)(M.FlowHostProvider,{flows:P.FLOW_REGISTRY,children:(0,t.jsx)(W.StageRecordingPlayerStoreProvider,{children:(0,t.jsx)(R.LivestreamStoreProvider,{children:(0,t.jsxs)(f.SkeletonTheme,{baseColor:"var(--color-skeleton-base)",highlightColor:"var(--color-skeleton-highlight)",children:[e,(0,t.jsx)(N.SnowOverlay,{}),c&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(G,{})}),(0,t.jsx)(C.StageContainer,{}),(0,t.jsx)(K.GlobalWalletRuntimeManager,{}),(0,t.jsx)(q.RpcHealthMonitor,{}),(0,t.jsx)(k.StagePlayerContainer,{}),(0,t.jsx)(b.GlobalModals,{}),(0,t.jsx)(v.AppPrompts,{}),(0,t.jsx)(I.Tutorials,{}),(0,t.jsx)(j.MiniLivestreamContainer,{}),(0,t.jsx)(w.LivestreamPortalProvider,{}),(0,t.jsx)(A.FlowWidgets,{})]})})})})})})})})})})})})})})})}x.default.init(E.env.NEXT_PUBLIC_POSTHOG_KEY,{api_host:E.env.NEXT_PUBLIC_POSTHOG_HOST,person_profiles:"identified_only",capture_pageview:!1,capture_pageleave:!1,autocapture:!1});let $=({children:e})=>{let{user:a}=(0,z.useUser)();return(0,s.useEffect)(()=>{a?(x.default.identify(a.handle),x.default.register({userId:a.id,address:a.address})):x.default.reset()},[a]),(0,t.jsx)(t.Fragment,{children:e})};e.s(["Providers",0,function({children:e,token:a,user:i,twitterUser:n,flags:l}){let m=(0,r.useRouter)(),p=(0,s.useRef)(m);(0,s.useEffect)(()=>{p.current=m},[m]);
11let[h]=(0,s.useState)(()=>new o.QueryClient({defaultOptions:{queries:{refetchOnMount:!0,refetchOnWindowFocus:!1,staleTime:3e4},mutations:{onError:e=>{e instanceof d.AxiosError&&(console.error(e.response?.data),T.toast.danger(e.response?.data.message||"An unexpected error occurred. Please try again later."))}}}}));(0,s.useLayoutEffect)(()=>{a?L.axios.defaults.headers.common.Authorization=`Bearer ${a}`:delete L.axios.defaults.headers.common.Authorization},[a]),(0,s.useEffect)(()=>{let e=e=>{e.data&&"PUSH_NOTIFICATION_REDIRECT"===e.data.type&&m.push(e.data.url)};return navigator.serviceWorker&&navigator.serviceWorker.addEventListener("message",e),()=>{navigator.serviceWorker&&navigator.serviceWorker.removeEventListener("message",e)}},[m]),(0,s.useEffect)(()=>{x.default.onFeatureFlags(()=>{D.useFeatureFlagsStore.getState().setFlags({stages:!0,canCreateStages:!0,dustToArena:!0})})},[]);let f=(0,s.useCallback)(async()=>{await (0,y.logout)(),h.clear(),delete L.axios.defaults.headers.common.Authorization,localStorage.removeItem("perps-store"),localStorage.removeItem("aster_user_login_state"),p.current.replace("/login"),p.current.refresh()},[h]),v=!!a;return(0,t.jsx)(u.ThemeProvider,{attribute:"class",defaultTheme:"dark",enableSystem:!0,disableTransitionOnChange:!0,children:(0,t.jsxs)(c.QueryClientProvider,{client:h,children:[(0,t.jsx)(V,{onLogoutCb:f,user:i,twitterUser:n,token:a,enabledNetworks:v,children:e}),(0,t.jsx)(g.Toaster,{position:"top-center",richColors:!0,className:"pointer-events-auto flex flex-col items-center"})]})})}])}]);

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.