vendor: 4,196 bytes, lines 1-2
1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/provider-B7WZfCL6.js","assets/provider-Cjz-7KG-.js","assets/provider-B_aWLiKZ.js","assets/provider-DtjsIvQz.js"])))=>i.map(i=>d[i]); 2(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const l of r)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function t(r){const l={};return r.integrity&&(l.integrity=r.integrity),r.referrerPolicy&&(l.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?l.credentials="include":r.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(r){if(r.ep)return;r.ep=!0;const l=t(r);fetch(r.href,l)}})();function yM(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Fg={exports:{}},Zu={};var e3;function _M(){if(e3)return Zu;e3=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(i,r,l){var u=null;if(l!==void 0&&(u=""+l),r.key!==void 0&&(u=""+r.key),"key"in r){l={};for(var h in r)h!=="key"&&(l[h]=r[h])}else l=r;return r=l.ref,{$$typeof:n,type:i,key:u,ref:r!==void 0?r:null,props:l}}return Zu.Fragment=e,Zu.jsx=t,Zu.jsxs=t,Zu}var t3;function wM(){return t3||(t3=1,Fg.exports=_M()),Fg.exports}var o=wM(),Bg={exports:{}},Ft={};var n3;function SM(){if(n3)return Ft;n3=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function y(D){return D===null||typeof D!="object"?null:(D=b&&D[b]||D["@@iterator"],typeof D=="function"?D:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,w={};function S(D,H,Z){this.props=D,this.context=H,this.refs=w,this.updater=Z||_}S.prototype.isReactComponent={},S.prototype.setState=function(D,H){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,H,"setState")},S.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function T(){}T.prototype=S.prototype;function N(D,H,Z){this.props=D,this.context=H,this.refs=w,this.updater=Z||_}var j=N.prototype=new T;j.constructor=N,C(j,S.prototype),j.isPureReactComponent=!0;var O=Array.isArray;function R(){}var z={H:null,A:null,T:null,S:null},M=Object.prototype.hasOwnProperty;function P(D,H,Z){var Ee=Z.ref;return{$$typeof:n,type:D,key:H,ref:Ee!==void 0?Ee:null,props:Z}}function G(D,H){return P(D.type,H,D.props)}function U(D){return typeof D=="object"&&D!==null&&D.$$typeof===n}function Y(D){var H={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(Z){return H[Z]})}var W=/\/+/g;function J(D,H){return typeof D=="object"&&D!==null&&D.key!=null?Y(""+D.key):H.toString(36)}function F(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(R,R):(D.status="pending",D.then(function(H){D.status==="pending"&&(D.status="fulfilled",D.value=H)},function(H){D.status==="pending"&&(D.status="rejected",D.reason=H)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function $(D,H,Z,Ee,je){var le=typeof D;(le==="undefined"||le==="boolean")&&(D=null);var Se=!1;if(D===null)Se=!0;else switch(le){case"bigint":case"string":case"number":Se=!0;break;case"object":switch(D.$$typeof){case n:case e:Se=!0;break;case m:return Se=D._init,$(Se(D._payload),H,Z,Ee,je)}}if(Se)return je=je(D),Se=Ee===""?"."+J(D,0):Ee,O(je)?(Z="",Se!=null&&(Z=Se.replace(W,"$&/")+"/"),$(je,H,Z,"",function(Le){return Le}
vendor: 15,902 bytes, line 2
2)):je!=null&&(U(je)&&(je=G(je,Z+(je.key==null||D&&D.key===je.key?"":(""+je.key).replace(W,"$&/")+"/")+Se)),H.push(je)),1;Se=0;var de=Ee===""?".":Ee+":";if(O(D))for(var Me=0;Me<D.length;Me++)Ee=D[Me],le=de+J(Ee,Me),Se+=$(Ee,H,Z,le,je);else if(Me=y(D),typeof Me=="function")for(D=Me.call(D),Me=0;!(Ee=D.next()).done;)Ee=Ee.value,le=de+J(Ee,Me++),Se+=$(Ee,H,Z,le,je);else if(le==="object"){if(typeof D.then=="function")return $(F(D),H,Z,Ee,je);throw H=String(D),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return Se}function V(D,H,Z){if(D==null)return D;var Ee=[],je=0;return $(D,Ee,"","",function(le){return H.call(Z,le,je++)}),Ee}function se(D){if(D._status===-1){var H=D._result;H=H(),H.then(function(Z){(D._status===0||D._status===-1)&&(D._status=1,D._result=Z)},function(Z){(D._status===0||D._status===-1)&&(D._status=2,D._result=Z)}),D._status===-1&&(D._status=0,D._result=H)}if(D._status===1)return D._result.default;throw D._result}var ue=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},Ce={map:V,forEach:function(D,H,Z){V(D,function(){H.apply(this,arguments)},Z)},count:function(D){var H=0;return V(D,function(){H++}),H},toArray:function(D){return V(D,function(H){return H})||[]},only:function(D){if(!U(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ft.Activity=g,Ft.Children=Ce,Ft.Component=S,Ft.Fragment=t,Ft.Profiler=r,Ft.PureComponent=N,Ft.StrictMode=i,Ft.Suspense=d,Ft.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Ft.__COMPILER_RUNTIME={__proto__:null,c:function(D){return z.H.useMemoCache(D)}},Ft.cache=function(D){return function(){return D.apply(null,arguments)}},Ft.cacheSignal=function(){return null},Ft.cloneElement=function(D,H,Z){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var Ee=C({},D.props),je=D.key;if(H!=null)for(le in H.key!==void 0&&(je=""+H.key),H)!M.call(H,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&H.ref===void 0||(Ee[le]=H[le]);var le=arguments.length-2;if(le===1)Ee.children=Z;else if(1<le){for(var Se=Array(le),de=0;de<le;de++)Se[de]=arguments[de+2];Ee.children=Se}return P(D.type,je,Ee)},Ft.createContext=function(D){return D={$$typeof:u,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:l,_context:D},D},Ft.createElement=function(D,H,Z){var Ee,je={},le=null;if(H!=null)for(Ee in H.key!==void 0&&(le=""+H.key),H)M.call(H,Ee)&&Ee!=="key"&&Ee!=="__self"&&Ee!=="__source"&&(je[Ee]=H[Ee]);var Se=arguments.length-2;if(Se===1)je.children=Z;else if(1<Se){for(var de=Array(Se),Me=0;Me<Se;Me++)de[Me]=arguments[Me+2];je.children=de}if(D&&D.defaultProps)for(Ee in Se=D.defaultProps,Se)je[Ee]===void 0&&(je[Ee]=Se[Ee]);return P(D,le,je)},Ft.createRef=function(){return{current:null}},Ft.forwardRef=function(D){return{$$typeof:h,render:D}},Ft.isValidElement=U,Ft.lazy=function(D){return{$$typeof:m,_payload:{_status:-1,_result:D},_init:se}},Ft.memo=function(D,H){return{$$typeof:p,type:D,compare:H===void 0?null:H}},Ft.startTransition=function(D){var H=z.T,Z={};z.T=Z;try{var Ee=D(),je=z.S;je!==null&&je(Z,Ee),typeof Ee=="object"&&Ee!==null&&typeof Ee.then=="function"&&Ee.then(R,ue)}catch(le){ue(le)}finally{H!==null&&Z.types!==null&&(H.types=Z.types),z.T=H}},Ft.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Ft.use=function(D){return z.H.use(D)},Ft.useActionState=function(D,H,Z){return z.H.useActionState(D,H,Z)},Ft.useCallback=function(D,H){return z.H.useCallback(D,H)},Ft.useContext=function(D){return z.H.useContext(D)},Ft.useDebugValue=function(){},Ft.useDeferredValue=function(D,H){return z.H.useDeferredValue(D,H)},Ft.useEffect=function(D,H){return z.H.useEffect(D,H)},Ft.useEffectEvent=function(D){return z.H.useEffectEvent(D)},Ft.useId=function(){return z.H.useId()},Ft.useImperativeHandle=function(D,H,Z){return z.H.useImperativeHandle(D,H,Z)},Ft.useInsertionEffect=function(D,H){return z.H.useInsertionEffect(D,H)},Ft.useLayoutEffect=function(D,H){return z.H.useLayoutEffect(D,H)},Ft.useMemo=function(D,H){return z.H.useMemo(D,H)},Ft.useOptimistic=function(D,H){return z.H.useOptimistic(D,H)},Ft.useReducer=function(D,H,Z){return z.H.useReducer(D,H,Z)},Ft.useRef=function(D){return z.H.useRef(D)},Ft.useState=function(D){return z.H.useState(D)},Ft.useSyncExternalStore=function(D,H,Z){return z.H.useSyncExternalStore(D,H,Z)},Ft.useTransition=function(){return z.H.useTransition()},Ft.version="19.2.4",Ft}var i3;function Jb(){return i3||(i3=1,Bg.exports=SM()),Bg.exports}var E=Jb();const li=yM(E);var Hg={exports:{}},Qu={},Vg={exports:{}},Gg={};var s3;function EM(){return s3||(s3=1,(function(n){function e($,V){var se=$.length;$.push(V);e:for(;0<se;){var ue=se-1>>>1,Ce=$[ue];if(0<r(Ce,V))$[ue]=V,$[se]=Ce,se=ue;else break e}}function t($){return $.length===0?null:$[0]}function i($){if($.length===0)return null;var V=$[0],se=$.pop();if(se!==V){$[0]=se;e:for(var ue=0,Ce=$.length,D=Ce>>>1;ue<D;){var H=2*(ue+1)-1,Z=$[H],Ee=H+1,je=$[Ee];if(0>r(Z,se))Ee<Ce&&0>r(je,Z)?($[ue]=je,$[Ee]=se,ue=Ee):($[ue]=Z,$[H]=se,ue=H);else if(Ee<Ce&&0>r(je,se))$[ue]=je,$[Ee]=se,ue=Ee;else break e}}return V}function r($,V){var se=$.sortIndex-V.sortIndex;return se!==0?se:$.id-V.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;n.unstable_now=function(){return l.now()}}else{var u=Date,h=u.now();n.unstable_now=function(){return u.now()-h}}var d=[],p=[],m=1,g=null,b=3,y=!1,_=!1,C=!1,w=!1,S=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function j($){for(var V=t(p);V!==null;){if(V.callback===null)i(p);else if(V.startTime<=$)i(p),V.sortIndex=V.expirationTime,e(d,V);else break;V=t(p)}}function O($){if(C=!1,j($),!_)if(t(d)!==null)_=!0,R||(R=!0,Y());else{var V=t(p);V!==null&&F(O,V.startTime-$)}}var R=!1,z=-1,M=5,P=-1;function G(){return w?!0:!(n.unstable_now()-P<M)}function U(){if(w=!1,R){var $=n.unstable_now();P=$;var V=!0;try{e:{_=!1,C&&(C=!1,T(z),z=-1),y=!0;var se=b;try{t:{for(j($),g=t(d);g!==null&&!(g.expirationTime>$&&G());){var ue=g.callback;if(typeof ue=="function"){g.callback=null,b=g.priorityLevel;var Ce=ue(g.expirationTime<=$);if($=n.unstable_now(),typeof Ce=="function"){g.callback=Ce,j($),V=!0;break t}g===t(d)&&i(d),j($)}else i(d);g=t(d)}if(g!==null)V=!0;else{var D=t(p);D!==null&&F(O,D.startTime-$),V=!1}}break e}finally{g=null,b=se,y=!1}V=void 0}}finally{V?Y():R=!1}}}var Y;if(typeof N=="function")Y=function(){N(U)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,J=W.port2;W.port1.onmessage=U,Y=function(){J.postMessage(null)}}else Y=function(){S(U,0)};function F($,V){z=S(function(){$(n.unstable_now())},V)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function($){$.callback=null},n.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<$?Math.floor(1e3/$):5},n.unstable_getCurrentPriorityLevel=function(){return b},n.unstable_next=function($){switch(b){case 1:case 2:case 3:var V=3;break;default:V=b}var se=b;b=V;try{return $()}finally{b=se}},n.unstable_requestPaint=function(){w=!0},n.unstable_runWithPriority=function($,V){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var se=b;b=$;try{return V()}finally{b=se}},n.unstable_scheduleCallback=function($,V,se){var ue=n.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?ue+se:ue):se=ue,$){case 1:var Ce=-1;break;case 2:Ce=250;break;case 5:Ce=1073741823;break;case 4:Ce=1e4;break;default:Ce=5e3}return Ce=se+Ce,$={id:m++,callback:V,priorityLevel:$,startTime:se,expirationTime:Ce,sortIndex:-1},se>ue?($.sortIndex=se,e(p,$),t(d)===null&&$===t(p)&&(C?(T(z),z=-1):C=!0,F(O,se-ue))):($.sortIndex=Ce,e(d,$),_||y||(_=!0,R||(R=!0,Y()))),$},n.unstable_shouldYield=G,n.unstable_wrapCallback=function($){var V=b;return function(){var se=b;b=V;try{return $.apply(this,arguments)}finally{b=se}}}})(Gg)),Gg}var r3;function CM(){return r3||(r3=1,Vg.exports=EM()),Vg.exports}var qg={exports:{}},Pi={};var a3;function NM(){if(a3)return Pi;a3=1;var n=Jb();function e(d){var p="https://react.dev/errors/"+d;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)p+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+d+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function t(){}var i={d:{f:t,r:function(){throw Error(e(522))},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},r=Symbol.for("react.portal");function l(d,p,m){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:g==null?null:""+g,children:d,containerInfo:p,implementation:m}}var u=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(d,p){if(d==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Pi.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Pi.createPortal=function(d,p){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(e(299));return l(d,p,null,m)},Pi.flushSync=function(d){var p=u.T,m=i.p;try{if(u.T=null,i.p=2,d)return d()}finally{u.T=p,i.p=m,i.d.f()}},Pi.preconnect=function(d,p){typeof d=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,i.d.C(d,p))},Pi.prefetchDNS=function(d){typeof d=="string"&&i.d.D(d)},Pi.preinit=function(d,p){if(typeof d=="string"&&p&&typeof p.as=="string"){var m=p.as,g=h(m,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,y=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;m==="style"?i.d.S(d,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:y}):m==="script"&&i.d.X(d,{crossOrigin:g,integrity:b,fetchPriority:y,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Pi.preinitModule=function(d,p){if(typeof d=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var m=h(p.as,p.crossOrigin);i.d.M(d,{crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&i.d.M(d)},Pi.preload=function(d,p){if(typeof d=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var m=p.as,g=h(m,p.crossOrigin);i.d.L(d,m,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Pi.preloadModule=function(d,p){if(typeof d=="string")if(p){var m=h(p.as,p.crossOrigin);i.d.m(d,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else i.d.m(d)},Pi.requestFormReset=function(d){i.d.r(d)},Pi.unstable_batchedUpdates=function(d,p){return d(p)},Pi.useFormState=function(d,p,m){return u.H.useFormState(d,p,m)},Pi.useFormStatus=function(){return u.H.useHostTransitionStatus()},Pi.version="19.2.4",Pi}var o3;function y6(){if(o3)return qg.exports;o3=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),qg.exports=NM(),qg.exports}var l3;function TM(){if(l3)return Qu;l3=1;var n=CM(),e=Jb(),t=y6();function i(s){var a="https://react.dev/errors/"+s;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)a+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function l(s){var a=s,c=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(c=a.return),s=a.return;while(s)}return a.tag===3?c:null}function u(s){if(s.tag===13){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function h(s){if(s.tag===31){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function d(s){if(l(s)!==s)throw Error(i(188))}function p(s){var a=s.alternate;if(!a){if(a=l(s),a===null)throw Error(i(188));return a!==s?null:s}for(var c=s,f=a;;){var x=c.return;if(x===null)break;var v=x.alternate;if(v===null){if(f=x.return,f!==null){c=f;continue}break}if(x.child===v.child){for(v=x.child;v;){if(v===c)return d(x),s;if(v===f)return d(x),a;v=v.sibling}throw Error(i(188))}if(c.return!==f.return)c=x,f=v;else{for(var A=!1,B=x.child;B;){if(B===c){A=!0,c=x,f=v;break}if(B===f){A=!0,f=x,c=v;break}B=B.sibling}if(!A){for(B=v.child;B;){if(B===c){A=!0,c=v,f=x;break}if(B===f){A=!0,f=v,c=x;break}B=B.sibling}if(!A)throw Error(i(189))}}if(c.alternate!==f)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?s:a}function m(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=m(s),a!==null)return a;s=s.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),N=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function Y(s){return s===null||typeof s!="object"?null:(s=U&&s[U]||s["@@iterator"],typeof s=="function"?s:null)}var W=Symbol.for("react.client.reference");function J(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===W?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case C:return"Fragment";case S:return"Profiler";case w:return"StrictMode";case O:return"Suspense";case R:return"SuspenseList";case P:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case _:return"Portal";case N:return s.displayName||"Context";case T:return(s._context.displayName||"Context")+".Consumer";case j:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case z:return a=s.displayName||null,a!==null?a:J(s.type)||"Memo";case M:a=s._payload,s=s._init;try{return J(s(a))}catch{}}return null}var F=Array.isArray,$=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pen
vendor: 4,248 bytes, lines 2-9
2ding:!1,data:null,method:null,action:null},ue=[],Ce=-1;function D(s){return{current:s}}function H(s){0>Ce||(s.current=ue[Ce],ue[Ce]=null,Ce--)}function Z(s,a){Ce++,ue[Ce]=s.current,s.current=a}var Ee=D(null),je=D(null),le=D(null),Se=D(null);function de(s,a){switch(Z(le,a),Z(je,s),Z(Ee,null),a.nodeType){case 9:case 11:s=(s=a.documentElement)&&(s=s.namespaceURI)?Sw(s):0;break;default:if(s=a.tagName,a=a.namespaceURI)a=Sw(a),s=Ew(a,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}H(Ee),Z(Ee,s)}function Me(){H(Ee),H(je),H(le)}function Le(s){s.memoizedState!==null&&Z(Se,s);var a=Ee.current,c=Ew(a,s.type);a!==c&&(Z(je,s),Z(Ee,c))}function pe(s){je.current===s&&(H(Ee),H(je)),Se.current===s&&(H(Se),Wu._currentValue=se)}var Be,We;function dt(s){if(Be===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);Be=a&&a[1]||"",We=-1<c.stack.indexOf(` 3 at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return` 4`+Be+s+We}var Ct=!1;function ut(s,a){if(!s||Ct)return"";Ct=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(a){var Ue=function(){throw Error()};if(Object.defineProperty(Ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ue,[])}catch(Te){var _e=Te}Reflect.construct(s,[],Ue)}else{try{Ue.call()}catch(Te){_e=Te}s.call(Ue.prototype)}}else{try{throw Error()}catch(Te){_e=Te}(Ue=s())&&typeof Ue.catch=="function"&&Ue.catch(function(){})}}catch(Te){if(Te&&_e&&typeof Te.stack=="string")return[Te.stack,_e.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=f.DetermineComponentFrameRoot(),A=v[0],B=v[1];if(A&&B){var ee=A.split(` 5`),ye=B.split(` 6`);for(x=f=0;f<ee.length&&!ee[f].includes("DetermineComponentFrameRoot");)f++;for(;x<ye.length&&!ye[x].includes("DetermineComponentFrameRoot");)x++;if(f===ee.length||x===ye.length)for(f=ee.length-1,x=ye.length-1;1<=f&&0<=x&&ee[f]!==ye[x];)x--;for(;1<=f&&0<=x;f--,x--)if(ee[f]!==ye[x]){if(f!==1||x!==1)do if(f--,x--,0>x||ee[f]!==ye[x]){var Re=` 7`+ee[f].replace(" at new "," at ");return s.displayName&&Re.includes("<anonymous>")&&(Re=Re.replace("<anonymous>",s.displayName)),Re}while(1<=f&&0<=x);break}}}finally{Ct=!1,Error.prepareStackTrace=c}return(c=s?s.displayName||s.name:"")?dt(c):""}function kt(s,a){switch(s.tag){case 26:case 27:case 5:return dt(s.type);case 16:return dt("Lazy");case 13:return s.child!==a&&a!==null?dt("Suspense Fallback"):dt("Suspense");case 19:return dt("SuspenseList");case 0:case 15:return ut(s.type,!1);case 11:return ut(s.type.render,!1);case 1:return ut(s.type,!0);case 31:return dt("Activity");default:return""}}function K(s){try{var a="",c=null;do a+=kt(s,c),c=s,s=s.return;while(s);return a}catch(f){return` 8Error generating stack: `+f.message+` 9`+f.stack}}var Nt=Object.prototype.hasOwnProperty,Tt=n.unstable_scheduleCallback,Mt=n.unstable_cancelCallback,nt=n.unstable_shouldYield,I=n.unstable_requestPaint,k=n.unstable_now,Q=n.unstable_getCurrentPriorityLevel,fe=n.unstable_ImmediatePriority,be=n.unstable_UserBlockingPriority,xe=n.unstable_NormalPriority,Xe=n.unstable_LowPriority,$e=n.unstable_IdlePriority,it=n.log,ht=n.unstable_setDisableYieldValue,X=null,oe=null;function ke(s){if(typeof it=="function"&&ht(s),oe&&typeof oe.setStrictMode=="function")try{oe.setStrictMode(X,s)}catch{}}var Ae=Math.clz32?Math.clz32:te,De=Math.log,st=Math.LN2;function te(s){return s>>>=0,s===0?32:31-(De(s)/st|0)|0}var Ie=256,Pe=262144,Ze=4194304;function ze(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;
vendor: 6,144 bytes, line 9
9case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function ge(s,a,c){var f=s.pendingLanes;if(f===0)return 0;var x=0,v=s.suspendedLanes,A=s.pingedLanes;s=s.warmLanes;var B=f&134217727;return B!==0?(f=B&~v,f!==0?x=ze(f):(A&=B,A!==0?x=ze(A):c||(c=B&~s,c!==0&&(x=ze(c))))):(B=f&~v,B!==0?x=ze(B):A!==0?x=ze(A):c||(c=f&~s,c!==0&&(x=ze(c)))),x===0?0:a!==0&&a!==x&&(a&v)===0&&(v=x&-x,c=a&-a,v>=c||v===32&&(c&4194048)!==0)?a:x}function Ye(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function pt(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Wt(){var s=Ze;return Ze<<=1,(Ze&62914560)===0&&(Ze=4194304),s}function ce(s){for(var a=[],c=0;31>c;c++)a.push(s);return a}function Ge(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function vt(s,a,c,f,x,v){var A=s.pendingLanes;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=c,s.entangledLanes&=c,s.errorRecoveryDisabledLanes&=c,s.shellSuspendCounter=0;var B=s.entanglements,ee=s.expirationTimes,ye=s.hiddenUpdates;for(c=A&~c;0<c;){var Re=31-Ae(c),Ue=1<<Re;B[Re]=0,ee[Re]=-1;var _e=ye[Re];if(_e!==null)for(ye[Re]=null,Re=0;Re<_e.length;Re++){var Te=_e[Re];Te!==null&&(Te.lane&=-536870913)}c&=~Ue}f!==0&&rn(s,f,0),v!==0&&x===0&&s.tag!==0&&(s.suspendedLanes|=v&~(A&~a))}function rn(s,a,c){s.pendingLanes|=a,s.suspendedLanes&=~a;var f=31-Ae(a);s.entangledLanes|=a,s.entanglements[f]=s.entanglements[f]|1073741824|c&261930}function On(s,a){var c=s.entangledLanes|=a;for(s=s.entanglements;c;){var f=31-Ae(c),x=1<<f;x&a|s[f]&a&&(s[f]|=a),c&=~x}}function Dn(s,a){var c=a&-a;return c=(c&42)!==0?1:Qn(c),(c&(s.suspendedLanes|a))!==0?0:c}function Qn(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function bi(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function qn(){var s=V.p;return s!==0?s:(s=window.event,s===void 0?32:Ww(s.type))}function cs(s,a){var c=V.p;try{return V.p=s,a()}finally{V.p=c}}var Jn=Math.random().toString(36).slice(2),xn="__reactFiber$"+Jn,Nn="__reactProps$"+Jn,Si="__reactContainer$"+Jn,Fi="__reactEvents$"+Jn,Li="__reactListeners$"+Jn,vi="__reactHandles$"+Jn,Ks="__reactResources$"+Jn,we="__reactMarker$"+Jn;function He(s){delete s[xn],delete s[Nn],delete s[Fi],delete s[Li],delete s[vi]}function rt(s){var a=s[xn];if(a)return a;for(var c=s.parentNode;c;){if(a=c[Si]||c[xn]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(s=kw(s);s!==null;){if(c=s[xn])return c;s=kw(s)}return a}s=c,c=s.parentNode}return null}function Ke(s){if(s=s[xn]||s[Si]){var a=s.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return s}return null}function lt(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s.stateNode;throw Error(i(33))}function L(s){var a=s[Ks];return a||(a=s[Ks]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function q(s){s[we]=!0}var ne=new Set,re={};function me(s,a){Je(s,a),Je(s+"Capture",a)}function Je(s,a){for(re[s]=a,s=0;s<a.length;s++)ne.add(a[s])}var qe=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Qe={},et={};function mt(s){return Nt.call(et,s)?!0:Nt.call(Qe,s)?!1:qe.test(s)?et[s]=!0:(Qe[s]=!0,!1)}function Ot(s,a,c){if(mt(a))if(c===null)s.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(a);return;case"boolean":var f=a.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){s.removeAttribute(a);return}}s.setAttribute(a,""+c)}}function $t(s,a,c){if(c===null)s.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(a);return}s.setAttribute(a,""+c)}}function ae(s,a,c,f){if(f===null)s.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(a,c,""+f)}}function Ve(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function ct(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Dt(s,a,c){var f=Object.getOwnPropertyDescriptor(s.constructor.prototype,a);if(!s.hasOwnProperty(a)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var x=f.get,v=f.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return x.call(this)},set:function(A){c=""+A,v.call(this,A)}}),Object.defineProperty(s,a,{enumerable:f.enumerable}),{getValue:function(){return c},setValue:function(A){c=""+A},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function At(s){if(!s._valueTracker){var a=ct(s)?"checked":"value";s._valueTracker=Dt(s,a,""+s[a])}}function mn(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var c=a.getValue(),f="";return s&&(f=ct(s)?s.checked?"true":"false":s.value),s=f,s!==c?(a.setValue(s),!0):!1}function ot(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var an=/[\n"\\]/g;function It(s){return s.replace(an,function(a){return"\\"+a.charCo
vendor: 4,417 bytes, line 9
9deAt(0).toString(16)+" "})}function Bi(s,a,c,f,x,v,A,B){s.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?s.type=A:s.removeAttribute("type"),a!=null?A==="number"?(a===0&&s.value===""||s.value!=a)&&(s.value=""+Ve(a)):s.value!==""+Ve(a)&&(s.value=""+Ve(a)):A!=="submit"&&A!=="reset"||s.removeAttribute("value"),a!=null?Zs(s,A,Ve(a)):c!=null?Zs(s,A,Ve(c)):f!=null&&s.removeAttribute("value"),x==null&&v!=null&&(s.defaultChecked=!!v),x!=null&&(s.checked=x&&typeof x!="function"&&typeof x!="symbol"),B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?s.name=""+Ve(B):s.removeAttribute("name")}function us(s,a,c,f,x,v,A,B){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.type=v),a!=null||c!=null){if(!(v!=="submit"&&v!=="reset"||a!=null)){At(s);return}c=c!=null?""+Ve(c):"",a=a!=null?""+Ve(a):c,B||a===s.value||(s.value=a),s.defaultValue=a}f=f??x,f=typeof f!="function"&&typeof f!="symbol"&&!!f,s.checked=B?s.checked:!!f,s.defaultChecked=!!f,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(s.name=A),At(s)}function Zs(s,a,c){a==="number"&&ot(s.ownerDocument)===s||s.defaultValue===""+c||(s.defaultValue=""+c)}function ds(s,a,c,f){if(s=s.options,a){a={};for(var x=0;x<c.length;x++)a["$"+c[x]]=!0;for(c=0;c<s.length;c++)x=a.hasOwnProperty("$"+s[c].value),s[c].selected!==x&&(s[c].selected=x),x&&f&&(s[c].defaultSelected=!0)}else{for(c=""+Ve(c),a=null,x=0;x<s.length;x++){if(s[x].value===c){s[x].selected=!0,f&&(s[x].defaultSelected=!0);return}a!==null||s[x].disabled||(a=s[x])}a!==null&&(a.selected=!0)}}function gn(s,a,c){if(a!=null&&(a=""+Ve(a),a!==s.value&&(s.value=a),c==null)){s.defaultValue!==a&&(s.defaultValue=a);return}s.defaultValue=c!=null?""+Ve(c):""}function ei(s,a,c,f){if(a==null){if(f!=null){if(c!=null)throw Error(i(92));if(F(f)){if(1<f.length)throw Error(i(93));f=f[0]}c=f}c==null&&(c=""),a=c}c=Ve(a),s.defaultValue=c,f=s.textContent,f===c&&f!==""&&f!==null&&(s.value=f),At(s)}function Hi(s,a){if(a){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=a;return}}s.textContent=a}var ti=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Qs(s,a,c){var f=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?f?s.setProperty(a,""):a==="float"?s.cssFloat="":s[a]="":f?s.setProperty(a,c):typeof c!="number"||c===0||ti.has(a)?a==="float"?s.cssFloat=c:s[a]=(""+c).trim():s[a]=c+"px"}function Yr(s,a,c){if(a!=null&&typeof a!="object")throw Error(i(62));if(s=s.style,c!=null){for(var f in c)!c.hasOwnProperty(f)||a!=null&&a.hasOwnProperty(f)||(f.indexOf("--")===0?s.setProperty(f,""):f==="float"?s.cssFloat="":s[f]="");for(var x in a)f=a[x],a.hasOwnProperty(x)&&c[x]!==f&&Qs(s,x,f)}else for(var v in a)a.hasOwnProperty(v)&&Qs(s,v,a[v])}function _l(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var gN=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRen
9dering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),xN=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function lh(s){return xN.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Kr(){}var Im=null;function zm(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var wl=null,Sl=null;function wy(s){var a=Ke(s);if(a&&(s=a.stateNode)){var c=s[Nn]||null;e:switch(s=a.stateNode,a.type){case"input":if(Bi(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+It(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var f=c[a];if(f!==s&&f.form===s.form){var x=f[Nn]||null;if(!x)throw Error(i(90));Bi(f,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(a=0;a<c.length;a++)f=c[a],f.form===s.form&&mn(f)}break e;case"textarea":gn(s,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&ds(s,!!c.multiple,a,!1)}}}var $m=!1;function Sy(s,a,c){if($m)return s(a,c);$m=!0;try{var f=s(a);return f}finally{if($m=!1,(wl!==null||Sl!==null)&&(Yh(),wl&&(a=wl,s=Sl,Sl=wl=null,wy(a),s)))for(a=0;a<s.length;a++)wy(s[a])}}function uu(s,a){var c=s.stateNode;if(c===null)return null;var f=c[Nn]||null;if(f===null)return null;c=f[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(s=s.type,f=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!f;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(i(231,a,typeof c));return c}var Zr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fm=!1;if(Zr)try{var du={};Object.defineProperty(du,"passive",{get:function(){Fm=!0}}),window.addEventListener("test",du,du),window.removeEventListener("test",du,du)}catch{Fm=!1}var Oa=null,Bm=null,ch=null;function Ey(){if(ch)return ch;var s,a=Bm,c=a.length,f,x="value"in Oa?Oa.value:Oa.textContent,v=x.length;for(s=0;s<c&&a[s]===x[s];s++);var A=c-s;for(f=1;f<=A&&a[c-f]===x[v-f];f++);return ch=x.slice(s,1<f?1-f:void 0)}function uh(s){var a=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&a===13&&(s=13)):s=a,s===10&&(s=13),32<=s||s===13?s:0}function dh(){return!0}function Cy(){return!1}function Zi(s){function a(c,f,x,v,A){this._reactName=c,this._targetInst=x,this.type=f,this.nativeEvent=v,this.target=A,this.currentTarget=null;for(var B in s)s.hasOwnProperty(B)&&(c=s[B],this[B]=c?c(v):v[B]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?dh:Cy,this.isPropagationStopped=Cy,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=dh)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=dh)},persist:function(){},isPersistent:dh}),a}var Mo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hh=Zi(Mo),hu=g({},Mo,{view:0,detail:0}),bN=Zi(hu),Hm,Vm,fu,fh=g({},hu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:qm,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==fu&&(fu&&s.type==="mousemove"?(Hm=s.screenX-fu.screenX,Vm=s.screenY-fu.screenY):Vm=Hm=0,fu=s),Hm)},movementY:function(s){return"movementY"in s?s.movementY:Vm}}),Ny=Zi(fh),vN=g({},fh,{dataTransfer:0}),yN=Zi(vN),_N=g({},hu,{relatedTarget:0}),Gm=Zi(_N),wN=g({},Mo,{animationName:0,elapsedTime:0,pseudoElement:0}),SN=Zi(wN),EN=g({},Mo,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),CN=Zi(EN),NN=g({},Mo,{data:0}),Ty=Zi(NN),TN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},MN={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},AN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function RN(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=AN[s])?!!a[s]:!1}function qm(){return RN}var kN=g({},hu,{key:function(s){if(s.key){var a=TN[s.key]||s.key;if(a!=="Unidentified")return a}
vendor: 5,186 bytes, line 9
9return s.type==="keypress"?(s=uh(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?MN[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:qm,charCode:function(s){return s.type==="keypress"?uh(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?uh(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),jN=Zi(kN),LN=g({},fh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),My=Zi(LN),PN=g({},hu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:qm}),ON=Zi(PN),DN=g({},Mo,{propertyName:0,elapsedTime:0,pseudoElement:0}),UN=Zi(DN),IN=g({},fh,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),zN=Zi(IN),$N=g({},Mo,{newState:0,oldState:0}),FN=Zi($N),BN=[9,13,27,32],Wm=Zr&&"CompositionEvent"in window,pu=null;Zr&&"documentMode"in document&&(pu=document.documentMode);var HN=Zr&&"TextEvent"in window&&!pu,Ay=Zr&&(!Wm||pu&&8<pu&&11>=pu),Ry=" ",ky=!1;function jy(s,a){switch(s){case"keyup":return BN.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ly(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var El=!1;function VN(s,a){switch(s){case"compositionend":return Ly(a);case"keypress":return a.which!==32?null:(ky=!0,Ry);case"textInput":return s=a.data,s===Ry&&ky?null:s;default:return null}}function GN(s,a){if(El)return s==="compositionend"||!Wm&&jy(s,a)?(s=Ey(),ch=Bm=Oa=null,El=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Ay&&a.locale!=="ko"?null:a.data;default:return null}}var qN={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Py(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!qN[s.type]:a==="textarea"}function Oy(s,a,c,f){wl?Sl?Sl.push(f):Sl=[f]:wl=f,a=nf(a,"onChange"),0<a.length&&(c=new hh("onChange","change",null,c,f),s.push({event:c,listeners:a}))}var mu=null,gu=null;function WN(s){xw(s,0)}function ph(s){var a=lt(s);if(mn(a))return s}function Dy(s,a){if(s==="change")return a}var Uy=!1;if(Zr){var Xm;if(Zr){var Ym="oninput"in document;if(!Ym){var Iy=document.createElement("div");Iy.setAttribute("oninput","return;"),Ym=typeof Iy.oninput=="function"}Xm=Ym}else Xm=!1;Uy=Xm&&(!document.documentMode||9<document.documentMode)}function zy(){mu&&(mu.detachEvent("onpropertychange",$y),gu=mu=null)}function $y(s){if(s.propertyName==="value"&&ph(gu)){var a=[];Oy(a,gu,s,zm(s)),Sy(WN,a)}}function XN(s,a,c){s==="focusin"?(zy(),mu=a,gu=c,mu.attachEvent("onpropertychange",$y)):s==="focusout"&&zy()}function YN(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return ph(gu)}function KN(s,a){if(s==="click")return ph(a)}function ZN(s,a){if(s==="input"||s==="change")return ph(a)}function QN(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var hs=typeof Object.is=="function"?Object.is:QN;function xu(s,a){if(hs(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var c=Object.keys(s),f=Object.keys(a);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var x=c[f];if(!Nt.call(a,x)||!hs(s[x],a[x]))return!1}return!0}function Fy(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function By(s,a){var c=Fy(s);s=0;for(var f;c;){if(c.nodeType===3){if(f=s+c.textContent.length,s<=a&&f>=a)return{node:c,offset:a-s};s=f}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Fy(c)}}function Hy(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?Hy(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function Vy(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var a=ot(s.document);a instanceof s.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)s=a.contentWindow;else break;a=ot(s.document)}return a}function Km(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}var JN=Zr&&"documentMode"in document&&11>=document.documentMode,Cl=null,Zm=null,bu=null,Qm=!1;function Gy(s,a,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Qm||Cl==null||Cl!==ot(f)||(f=Cl,"selectionStart"in f&&Km(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focu
vendor: 17,266 bytes, line 9
9sNode:f.focusNode,focusOffset:f.focusOffset}),bu&&xu(bu,f)||(bu=f,f=nf(Zm,"onSelect"),0<f.length&&(a=new hh("onSelect","select",null,a,c),s.push({event:a,listeners:f}),a.target=Cl)))}function Ao(s,a){var c={};return c[s.toLowerCase()]=a.toLowerCase(),c["Webkit"+s]="webkit"+a,c["Moz"+s]="moz"+a,c}var Nl={animationend:Ao("Animation","AnimationEnd"),animationiteration:Ao("Animation","AnimationIteration"),animationstart:Ao("Animation","AnimationStart"),transitionrun:Ao("Transition","TransitionRun"),transitionstart:Ao("Transition","TransitionStart"),transitioncancel:Ao("Transition","TransitionCancel"),transitionend:Ao("Transition","TransitionEnd")},Jm={},qy={};Zr&&(qy=document.createElement("div").style,"AnimationEvent"in window||(delete Nl.animationend.animation,delete Nl.animationiteration.animation,delete Nl.animationstart.animation),"TransitionEvent"in window||delete Nl.transitionend.transition);function Ro(s){if(Jm[s])return Jm[s];if(!Nl[s])return s;var a=Nl[s],c;for(c in a)if(a.hasOwnProperty(c)&&c in qy)return Jm[s]=a[c];return s}var Wy=Ro("animationend"),Xy=Ro("animationiteration"),Yy=Ro("animationstart"),eT=Ro("transitionrun"),tT=Ro("transitionstart"),nT=Ro("transitioncancel"),Ky=Ro("transitionend"),Zy=new Map,e0="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");e0.push("scrollEnd");function Js(s,a){Zy.set(s,a),me(a,[s])}var mh=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Ls=[],Tl=0,t0=0;function gh(){for(var s=Tl,a=t0=Tl=0;a<s;){var c=Ls[a];Ls[a++]=null;var f=Ls[a];Ls[a++]=null;var x=Ls[a];Ls[a++]=null;var v=Ls[a];if(Ls[a++]=null,f!==null&&x!==null){var A=f.pending;A===null?x.next=x:(x.next=A.next,A.next=x),f.pending=x}v!==0&&Qy(c,x,v)}}function xh(s,a,c,f){Ls[Tl++]=s,Ls[Tl++]=a,Ls[Tl++]=c,Ls[Tl++]=f,t0|=f,s.lanes|=f,s=s.alternate,s!==null&&(s.lanes|=f)}function n0(s,a,c,f){return xh(s,a,c,f),bh(s)}function ko(s,a){return xh(s,null,null,a),bh(s)}function Qy(s,a,c){s.lanes|=c;var f=s.alternate;f!==null&&(f.lanes|=c);for(var x=!1,v=s.return;v!==null;)v.childLanes|=c,f=v.alternate,f!==null&&(f.childLanes|=c),v.tag===22&&(s=v.stateNode,s===null||s._visibility&1||(x=!0)),s=v,v=v.return;return s.tag===3?(v=s.stateNode,x&&a!==null&&(x=31-Ae(c),s=v.hiddenUpdates,f=s[x],f===null?s[x]=[a]:f.push(a),a.lane=c|536870912),v):null}function bh(s){if(50<$u)throw $u=0,dg=null,Error(i(185));for(var a=s.return;a!==null;)s=a,a=s.return;return s.tag===3?s.stateNode:null}var Ml={};function iT(s,a,c,f){this.tag=s,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fs(s,a,c,f){return new iT(s,a,c,f)}function i0(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Qr(s,a){var c=s.alternate;return c===null?(c=fs(s.tag,a,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=a,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&65011712,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,a=s.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c.refCleanup=s.refCleanup,c}function Jy(s,a){s.flags&=65011714;var c=s.alternate;return c===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,a=c.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function vh(s,a,c,f,x,v){var A=0;if(f=s,typeof s=="function")i0(s)&&(A=1);else if(typeof s=="string")A=lM(s,c,Ee.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case P:return s=fs(31,c,a,x),s.elementType=P,s.lanes=v,s;case C:return jo(c.children,x,v,a);case w:A=8,x|=24;break;case S:return s=fs(12,c,a,x|2),s.elementType=S,s.lanes=v,s;case O:return s=fs(13,c,a,x),s.elementType=O,s.lanes=v,s;case R:return s=fs(19,c,a,x),s.elementType=R,s.lanes=v,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case N:A=10;break e;case T:A=9;break e;case j:A=11;break e;case z:A=14;break e;case M:A=16,f=null;break e}A=29,c=Error(i(130,s===null?"null":typeof s,"")),f=null}return a=fs(A,c,a,x),a.elementType=s,a.type=f,a.lanes=v,a}function jo(s,a,c,f){return s=fs(7,s,f,a),s.lanes=c,s}function s0(s,a,c){return s=fs(6,s,null,a),s.lanes=c,s}function e_(s){var a=fs(18,null,null,0);return a.stateNode=s,a}function r0(s,a,c){return a=fs(4,s.children!==null?s.children:[],s.key,a),a.lanes=c,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}var t_=new WeakMap;function Ps(s,a){if(typeof s=="object"&&s!==null){var c=t_.get(s);return c!==void 0?c:(a={value:s,source:a,stack:K(a)},t_.set(s,a),a)}return{value:s,source:a,stack:K(a)}}var Al=[],Rl=0,yh=null,vu=0,Os=[],Ds=0,Da=null,wr=1,Sr="";function Jr(s,a){Al[Rl++]=vu,Al[Rl++]=yh,yh=s,vu=a}function n_(s,a,c){Os[Ds++]=wr,Os[Ds++]=Sr,Os[Ds++]=Da,Da=s;var f=wr;s=Sr;var x=32-Ae(f)-1;f&=~(1<<x),c+=1;var v=32-Ae(a)+x;if(30<v){var A=x-x%5;v=(f&(1<<A)-1).toString(32),f>>=A,x-=A,wr=1<<32-Ae(a)+x|c<<x|f,Sr=v+s}else wr=1<<v|c<<x|f,Sr=s}function a0(s){s.return!==null&&(Jr(s,1),n_(s,1,0))}function o0(s){for(;s===yh;)yh=Al[--Rl],Al[Rl]=null,vu=Al[--Rl],Al[Rl]=null;for(;s===Da;)Da=Os[--Ds],Os[Ds]=null,Sr=Os[--Ds],Os[Ds]=null,wr=Os[--Ds],Os[Ds]=null}function i_(s,a){Os[Ds++]=wr,Os[Ds++]=Sr,Os[Ds++]=Da,wr=a.id,Sr=a.overflow,Da=s}var Ei=null,jn=null,tn=!1,Ua=null,Us=!1,l0=Error(i(519));function Ia(s){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yu(Ps(a,s)),l0}function s_(s){var a=s.stateNode,c=s.type,f=s.memoizedProps;switch(a[xn]=s,a[Nn]=f,c){case"dialog":Zt("cancel",a),Zt("close",a);break;case"iframe":case"object":case"embed":Zt("load",a);break;case"video":case"audio":for(c=0;c<Bu.length;c++)Zt(Bu[c],a);break;case"source":Zt("error",a);break;case"img":case"image":case"link":Zt("error",a),Zt("load",a);break;case"details":Zt("toggle",a);break;case"input":Zt("invalid",a),us(a,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":Zt("invalid",a);break;case"textarea":Zt("invalid",a),ei(a,f.value,f.defaultValue,f.children)}c=f.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||f.suppressHydrationWarning===!0||_w(a.textContent,c)?(f.popover!=null&&(Zt("beforetoggle",a),Zt("toggle",a)),f.onScroll!=null&&Zt("scroll",a),f.onScrollEnd!=null&&Zt("scrollend",a),f.onClick!=null&&(a.onclick=Kr),a=!0):a=!1,a||Ia(s,!0)}function r_(s){for(Ei=s.return;Ei;)switch(Ei.tag){case 5:case 31:case 13:Us=!1;return;case 27:case 3:Us=!0;return;default:Ei=Ei.return}}function kl(s){if(s!==Ei)return!1;if(!tn)return r_(s),tn=!0,!1;var a=s.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=s.type,c=!(c!=="form"&&c!=="button")||Ng(s.type,s.memoizedProps)),c=!c),c&&jn&&Ia(s),r_(s),a===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));jn=Rw(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));jn=Rw(s)}else a===27?(a=jn,Qa(s.type)?(s=kg,kg=null,jn=s):jn=a):jn=Ei?zs(s.stateNode.nextSibling):null;return!0}function Lo(){jn=Ei=null,tn=!1}function c0(){var s=Ua;return s!==null&&(ts===null?ts=s:ts.push.apply(ts,s),Ua=null),s}function yu(s){Ua===null?Ua=[s]:Ua.push(s)}var u0=D(null),Po=null,ea=null;function za(s,a,c){Z(u0,a._currentValue),a._currentValue=c}function ta(s){s._currentValue=u0.current,H(u0)}function d0(s,a,c){for(;s!==null;){var f=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,f!==null&&(f.childLanes|=a)):f!==null&&(f.childLanes&a)!==a&&(f.childLanes|=a),s===c)break;s=s.return}}function h0(s,a,c,f){var x=s.child;for(x!==null&&(x.return=s);x!==null;){var v=x.dependencies;if(v!==null){var A=x.child;v=v.firstContext;e:for(;v!==null;){var B=v;v=x;for(var ee=0;ee<a.length;ee++)if(B.context===a[ee]){v.lanes|=c,B=v.alternate,B!==null&&(B.lanes|=c),d0(v.return,c,s),f||(A=null);break e}v=B.next}}else if(x.tag===18){if(A=x.return,A===null)throw Error(i(341));A.lanes|=c,v=A.alternate,v!==null&&(v.lanes|=c),d0(A,c,s),A=null}else A=x.child;if(A!==null)A.return=x;else for(A=x;A!==null;){if(A===s){A=null;break}if(x=A.sibling,x!==null){x.return=A.return,A=x;break}A=A.return}x=A}}function jl(s,a,c,f){s=null;for(var x=a,v=!1;x!==null;){if(!v){if((x.flags&524288)!==0)v=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var A=x.alternate;if(A===null)throw Error(i(387));if(A=A.memoizedProps,A!==null){var B=x.type;hs(x.pendingProps.value,A.value)||(s!==null?s.push(B):s=[B])}}else if(x===Se.current){if(A=x.alternate,A===null)throw Error(i(387));A.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(s!==null?s.push(Wu):s=[Wu])}x=x.return}s!==null&&h0(a,s,c,f),a.flags|=262144}function _h(s){for(s=s.firstContext;s!==null;){if(!hs(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Oo(s){Po=s,ea=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Ci(s){return a_(Po,s)}function wh(s,a){return Po===null&&Oo(s),a_(s,a)}function a_(s,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},ea===null){if(s===null)throw Error(i(308));ea=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else ea=ea.next=a;return c}var sT=typeof AbortController<"u"?AbortController:function(){var s=[],a=this.signal={aborted:!1,addEventListener:function(c,f){s.push(f)}};this.abort=function(){a.aborted=!0,s.forEach(function(c){return c()})}},rT=n.unstable_scheduleCallback,aT=n.unstable_NormalPriority,ni={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function f0(){return{controller:new sT,data:new Map,refCount:0}}function _u(s){s.refCount--,s.refCount===0&&rT(aT,function(){s.controller.abort()})}var wu=null,p0=0,Ll=0,Pl=null;function oT(s,a){if(wu===null){var c=wu=[];p0=0,Ll=xg(),Pl={status:"pending",value:void 0,then:function(f){c.push(f)}}}return p0++,a.then(o_,o_),a}function o_(){if(--p0===0&&wu!==null){Pl!==null&&(Pl.status="fulfilled");var s=wu;wu=null,Ll=0,Pl=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function lT(s,a){var c=[],f={status:"pending",value:null,reason:null,then:function(x){c.push(x)}};return s.then(function(){f.status="fulfilled",f.value=a;for(var x=0;x<c.length;x++)(0,c[x])(a)},function(x){for(f.status="rejected",f.reason=x,x=0;x<c.length;x++)(0,c[x])(void 0)}),f}var l_=$.S;$.S=function(s,a){G2=k(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&oT(s,a),l_!==null&&l_(s,a)};var Do=D(null);function m0(){var s=Do.current;return s!==null?s:Tn.pooledCache}function Sh(s,a){a===null?Z(Do,Do.current):Z(Do,a.pool)}function c_(){var s=m0();return s===null?null:{parent:ni._currentValue,pool:s}}var Ol=Error(i(460)),g0=Error(i(474)),Eh=Error(i(542)),Ch={then:function(){}};function u_(s){return s=s.status,s==="fulfilled"||s==="rejected"}function d_(s,a,c){switch(c=s[c],c===void 0?s.push(a):c!==a&&(a.then(Kr,Kr),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,f_(s),s;default:if(typeof a.status=="string")a.then(Kr,Kr);else{if(s=Tn,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=a,s.status="pending",s.then(function(f){if(a.status==="pending"){var x=a;x.status="fulfilled",x.value=f}},function(f){if(a.status==="pending"){var x=a;x.status="rejected",x.reason=f}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,f_(s),s}throw Io=a,Ol}}function Uo(s){try{var a=s._init;return a(s._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Io=c,Ol):c}}var Io=null;function h_(){if(Io===null)throw Error(i(459));var s=Io;return Io=null,s}function f_(s){if(s===Ol||s===Eh)throw Error(i(483))}var Dl=null,Su=0;function Nh(s){var a=Su;return Su+=1,Dl===null&&(Dl=[]),d_(Dl,s,a)}function Eu(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function Th(s,a){throw a.$$typeof===b?Error(i(525)):(s=Object.prototype.toString.call(a),Error(i(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s)))}function p_(s){function a(he,ie){if(s){var ve=he.deletions;ve===null?(he.deletions=[ie],he.flags|=16):ve.push(ie)}}function c(he,ie){if(!s)return null;for(;ie!==null;)a(he,ie),ie=ie.sibling;return null}function f(he){for(var ie=new Map;he!==null;)he.key!==null?ie.set(he.key,he):ie.set(he.index,he),he=he.sibling;return ie}function x(he,ie){return he=Qr(he,ie),he.index=0,he.sibling=null,he}function v(he,ie,ve){return he.index=ve,s?(ve=he.alternate,ve!==null?(ve=ve.index,ve<ie?(he.flags|=67108866,ie):ve):(he.flags|=67108866,ie)):(he.flags|=1048576,ie)}function A(he){return s&&he.alternate===null&&(he.flags|=67108866),he}function B(he,ie,ve,Oe){return ie===null||ie.tag!==6?(ie=s0(ve,he.mode,Oe),ie.return=he,ie):(ie=x(ie,ve),ie.return=he,ie)}function ee(he,ie,ve,Oe){var Et=ve.type;return Et===C?Re(he,ie,ve.props.children,Oe,ve.key):ie!==null&&(ie.elementType===Et||typeof Et=="object"&&Et!==null&&Et.$$typeof===M&&Uo(Et)===ie.type)?(ie=x(ie,ve.props),Eu(ie,ve),ie.return=he,ie):(ie=vh(ve.type,ve.key,ve.props,null,he.mode,Oe),Eu(ie,ve),ie.return=he,ie)}function ye(he,ie,ve,Oe){return ie===null||ie.tag!==4||ie.stateNode.containerInfo!==ve.containerInfo||ie.stateNode.implementation!==ve.implementation?(ie=r0(ve,he.mode,Oe),ie.return=he,ie):(ie=x(ie,ve.children||[]),ie.return=he,ie)}function Re(he,ie,ve,Oe,Et){return ie===null||ie.tag!==7?(ie=jo(ve,he.mode,Oe,Et),ie.return=he,ie):(ie=x(ie,ve),ie.return=he,ie)}function Ue(he,ie,ve){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return ie=s0(""+ie,he.mode,ve),ie.return=he,ie;if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case y:return ve=vh(ie.type,ie.key,ie.props,null,he.mode,ve),Eu(ve,ie),ve.return=he,ve;case _:return ie=r0(ie,he.mode,ve),ie.return=he,ie;case M:return ie=Uo(ie),Ue(he,ie,ve)}if(F(ie)||Y(ie))return ie=jo(ie,he.mode,ve,null),ie.return=he,ie;if(typeof ie.then=="function")return Ue(he,Nh(ie),ve);if(ie.$$typeof===N)return Ue(he,wh(he,ie),ve);Th(he,ie)}return null}function _e(he,ie,ve,Oe){var Et=ie!==null?ie.key:null;if(typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint")return Et!==null?null:B(he,ie,""+ve,Oe);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case y:return ve.key===Et?ee(he,ie,ve,Oe):null;case _:return ve.key===Et?ye(he,ie,ve,Oe):null;case M:return ve=Uo(ve),_e(he,ie,ve,Oe)}if(F(ve)||Y(ve))return Et!==null?null:Re(he,ie,ve,Oe,null);if(typeof ve.then=="function")return _e(he,ie,Nh(ve),Oe);if(ve.$$typeof===N)return _e(he,ie,wh(he,ve),Oe);Th(he,ve)}return null}function Te(he,ie,ve,Oe,Et){if(typeof Oe=="string"&&Oe!==""||typeof Oe=="number"||typeof Oe=="bigint")return he=he.get(ve)||null,B(ie,he,""+Oe,Et);if(typeof Oe=="object"&&Oe!==null){switch(Oe.$$typeof){case y:return he=he.get(Oe.key===null?ve:Oe.key)||null,ee(ie,he,Oe,Et);case _:return he=he.get(Oe.key===null?ve:Oe.key)||null,ye(ie,he,Oe,Et);case M:return Oe=Uo(Oe),Te(he,ie,ve,Oe,Et)}if(F(Oe)||Y(Oe))return he=he.get(ve)||null,Re(ie,he,Oe,Et,null);if(typeof Oe.then=="function")return Te(he,ie,ve,Nh(Oe),Et);if(Oe.$$typeof===N)return Te(he,ie,ve,wh(ie,Oe),Et);Th(ie,Oe)}return null}function ft(he,ie,ve,Oe){for(var Et=null,un=null,yt=ie,Vt=ie=0,en=null;yt!==null&&Vt<ve.length;Vt++){yt.index>Vt?(en=yt,yt=null):en=yt.sibling;var dn=_e(he,yt,ve[Vt],Oe);if(dn===null){yt===null&&(yt=en);break}s&&yt&&dn.alternate===null&&a(he,yt),ie=v(dn,ie,Vt),un===null?Et=dn:un.sibling=dn,un=dn,yt=en}if(Vt===ve.length)return c(he,yt),tn&&Jr(he,Vt),Et;if(yt===null){for(;Vt<ve.length;Vt++)yt=Ue(he,ve[Vt],Oe),yt!==null&&(ie=v(yt,ie,Vt),un===null?Et=yt:un.sibling=yt,un=yt);return tn&&Jr(he,Vt),Et}for(yt=f(yt);Vt<ve.length;Vt++)en=Te(yt,he,Vt,ve[Vt],Oe),en!==null&&(s&&en.alternate!==null&&yt.delete(en.key===null?Vt:en.
vendor: 4,940 bytes, line 9
9key),ie=v(en,ie,Vt),un===null?Et=en:un.sibling=en,un=en);return s&&yt.forEach(function(io){return a(he,io)}),tn&&Jr(he,Vt),Et}function jt(he,ie,ve,Oe){if(ve==null)throw Error(i(151));for(var Et=null,un=null,yt=ie,Vt=ie=0,en=null,dn=ve.next();yt!==null&&!dn.done;Vt++,dn=ve.next()){yt.index>Vt?(en=yt,yt=null):en=yt.sibling;var io=_e(he,yt,dn.value,Oe);if(io===null){yt===null&&(yt=en);break}s&&yt&&io.alternate===null&&a(he,yt),ie=v(io,ie,Vt),un===null?Et=io:un.sibling=io,un=io,yt=en}if(dn.done)return c(he,yt),tn&&Jr(he,Vt),Et;if(yt===null){for(;!dn.done;Vt++,dn=ve.next())dn=Ue(he,dn.value,Oe),dn!==null&&(ie=v(dn,ie,Vt),un===null?Et=dn:un.sibling=dn,un=dn);return tn&&Jr(he,Vt),Et}for(yt=f(yt);!dn.done;Vt++,dn=ve.next())dn=Te(yt,he,Vt,dn.value,Oe),dn!==null&&(s&&dn.alternate!==null&&yt.delete(dn.key===null?Vt:dn.key),ie=v(dn,ie,Vt),un===null?Et=dn:un.sibling=dn,un=dn);return s&&yt.forEach(function(vM){return a(he,vM)}),tn&&Jr(he,Vt),Et}function En(he,ie,ve,Oe){if(typeof ve=="object"&&ve!==null&&ve.type===C&&ve.key===null&&(ve=ve.props.children),typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case y:e:{for(var Et=ve.key;ie!==null;){if(ie.key===Et){if(Et=ve.type,Et===C){if(ie.tag===7){c(he,ie.sibling),Oe=x(ie,ve.props.children),Oe.return=he,he=Oe;break e}}else if(ie.elementType===Et||typeof Et=="object"&&Et!==null&&Et.$$typeof===M&&Uo(Et)===ie.type){c(he,ie.sibling),Oe=x(ie,ve.props),Eu(Oe,ve),Oe.return=he,he=Oe;break e}c(he,ie);break}else a(he,ie);ie=ie.sibling}ve.type===C?(Oe=jo(ve.props.children,he.mode,Oe,ve.key),Oe.return=he,he=Oe):(Oe=vh(ve.type,ve.key,ve.props,null,he.mode,Oe),Eu(Oe,ve),Oe.return=he,he=Oe)}return A(he);case _:e:{for(Et=ve.key;ie!==null;){if(ie.key===Et)if(ie.tag===4&&ie.stateNode.containerInfo===ve.containerInfo&&ie.stateNode.implementation===ve.implementation){c(he,ie.sibling),Oe=x(ie,ve.children||[]),Oe.return=he,he=Oe;break e}else{c(he,ie);break}else a(he,ie);ie=ie.sibling}Oe=r0(ve,he.mode,Oe),Oe.return=he,he=Oe}return A(he);case M:return ve=Uo(ve),En(he,ie,ve,Oe)}if(F(ve))return ft(he,ie,ve,Oe);if(Y(ve)){if(Et=Y(ve),typeof Et!="function")throw Error(i(150));return ve=Et.call(ve),jt(he,ie,ve,Oe)}if(typeof ve.then=="function")return En(he,ie,Nh(ve),Oe);if(ve.$$typeof===N)return En(he,ie,wh(he,ve),Oe);Th(he,ve)}return typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint"?(ve=""+ve,ie!==null&&ie.tag===6?(c(he,ie.sibling),Oe=x(ie,ve),Oe.return=he,he=Oe):(c(he,ie),Oe=s0(ve,he.mode,Oe),Oe.return=he,he=Oe),A(he)):c(he,ie)}return function(he,ie,ve,Oe){try{Su=0;var Et=En(he,ie,ve,Oe);return Dl=null,Et}catch(yt){if(yt===Ol||yt===Eh)throw yt;var un=fs(29,yt,null,he.mode);return un.lanes=Oe,un.return=he,un}}}var zo=p_(!0),m_=p_(!1),$a=!1;function x0(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function b0(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Fa(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Ba(s,a,c){var f=s.updateQueue;if(f===null)return null;if(f=f.shared,(fn&2)!==0){var x=f.pending;return x===null?a.next=a:(a.next=x.next,x.next=a),f.pending=a,a=bh(s),Qy(s,null,c),a}return xh(s,f,a,c),bh(s)}function Cu(s,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var f=a.lanes;f&=s.pendingLanes,c|=f,a.lanes=c,On(s,c)}}function v0(s,a){var c=s.updateQueue,f=s.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var x=null,v=null;if(c=c.firstBaseUpdate,c!==null){do{var A={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};v===null?x=v=A:v=v.next=A,c=c.next}while(c!==null);v===null?x=v=a:v=v.next=a}else x=v=a;c={baseState:f.baseState,firstBaseUpdate:x,lastBaseUpdate:v,shared:f.shared,callbacks:f.callbacks},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=a:s.next=a,c.lastBaseUpdate=a}var y0=!1;function Nu(){if(y0){var s=Pl;if(s!==null)throw s}}function Tu(s,a,c,f){y0=!1;var x=s.updateQueue;$a=!1;var v=x.firstBaseUpdate,A=x.lastBaseUpdate,B=x.shared.pending;if(B!==null){x.shared.pending=null;var ee=B,ye=ee.next;ee.next=null,A===null?v=ye:A.next=ye,A=ee;var Re=s.alternate;Re!==null&&(Re=Re.updateQueue,B=Re.lastBaseUpdate,B!==A&&(B===null?Re.firstBaseUpdate=ye:B.next=ye,Re.lastBaseUpdate=ee))}if(v!==null){var Ue=x.baseState;A=0,Re=ye=ee=null,B=v;do{var _e=B.lane&-536870913,Te=_e!==B.lane;if(Te?(Jt&_e)===_e:(f&_e)===_e){_e!==0&&_e===Ll&&(y0=!0),Re!==null&&(Re=Re.next={lane:0,tag:B.tag,payload:B.payload,callback:null,next:null});e:{var ft=s,jt=B;_e=a;var En=c;switch(jt.tag){case 1:if(ft=jt.payload,typeof ft=="function"){Ue=ft.call(En,Ue,_e);break e}Ue=ft;break e;case 3:ft.flags=ft.flags&-65537|128;case 0:if(ft=jt.payload,_e=typeof ft=="function"?ft.call(En,Ue,_e):ft,_e==null)break e;Ue=g({},Ue,_e);break e;case 2:$a=!0}}
vendor: 4,709 bytes, line 9
9_e=B.callback,_e!==null&&(s.flags|=64,Te&&(s.flags|=8192),Te=x.callbacks,Te===null?x.callbacks=[_e]:Te.push(_e))}else Te={lane:_e,tag:B.tag,payload:B.payload,callback:B.callback,next:null},Re===null?(ye=Re=Te,ee=Ue):Re=Re.next=Te,A|=_e;if(B=B.next,B===null){if(B=x.shared.pending,B===null)break;Te=B,B=Te.next,Te.next=null,x.lastBaseUpdate=Te,x.shared.pending=null}}while(!0);Re===null&&(ee=Ue),x.baseState=ee,x.firstBaseUpdate=ye,x.lastBaseUpdate=Re,v===null&&(x.shared.lanes=0),Wa|=A,s.lanes=A,s.memoizedState=Ue}}function g_(s,a){if(typeof s!="function")throw Error(i(191,s));s.call(a)}function x_(s,a){var c=s.callbacks;if(c!==null)for(s.callbacks=null,s=0;s<c.length;s++)g_(c[s],a)}var Ul=D(null),Mh=D(0);function b_(s,a){s=ua,Z(Mh,s),Z(Ul,a),ua=s|a.baseLanes}function _0(){Z(Mh,ua),Z(Ul,Ul.current)}function w0(){ua=Mh.current,H(Ul),H(Mh)}var ps=D(null),Is=null;function Ha(s){var a=s.alternate;Z(Wn,Wn.current&1),Z(ps,s),Is===null&&(a===null||Ul.current!==null||a.memoizedState!==null)&&(Is=s)}function S0(s){Z(Wn,Wn.current),Z(ps,s),Is===null&&(Is=s)}function v_(s){s.tag===22?(Z(Wn,Wn.current),Z(ps,s),Is===null&&(Is=s)):Va()}function Va(){Z(Wn,Wn.current),Z(ps,ps.current)}function ms(s){H(ps),Is===s&&(Is=null),H(Wn)}var Wn=D(0);function Ah(s){for(var a=s;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Ag(c)||Rg(c)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var na=0,Ht=null,wn=null,ii=null,Rh=!1,Il=!1,$o=!1,kh=0,Mu=0,zl=null,cT=0;function zn(){throw Error(i(321))}function E0(s,a){if(a===null)return!1;for(var c=0;c<a.length&&c<s.length;c++)if(!hs(s[c],a[c]))return!1;return!0}function C0(s,a,c,f,x,v){return na=v,Ht=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,$.H=s===null||s.memoizedState===null?n2:$0,$o=!1,v=c(f,x),$o=!1,Il&&(v=__(a,c,f,x)),y_(s),v}function y_(s){$.H=ku;var a=wn!==null&&wn.next!==null;if(na=0,ii=wn=Ht=null,Rh=!1,Mu=0,zl=null,a)throw Error(i(300));s===null||si||(s=s.dependencies,s!==null&&_h(s)&&(si=!0))}function __(s,a,c,f){Ht=s;var x=0;do{if(Il&&(zl=null),Mu=0,Il=!1,25<=x)throw Error(i(301));if(x+=1,ii=wn=null,s.updateQueue!=null){var v=s.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}$.H=i2,v=a(c,f)}while(Il);return v}function uT(){var s=$.H,a=s.useState()[0];return a=typeof a.then=="function"?Au(a):a,s=s.useState()[0],(wn!==null?wn.memoizedState:null)!==s&&(Ht.flags|=1024),a}function N0(){var s=kh!==0;return kh=0,s}function T0(s,a,c){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~c}function M0(s){if(Rh){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}Rh=!1}na=0,ii=wn=Ht=null,Il=!1,Mu=kh=0,zl=null}function Vi(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ii===null?Ht.memoizedState=ii=s:ii=ii.next=s,ii}function Xn(){if(wn===null){var s=Ht.alternate;s=s!==null?s.memoizedState:null}else s=wn.next;var a=ii===null?Ht.memoizedState:ii.next;if(a!==null)ii=a,wn=s;else{if(s===null)throw Ht.alternate===null?Error(i(467)):Error(i(310));wn=s,s={memoizedState:wn.memoizedState,baseState:wn.baseState,baseQueue:wn.baseQueue,queue:wn.queue,next:null},ii===null?Ht.memoizedState=ii=s:ii=ii.next=s}return ii}function jh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Au(s){var a=Mu;return Mu+=1,zl===null&&(zl=[]),s=d_(zl,s,a),a=Ht,(ii===null?a.memoizedState:ii.next)===null&&(a=a.alternate,$.H=a===null||a.memoizedState===null?n2:$0),s}function Lh(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Au(s);if(s.$$typeof===N)return Ci(s)}throw Error(i(438,String(s)))}function A0(s){var a=null,c=Ht.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var f=Ht.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(a={data:f.data.map(function(x){return x.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=jh(),Ht.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(s),f=0;f<s;f++)c[f]=G;return a.index++,c}function ia(s,a){return typeof a=="function"?a(s):a}function Ph(s){var a=Xn();return R0(a,wn,s)}function R0(s,a,c){var f=s.queue;if(f===null)throw Error(i(311));f.lastRenderedReducer=c;var x=s.baseQueue,v=f.pending;if(v!==null){if(x!==null){var A=x.next;
vendor: 4,106 bytes, line 9
9x.next=v.next,v.next=A}a.baseQueue=x=v,f.pending=null}if(v=s.baseState,x===null)s.memoizedState=v;else{a=x.next;var B=A=null,ee=null,ye=a,Re=!1;do{var Ue=ye.lane&-536870913;if(Ue!==ye.lane?(Jt&Ue)===Ue:(na&Ue)===Ue){var _e=ye.revertLane;if(_e===0)ee!==null&&(ee=ee.next={lane:0,revertLane:0,gesture:null,action:ye.action,hasEagerState:ye.hasEagerState,eagerState:ye.eagerState,next:null}),Ue===Ll&&(Re=!0);else if((na&_e)===_e){ye=ye.next,_e===Ll&&(Re=!0);continue}else Ue={lane:0,revertLane:ye.revertLane,gesture:null,action:ye.action,hasEagerState:ye.hasEagerState,eagerState:ye.eagerState,next:null},ee===null?(B=ee=Ue,A=v):ee=ee.next=Ue,Ht.lanes|=_e,Wa|=_e;Ue=ye.action,$o&&c(v,Ue),v=ye.hasEagerState?ye.eagerState:c(v,Ue)}else _e={lane:Ue,revertLane:ye.revertLane,gesture:ye.gesture,action:ye.action,hasEagerState:ye.hasEagerState,eagerState:ye.eagerState,next:null},ee===null?(B=ee=_e,A=v):ee=ee.next=_e,Ht.lanes|=Ue,Wa|=Ue;ye=ye.next}while(ye!==null&&ye!==a);if(ee===null?A=v:ee.next=B,!hs(v,s.memoizedState)&&(si=!0,Re&&(c=Pl,c!==null)))throw c;s.memoizedState=v,s.baseState=A,s.baseQueue=ee,f.lastRenderedState=v}return x===null&&(f.lanes=0),[s.memoizedState,f.dispatch]}function k0(s){var a=Xn(),c=a.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=s;var f=c.dispatch,x=c.pending,v=a.memoizedState;if(x!==null){c.pending=null;var A=x=x.next;do v=s(v,A.action),A=A.next;while(A!==x);hs(v,a.memoizedState)||(si=!0),a.memoizedState=v,a.baseQueue===null&&(a.baseState=v),c.lastRenderedState=v}return[v,f]}function w_(s,a,c){var f=Ht,x=Xn(),v=tn;if(v){if(c===void 0)throw Error(i(407));c=c()}else c=a();var A=!hs((wn||x).memoizedState,c);if(A&&(x.memoizedState=c,si=!0),x=x.queue,P0(C_.bind(null,f,x,s),[s]),x.getSnapshot!==a||A||ii!==null&&ii.memoizedState.tag&1){if(f.flags|=2048,$l(9,{destroy:void 0},E_.bind(null,f,x,c,a),null),Tn===null)throw Error(i(349));v||(na&127)!==0||S_(f,a,c)}return c}function S_(s,a,c){s.flags|=16384,s={getSnapshot:a,value:c},a=Ht.updateQueue,a===null?(a=jh(),Ht.updateQueue=a,a.stores=[s]):(c=a.stores,c===null?a.stores=[s]:c.push(s))}function E_(s,a,c,f){a.value=c,a.getSnapshot=f,N_(a)&&T_(s)}function C_(s,a,c){return c(function(){N_(a)&&T_(s)})}function N_(s){var a=s.getSnapshot;s=s.value;try{var c=a();return!hs(s,c)}catch{return!0}}function T_(s){var a=ko(s,2);a!==null&&ns(a,s,2)}function j0(s){var a=Vi();if(typeof s=="function"){var c=s;if(s=c(),$o){ke(!0);try{c()}finally{ke(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:s},a}function M_(s,a,c,f){return s.baseState=c,R0(s,wn,typeof f=="function"?f:ia)}function dT(s,a,c,f,x){if(Uh(s))throw Error(i(485));if(s=a.action,s!==null){var v={payload:x,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(A){v.listeners.push(A)}};$.T!==null?c(!0):v.isTransition=!1,f(v),c=a.pending,c===null?(v.next=a.pending=v,A_(a,v)):(v.next=c.next,a.pending=c.next=v)}}function A_(s,a){var c=a.action,f=a.payload,x=s.state;if(a.isTransition){var v=$.T,A={};$.T=A;try{var B=c(x,f),ee=$.S;ee!==null&&ee(A,B),R_(s,a,B)}catch(ye){L0(s,a,ye)}finally{v!==null&&A.types!==null&&(v.types=A.types),$.T=v}}else try{v=c(x,f),R_(s,a,v)}catch(ye){L0(s,a,ye)}}function R_(s,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){k_(s,a,f)},function(f){return L0(s,a,f)}):k_(s,a,c)}function k_(s,a,c){a.status="fulfilled",a.value=c,j_(a),s.state=c,a=s.pending,a!==null&&(c=a.next,c===a?s.pending=null:(c=c.next,a.next=c,A_(s,c)))}function L0(s,a,c){var f=s.pending;if(s.pending=null,f!==null){f=f.next;do a.status="rejected",a.reason=c,j_(a),a=a.next;while(a!==f)}s.action=null}function j_(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function L_(s,a){return a}function P_(s,a){if(tn){var c=Tn.formState;if(c!==null){e:{var f=Ht;if(tn){if(jn){t:{for(var x=jn,v=Us;x.nodeType!==8;){if(!v){x=null;break t}if(x=zs(x.nextSibling),x===null){x=null;break t}}v=x.data,x=v==="F!"||v==="F"?x:null}if(x){jn=zs(x.nextSibling),f=x.data==="F!";break e}}Ia(f)}f=!1}f&&(a=c[0])}}
vendor: 5,052 bytes, line 9
9return c=Vi(),c.memoizedState=c.baseState=a,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:L_,lastRenderedState:a},c.queue=f,c=J_.bind(null,Ht,f),f.dispatch=c,f=j0(!1),v=z0.bind(null,Ht,!1,f.queue),f=Vi(),x={state:a,dispatch:null,action:s,pending:null},f.queue=x,c=dT.bind(null,Ht,x,v,c),x.dispatch=c,f.memoizedState=s,[a,c,!1]}function O_(s){var a=Xn();return D_(a,wn,s)}function D_(s,a,c){if(a=R0(s,a,L_)[0],s=Ph(ia)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var f=Au(a)}catch(A){throw A===Ol?Eh:A}else f=a;a=Xn();var x=a.queue,v=x.dispatch;return c!==a.memoizedState&&(Ht.flags|=2048,$l(9,{destroy:void 0},hT.bind(null,x,c),null)),[f,v,s]}function hT(s,a){s.action=a}function U_(s){var a=Xn(),c=wn;if(c!==null)return D_(a,c,s);Xn(),a=a.memoizedState,c=Xn();var f=c.queue.dispatch;return c.memoizedState=s,[a,f,!1]}function $l(s,a,c,f){return s={tag:s,create:c,deps:f,inst:a,next:null},a=Ht.updateQueue,a===null&&(a=jh(),Ht.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=s.next=s:(f=c.next,c.next=s,s.next=f,a.lastEffect=s),s}function I_(){return Xn().memoizedState}function Oh(s,a,c,f){var x=Vi();Ht.flags|=s,x.memoizedState=$l(1|a,{destroy:void 0},c,f===void 0?null:f)}function Dh(s,a,c,f){var x=Xn();f=f===void 0?null:f;var v=x.memoizedState.inst;wn!==null&&f!==null&&E0(f,wn.memoizedState.deps)?x.memoizedState=$l(a,v,c,f):(Ht.flags|=s,x.memoizedState=$l(1|a,v,c,f))}function z_(s,a){Oh(8390656,8,s,a)}function P0(s,a){Dh(2048,8,s,a)}function fT(s){Ht.flags|=4;var a=Ht.updateQueue;if(a===null)a=jh(),Ht.updateQueue=a,a.events=[s];else{var c=a.events;c===null?a.events=[s]:c.push(s)}}function $_(s){var a=Xn().memoizedState;return fT({ref:a,nextImpl:s}),function(){if((fn&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function F_(s,a){return Dh(4,2,s,a)}function B_(s,a){return Dh(4,4,s,a)}function H_(s,a){if(typeof a=="function"){s=s();var c=a(s);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return s=s(),a.current=s,function(){a.current=null}}function V_(s,a,c){c=c!=null?c.concat([s]):null,Dh(4,4,H_.bind(null,a,s),c)}function O0(){}function G_(s,a){var c=Xn();a=a===void 0?null:a;var f=c.memoizedState;return a!==null&&E0(a,f[1])?f[0]:(c.memoizedState=[s,a],s)}function q_(s,a){var c=Xn();a=a===void 0?null:a;var f=c.memoizedState;if(a!==null&&E0(a,f[1]))return f[0];if(f=s(),$o){ke(!0);try{s()}finally{ke(!1)}}return c.memoizedState=[f,a],f}function D0(s,a,c){return c===void 0||(na&1073741824)!==0&&(Jt&261930)===0?s.memoizedState=a:(s.memoizedState=c,s=W2(),Ht.lanes|=s,Wa|=s,c)}function W_(s,a,c,f){return hs(c,a)?c:Ul.current!==null?(s=D0(s,c,f),hs(s,a)||(si=!0),s):(na&42)===0||(na&1073741824)!==0&&(Jt&261930)===0?(si=!0,s.memoizedState=c):(s=W2(),Ht.lanes|=s,Wa|=s,a)}function X_(s,a,c,f,x){var v=V.p;V.p=v!==0&&8>v?v:8;var A=$.T,B={};$.T=B,z0(s,!1,a,c);try{var ee=x(),ye=$.S;if(ye!==null&&ye(B,ee),ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var Re=lT(ee,f);Ru(s,a,Re,bs(s))}else Ru(s,a,f,bs(s))}catch(Ue){Ru(s,a,{then:function(){},status:"rejected",reason:Ue},bs())}finally{V.p=v,A!==null&&B.types!==null&&(A.types=B.types),$.T=A}}function pT(){}function U0(s,a,c,f){if(s.tag!==5)throw Error(i(476));var x=Y_(s).queue;X_(s,x,a,se,c===null?pT:function(){return K_(s),c(f)})}function Y_(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:se},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:c},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function K_(s){var a=Y_(s);a.next===null&&(a=s.alternate.memoizedState),Ru(s,a.next.queue,{},bs())}function I0(){return Ci(Wu)}function Z_(){return Xn().memoizedState}function Q_(){return Xn().memoizedState}function mT(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var c=bs();s=Fa(c);var f=Ba(a,s,c);f!==null&&(ns(f,a,c),Cu(f,a,c)),a={cache:f0()},s.payload=a;return}a=a.return}}function gT(s,a,c){var f=bs();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Uh(s)?e2(a,c):(c=n0(s,a,c,f),c!==null&&(ns(c,s,f),t2(c,a,f)))}function J_(s,a,c){var f=bs();Ru(s,a,c,f)}function Ru(s,a,c,f){var x={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Uh(s))e2(a,x);else{var v=s.alternate;if(s.lanes===0&&(v===null||v.lanes===0)&&(v=a.lastRenderedReducer,v!==null))try{var A=a.lastRenderedState,B=v(A,c);if(x.hasEagerState=!0,x.eagerState=B,hs(B,A))return xh(s,a,x,0),Tn===null&&gh(),!1}catch{}if(c=n0(s,a,x,f),c!==null)return ns(c,s,f),t2(c,a,f),!0}return!1}function z0(s,a,c,f){if(f={lane:2,revertLane:xg(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Uh(s)){if(a)throw Error(i(479))}else a=n0(s,c,f,2),a!==null&&ns(a,s,2)}function Uh(s){var a=s.alternate;return s===Ht||a!==null&&a===Ht}function e2(s,a){Il=Rh=!0;var c=s.pending;
vendor: 9,988 bytes, line 9
9c===null?a.next=a:(a.next=c.next,c.next=a),s.pending=a}function t2(s,a,c){if((c&4194048)!==0){var f=a.lanes;f&=s.pendingLanes,c|=f,a.lanes=c,On(s,c)}}var ku={readContext:Ci,use:Lh,useCallback:zn,useContext:zn,useEffect:zn,useImperativeHandle:zn,useLayoutEffect:zn,useInsertionEffect:zn,useMemo:zn,useReducer:zn,useRef:zn,useState:zn,useDebugValue:zn,useDeferredValue:zn,useTransition:zn,useSyncExternalStore:zn,useId:zn,useHostTransitionStatus:zn,useFormState:zn,useActionState:zn,useOptimistic:zn,useMemoCache:zn,useCacheRefresh:zn};ku.useEffectEvent=zn;var n2={readContext:Ci,use:Lh,useCallback:function(s,a){return Vi().memoizedState=[s,a===void 0?null:a],s},useContext:Ci,useEffect:z_,useImperativeHandle:function(s,a,c){c=c!=null?c.concat([s]):null,Oh(4194308,4,H_.bind(null,a,s),c)},useLayoutEffect:function(s,a){return Oh(4194308,4,s,a)},useInsertionEffect:function(s,a){Oh(4,2,s,a)},useMemo:function(s,a){var c=Vi();a=a===void 0?null:a;var f=s();if($o){ke(!0);try{s()}finally{ke(!1)}}return c.memoizedState=[f,a],f},useReducer:function(s,a,c){var f=Vi();if(c!==void 0){var x=c(a);if($o){ke(!0);try{c(a)}finally{ke(!1)}}}else x=a;return f.memoizedState=f.baseState=x,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:x},f.queue=s,s=s.dispatch=gT.bind(null,Ht,s),[f.memoizedState,s]},useRef:function(s){var a=Vi();return s={current:s},a.memoizedState=s},useState:function(s){s=j0(s);var a=s.queue,c=J_.bind(null,Ht,a);return a.dispatch=c,[s.memoizedState,c]},useDebugValue:O0,useDeferredValue:function(s,a){var c=Vi();return D0(c,s,a)},useTransition:function(){var s=j0(!1);return s=X_.bind(null,Ht,s.queue,!0,!1),Vi().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,c){var f=Ht,x=Vi();if(tn){if(c===void 0)throw Error(i(407));c=c()}else{if(c=a(),Tn===null)throw Error(i(349));(Jt&127)!==0||S_(f,a,c)}x.memoizedState=c;var v={value:c,getSnapshot:a};return x.queue=v,z_(C_.bind(null,f,v,s),[s]),f.flags|=2048,$l(9,{destroy:void 0},E_.bind(null,f,v,c,a),null),c},useId:function(){var s=Vi(),a=Tn.identifierPrefix;if(tn){var c=Sr,f=wr;c=(f&~(1<<32-Ae(f)-1)).toString(32)+c,a="_"+a+"R_"+c,c=kh++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=cT++,a="_"+a+"r_"+c.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:I0,useFormState:P_,useActionState:P_,useOptimistic:function(s){var a=Vi();a.memoizedState=a.baseState=s;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=z0.bind(null,Ht,!0,c),c.dispatch=a,[s,a]},useMemoCache:A0,useCacheRefresh:function(){return Vi().memoizedState=mT.bind(null,Ht)},useEffectEvent:function(s){var a=Vi(),c={impl:s};return a.memoizedState=c,function(){if((fn&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},$0={readContext:Ci,use:Lh,useCallback:G_,useContext:Ci,useEffect:P0,useImperativeHandle:V_,useInsertionEffect:F_,useLayoutEffect:B_,useMemo:q_,useReducer:Ph,useRef:I_,useState:function(){return Ph(ia)},useDebugValue:O0,useDeferredValue:function(s,a){var c=Xn();return W_(c,wn.memoizedState,s,a)},useTransition:function(){var s=Ph(ia)[0],a=Xn().memoizedState;return[typeof s=="boolean"?s:Au(s),a]},useSyncExternalStore:w_,useId:Z_,useHostTransitionStatus:I0,useFormState:O_,useActionState:O_,useOptimistic:function(s,a){var c=Xn();return M_(c,wn,s,a)},useMemoCache:A0,useCacheRefresh:Q_};$0.useEffectEvent=$_;var i2={readContext:Ci,use:Lh,useCallback:G_,useContext:Ci,useEffect:P0,useImperativeHandle:V_,useInsertionEffect:F_,useLayoutEffect:B_,useMemo:q_,useReducer:k0,useRef:I_,useState:function(){return k0(ia)},useDebugValue:O0,useDeferredValue:function(s,a){var c=Xn();return wn===null?D0(c,s,a):W_(c,wn.memoizedState,s,a)},useTransition:function(){var s=k0(ia)[0],a=Xn().memoizedState;return[typeof s=="boolean"?s:Au(s),a]},useSyncExternalStore:w_,useId:Z_,useHostTransitionStatus:I0,useFormState:U_,useActionState:U_,useOptimistic:function(s,a){var c=Xn();return wn!==null?M_(c,wn,s,a):(c.baseState=s,[s,c.queue.dispatch])},useMemoCache:A0,useCacheRefresh:Q_};i2.useEffectEvent=$_;function F0(s,a,c,f){a=s.memoizedState,c=c(f,a),c=c==null?a:g({},a,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var B0={enqueueSetState:function(s,a,c){s=s._reactInternals;var f=bs(),x=Fa(f);x.payload=a,c!=null&&(x.callback=c),a=Ba(s,x,f),a!==null&&(ns(a,s,f),Cu(a,s,f))},enqueueReplaceState:function(s,a,c){s=s._reactInternals;var f=bs(),x=Fa(f);x.tag=1,x.payload=a,c!=null&&(x.callback=c),a=Ba(s,x,f),a!==null&&(ns(a,s,f),Cu(a,s,f))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var c=bs(),f=Fa(c);f.tag=2,a!=null&&(f.callback=a),a=Ba(s,f,c),a!==null&&(ns(a,s,c),Cu(a,s,c))}};function s2(s,a,c,f,x,v,A){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(f,v,A):a.prototype&&a.prototype.isPureReactComponent?!xu(c,f)||!xu(x,v):!0}function r2(s,a,c,f){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,f),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,f),a.state!==s&&B0.enqueueReplaceState(a,a.state,null)}function Fo(s,a){var c=a;if("ref"in a){c={};for(var f in a)f!=="ref"&&(c[f]=a[f])}if(s=s.defaultProps){c===a&&(c=g({},c));for(var x in s)c[x]===void 0&&(c[x]=s[x])}return c}function a2(s){mh(s)}function o2(s){console.error(s)}function l2(s){mh(s)}function Ih(s,a){try{var c=s.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(f){setTimeout(function(){throw f})}}function c2(s,a,c){try{var f=s.onCaughtError;f(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function H0(s,a,c){return c=Fa(c),c.tag=3,c.payload={element:null},c.callback=function(){Ih(s,a)},c}function u2(s){return s=Fa(s),s.tag=3,s}function d2(s,a,c,f){var x=c.type.getDerivedStateFromError;if(typeof x=="function"){var v=f.value;s.payload=function(){return x(v)},s.callback=function(){c2(a,c,f)}}var A=c.stateNode;A!==null&&typeof A.componentDidCatch=="function"&&(s.callback=function(){c2(a,c,f),typeof x!="function"&&(Xa===null?Xa=new Set([this]):Xa.add(this));var B=f.stack;this.componentDidCatch(f.value,{componentStack:B!==null?B:""})})}function xT(s,a,c,f,x){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(a=c.alternate,a!==null&&jl(a,c,x,!0),c=ps.current,c!==null){switch(c.tag){case 31:case 13:return Is===null?Kh():c.alternate===null&&$n===0&&($n=3),c.flags&=-257,c.flags|=65536,c.lanes=x,f===Ch?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([f]):a.add(f),pg(s,f,x)),!1;case 22:return c.flags|=65536,f===Ch?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([f])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([f]):c.add(f)),pg(s,f,x)),!1}throw Error(i(435,c.tag))}return pg(s,f,x),Kh(),!1}if(tn)return a=ps.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,f!==l0&&(s=Error(i(422),{cause:f}),yu(Ps(s,c)))):(f!==l0&&(a=Error(i(423),{cause:f}),yu(Ps(a,c))),s=s.current.alternate,s.flags|=65536,x&=-x,s.lanes|=x,f=Ps(f,c),x=H0(s.stateNode,f,x),v0(s,x),$n!==4&&($n=2)),!1;var v=Error(i(520),{cause:f});if(v=Ps(v,c),zu===null?zu=[v]:zu.push(v),$n!==4&&($n=2),a===null)return!0;f=Ps(f,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,s=x&-x,c.lanes|=s,s=H0(c.stateNode,f,s),v0(c,s),!1;case 1:if(a=c.type,v=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Xa===null||!Xa.has(v))))return c.flags|=65536,x&=-x,c.lanes|=x,x=u2(x),d2(x,s,c,f),v0(c,x),!1}c=c.return}while(c!==null);return!1}var V0=Error(i(461)),si=!1;function Ni(s,a,c,f){a.child=s===null?m_(a,null,c,f):zo(a,s.child,c,f)}function h2(s,a,c,f,x){c=c.render;var v=a.ref;if("ref"in f){var A={};for(var B in f)B!=="ref"&&(A[B]=f[B])}else A=f;return Oo(a),f=C0(s,a,c,A,v,x),B=N0(),s!==null&&!si?(T0(s,a,x),sa(s,a,x)):(tn&&B&&a0(a),a.flags|=1,Ni(s,a,f,x),a.child)}function f2(s,a,c,f,x){if(s===null){var v=c.type;return typeof v=="function"&&!i0(v)&&v.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=v,p2(s,a,v,f,x)):(s=vh(c.type,null,f,a,a.mode,x),s.ref=a.ref,s.return=a,a.child=s)}if(v=s.child,!Q0(s,x)){var A=v.memoizedProps;if(c=c.compare,c=c!==null?c:xu,c(A,f)&&s.ref===a.ref)return sa(s,a,x)}return a.flags|=1,s=Qr(v,f),s.ref=a.ref,s.return=a,a.child=s}function p2(s,a,c,f,x){if(s!==null){var v=s.memoizedProps;if(xu(v,f)&&s.ref===a.ref)if(si=!1,a.pendingProps=f=v,Q0(s,x))(s.flags&131072)!==0&&(si=!0);else return a.lanes=s.lanes,sa(s,a,x)}return G0(s,a,c,f,x)}function m2(s,a,c,f){var x=f.children,v=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((a.flags&128)!==0){if(v=v!==null?v.baseLanes|c:c,s!==null){for(f=a.child=s.child,x=0;f!==null;)x=x|f.lanes|f.childLanes,f=f.sibling;f=x&~v}else f=0,a.child=null;return g2(s,a,v,c,f)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Sh(a,v!==null?v.cachePool:null),v!==null?b_(a,v):_0(),v_(a);else return f=a.lanes=536870912,g2(s,a,v!==null?v.baseLanes|c:c,c,f)}else v!==null?(Sh(a,v.cachePool),b_(a,v),Va(),a.memoizedState=null):(s!==null&&Sh(a,null),_0(),Va());return Ni(s,a,x,c),a.child}function ju(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function g2(s,a,c,f,x){var v=m0();return v=v===null?null:{parent:ni._currentValue,pool:v},a.memoizedState={baseLanes:c,cachePool:v},s!==null&&Sh(a,null),_0(),v_(a),s!==null&&jl(s,a,f,!0),a.childLanes=x,null}function zh(s,a){return a=Fh({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function x2(s,a,c){return zo(a,s.child,null,c),s=zh(a,a.pendingProps),s.flags|=2,ms(a),a.memoizedState=null,s}function bT(s,a,c){var f=a.pendingProps,x=(a.flags&128)!==0;
vendor: 4,167 bytes, line 9
9if(a.flags&=-129,s===null){if(tn){if(f.mode==="hidden")return s=zh(a,f),a.lanes=536870912,ju(null,s);if(S0(a),(s=jn)?(s=Aw(s,Us),s=s!==null&&s.data==="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:Da!==null?{id:wr,overflow:Sr}:null,retryLane:536870912,hydrationErrors:null},c=e_(s),c.return=a,a.child=c,Ei=a,jn=null)):s=null,s===null)throw Ia(a);return a.lanes=536870912,null}return zh(a,f)}var v=s.memoizedState;if(v!==null){var A=v.dehydrated;if(S0(a),x)if(a.flags&256)a.flags&=-257,a=x2(s,a,c);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(si||jl(s,a,c,!1),x=(c&s.childLanes)!==0,si||x){if(f=Tn,f!==null&&(A=Dn(f,c),A!==0&&A!==v.retryLane))throw v.retryLane=A,ko(s,A),ns(f,s,A),V0;Kh(),a=x2(s,a,c)}else s=v.treeContext,jn=zs(A.nextSibling),Ei=a,tn=!0,Ua=null,Us=!1,s!==null&&i_(a,s),a=zh(a,f),a.flags|=4096;return a}return s=Qr(s.child,{mode:f.mode,children:f.children}),s.ref=a.ref,a.child=s,s.return=a,s}function $h(s,a){var c=a.ref;if(c===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(s===null||s.ref!==c)&&(a.flags|=4194816)}}function G0(s,a,c,f,x){return Oo(a),c=C0(s,a,c,f,void 0,x),f=N0(),s!==null&&!si?(T0(s,a,x),sa(s,a,x)):(tn&&f&&a0(a),a.flags|=1,Ni(s,a,c,x),a.child)}function b2(s,a,c,f,x,v){return Oo(a),a.updateQueue=null,c=__(a,f,c,x),y_(s),f=N0(),s!==null&&!si?(T0(s,a,v),sa(s,a,v)):(tn&&f&&a0(a),a.flags|=1,Ni(s,a,c,v),a.child)}function v2(s,a,c,f,x){if(Oo(a),a.stateNode===null){var v=Ml,A=c.contextType;typeof A=="object"&&A!==null&&(v=Ci(A)),v=new c(f,v),a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=B0,a.stateNode=v,v._reactInternals=a,v=a.stateNode,v.props=f,v.state=a.memoizedState,v.refs={},x0(a),A=c.contextType,v.context=typeof A=="object"&&A!==null?Ci(A):Ml,v.state=a.memoizedState,A=c.getDerivedStateFromProps,typeof A=="function"&&(F0(a,c,A,f),v.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(A=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),A!==v.state&&B0.enqueueReplaceState(v,v.state,null),Tu(a,f,v,x),Nu(),v.state=a.memoizedState),typeof v.componentDidMount=="function"&&(a.flags|=4194308),f=!0}else if(s===null){v=a.stateNode;var B=a.memoizedProps,ee=Fo(c,B);v.props=ee;var ye=v.context,Re=c.contextType;A=Ml,typeof Re=="object"&&Re!==null&&(A=Ci(Re));var Ue=c.getDerivedStateFromProps;Re=typeof Ue=="function"||typeof v.getSnapshotBeforeUpdate=="function",B=a.pendingProps!==B,Re||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(B||ye!==A)&&r2(a,v,f,A),$a=!1;var _e=a.memoizedState;v.state=_e,Tu(a,f,v,x),Nu(),ye=a.memoizedState,B||_e!==ye||$a?(typeof Ue=="function"&&(F0(a,c,Ue,f),ye=a.memoizedState),(ee=$a||s2(a,c,ee,f,_e,ye,A))?(Re||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(a.flags|=4194308)):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=f,a.memoizedState=ye),v.props=f,v.state=ye,v.context=A,f=ee):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),f=!1)}else{v=a.stateNode,b0(s,a),A=a.memoizedProps,Re=Fo(c,A),v.props=Re,Ue=a.pendingProps,_e=v.context,ye=c.contextType,ee=Ml,typeof ye=="object"&&ye!==null&&(ee=Ci(ye)),B=c.getDerivedStateFromProps,(ye=typeof B=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(A!==Ue||_e!==ee)&&r2(a,v,f,ee),$a=!1,_e=a.memoizedState,v.state=_e,Tu(a,f,v,x),Nu();var Te=a.memoizedState;A!==Ue||_e!==Te||$a||s!==null&&s.dependencies!==null&&_h(s.dependencies)?(typeof B=="function"&&(F0(a,c,B,f),Te=a.memoizedState),(
vendor: 3,787 bytes, line 9
9Re=$a||s2(a,c,Re,f,_e,Te,ee)||s!==null&&s.dependencies!==null&&_h(s.dependencies))?(ye||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(f,Te,ee),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(f,Te,ee)),typeof v.componentDidUpdate=="function"&&(a.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof v.componentDidUpdate!="function"||A===s.memoizedProps&&_e===s.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||A===s.memoizedProps&&_e===s.memoizedState||(a.flags|=1024),a.memoizedProps=f,a.memoizedState=Te),v.props=f,v.state=Te,v.context=ee,f=Re):(typeof v.componentDidUpdate!="function"||A===s.memoizedProps&&_e===s.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||A===s.memoizedProps&&_e===s.memoizedState||(a.flags|=1024),f=!1)}return v=f,$h(s,a),f=(a.flags&128)!==0,v||f?(v=a.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:v.render(),a.flags|=1,s!==null&&f?(a.child=zo(a,s.child,null,x),a.child=zo(a,null,c,x)):Ni(s,a,c,x),a.memoizedState=v.state,s=a.child):s=sa(s,a,x),s}function y2(s,a,c,f){return Lo(),a.flags|=256,Ni(s,a,c,f),a.child}var q0={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function W0(s){return{baseLanes:s,cachePool:c_()}}function X0(s,a,c){return s=s!==null?s.childLanes&~c:0,a&&(s|=xs),s}function _2(s,a,c){var f=a.pendingProps,x=!1,v=(a.flags&128)!==0,A;if((A=v)||(A=s!==null&&s.memoizedState===null?!1:(Wn.current&2)!==0),A&&(x=!0,a.flags&=-129),A=(a.flags&32)!==0,a.flags&=-33,s===null){if(tn){if(x?Ha(a):Va(),(s=jn)?(s=Aw(s,Us),s=s!==null&&s.data!=="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:Da!==null?{id:wr,overflow:Sr}:null,retryLane:536870912,hydrationErrors:null},c=e_(s),c.return=a,a.child=c,Ei=a,jn=null)):s=null,s===null)throw Ia(a);return Rg(s)?a.lanes=32:a.lanes=536870912,null}var B=f.children;return f=f.fallback,x?(Va(),x=a.mode,B=Fh({mode:"hidden",children:B},x),f=jo(f,x,c,null),B.return=a,f.return=a,B.sibling=f,a.child=B,f=a.child,f.memoizedState=W0(c),f.childLanes=X0(s,A,c),a.memoizedState=q0,ju(null,f)):(Ha(a),Y0(a,B))}var ee=s.memoizedState;if(ee!==null&&(B=ee.dehydrated,B!==null)){if(v)a.flags&256?(Ha(a),a.flags&=-257,a=K0(s,a,c)):a.memoizedState!==null?(Va(),a.child=s.child,a.flags|=128,a=null):(Va(),B=f.fallback,x=a.mode,f=Fh({mode:"visible",children:f.children},x),B=jo(B,x,c,null),B.flags|=2,f.return=a,B.return=a,f.sibling=B,a.child=f,zo(a,s.child,null,c),f=a.child,f.memoizedState=W0(c),f.childLanes=X0(s,A,c),a.memoizedState=q0,a=ju(null,f));else if(Ha(a),Rg(B)){if(A=B.nextSibling&&B.nextSibling.dataset,A)var ye=A.dgst;A=ye,f=Error(i(419)),f.stack="",f.digest=A,yu({value:f,source:null,stack:null}),a=K0(s,a,c)}else if(si||jl(s,a,c,!1),A=(c&s.childLanes)!==0,si||A){if(A=Tn,A!==null&&(f=Dn(A,c),f!==0&&f!==ee.retryLane))throw ee.retryLane=f,ko(s,f),ns(A,s,f),V0;Ag(B)||Kh(),a=K0(s,a,c)}else Ag(B)?(a.flags|=192,a.child=s.child,a=null):(s=ee.treeContext,jn=zs(B.nextSibling),Ei=a,tn=!0,Ua=null,Us=!1,s!==null&&i_(a,s),a=Y0(a,f.children),a.flags|=4096);return a}return x?(Va(),B=f.fallback,x=a.mode,ee=s.child,ye=ee.sibling,f=Qr(ee,{mode:"hidden",children:f.children}),f.subtreeFlags=ee.subtreeFlags&65011712,ye!==null?B=Qr(ye,B):(B=jo(B,x,c,null),B.flags|=2),B.return=a,f.return=a,f.sibling=B,a.child=f,ju(null,f),f=a.child,B=s.child.memoizedState,B===null?B=W0(c):(x=B.cachePool,x!==null?(ee=ni._currentValue,x=x.parent!==ee?{parent:ee,pool:ee}:x):x=c_(),B={baseLanes:B.baseLanes|c,cachePool:x}),f.memoizedState=B,f.childLanes=X0(s,A,c),a.memoizedState=q0,ju(s.child,f)):(Ha(a),c=s.child,s=c.sibling,c=Qr(c,{mode:"visible",children:f.children}
vendor: 5,942 bytes, line 9
9),c.return=a,c.sibling=null,s!==null&&(A=a.deletions,A===null?(a.deletions=[s],a.flags|=16):A.push(s)),a.child=c,a.memoizedState=null,c)}function Y0(s,a){return a=Fh({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function Fh(s,a){return s=fs(22,s,null,a),s.lanes=0,s}function K0(s,a,c){return zo(a,s.child,null,c),s=Y0(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function w2(s,a,c){s.lanes|=a;var f=s.alternate;f!==null&&(f.lanes|=a),d0(s.return,a,c)}function Z0(s,a,c,f,x,v){var A=s.memoizedState;A===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:x,treeForkCount:v}:(A.isBackwards=a,A.rendering=null,A.renderingStartTime=0,A.last=f,A.tail=c,A.tailMode=x,A.treeForkCount=v)}function S2(s,a,c){var f=a.pendingProps,x=f.revealOrder,v=f.tail;f=f.children;var A=Wn.current,B=(A&2)!==0;if(B?(A=A&1|2,a.flags|=128):A&=1,Z(Wn,A),Ni(s,a,f,c),f=tn?vu:0,!B&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&w2(s,c,a);else if(s.tag===19)w2(s,c,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(x){case"forwards":for(c=a.child,x=null;c!==null;)s=c.alternate,s!==null&&Ah(s)===null&&(x=c),c=c.sibling;c=x,c===null?(x=a.child,a.child=null):(x=c.sibling,c.sibling=null),Z0(a,!1,x,c,v,f);break;case"backwards":case"unstable_legacy-backwards":for(c=null,x=a.child,a.child=null;x!==null;){if(s=x.alternate,s!==null&&Ah(s)===null){a.child=x;break}s=x.sibling,x.sibling=c,c=x,x=s}Z0(a,!0,c,null,v,f);break;case"together":Z0(a,!1,null,null,void 0,f);break;default:a.memoizedState=null}return a.child}function sa(s,a,c){if(s!==null&&(a.dependencies=s.dependencies),Wa|=a.lanes,(c&a.childLanes)===0)if(s!==null){if(jl(s,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,c=Qr(s,s.pendingProps),a.child=c,c.return=a;s.sibling!==null;)s=s.sibling,c=c.sibling=Qr(s,s.pendingProps),c.return=a;c.sibling=null}return a.child}function Q0(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&_h(s)))}function vT(s,a,c){switch(a.tag){case 3:de(a,a.stateNode.containerInfo),za(a,ni,s.memoizedState.cache),Lo();break;case 27:case 5:Le(a);break;case 4:de(a,a.stateNode.containerInfo);break;case 10:za(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,S0(a),null;break;case 13:var f=a.memoizedState;if(f!==null)return f.dehydrated!==null?(Ha(a),a.flags|=128,null):(c&a.child.childLanes)!==0?_2(s,a,c):(Ha(a),s=sa(s,a,c),s!==null?s.sibling:null);Ha(a);break;case 19:var x=(s.flags&128)!==0;if(f=(c&a.childLanes)!==0,f||(jl(s,a,c,!1),f=(c&a.childLanes)!==0),x){if(f)return S2(s,a,c);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),Z(Wn,Wn.current),f)break;return null;case 22:return a.lanes=0,m2(s,a,c,a.pendingProps);case 24:za(a,ni,s.memoizedState.cache)}return sa(s,a,c)}function E2(s,a,c){if(s!==null)if(s.memoizedProps!==a.pendingProps)si=!0;else{if(!Q0(s,c)&&(a.flags&128)===0)return si=!1,vT(s,a,c);si=(s.flags&131072)!==0}else si=!1,tn&&(a.flags&1048576)!==0&&n_(a,vu,a.index);switch(a.lanes=0,a.tag){case 16:e:{var f=a.pendingProps;if(s=Uo(a.elementType),a.type=s,typeof s=="function")i0(s)?(f=Fo(s,f),a.tag=1,a=v2(null,a,s,f,c)):(a.tag=0,a=G0(null,a,s,f,c));else{if(s!=null){var x=s.$$typeof;if(x===j){a.tag=11,a=h2(null,a,s,f,c);break e}else if(x===z){a.tag=14,a=f2(null,a,s,f,c);break e}}throw a=J(s)||s,Error(i(306,a,""))}}return a;case 0:return G0(s,a,a.type,a.pendingProps,c);case 1:return f=a.type,x=Fo(f,a.pendingProps),v2(s,a,f,x,c);case 3:e:{if(de(a,a.stateNode.containerInfo),s===null)throw Error(i(387));f=a.pendingProps;var v=a.memoizedState;x=v.element,b0(s,a),Tu(a,f,null,c);var A=a.memoizedState;if(f=A.cache,za(a,ni,f),f!==v.cache&&h0(a,[ni],c,!0),Nu(),f=A.element,v.isDehydrated)if(v={element:f,isDehydrated:!1,cache:A.cache},a.updateQueue.baseState=v,a.memoizedState=v,a.flags&256){a=y2(s,a,f,c);break e}else if(f!==x){x=Ps(Error(i(424)),a),yu(x),a=y2(s,a,f,c);break e}else for(s=a.stateNode.containerInfo,s.nodeType===9?s=s.body:s=s.nodeName==="HTML"?s.ownerDocument.body:s,jn=zs(s.firstChild),Ei=a,tn=!0,Ua=null,Us=!0,c=m_(a,null,f,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(Lo(),f===x){a=sa(s,a,c);break e}Ni(s,a,f,c)}a=a.child}return a;case 26:return $h(s,a),s===null?(c=Ow(a.type,null,a.pendingProps,null))?a.memoizedState=c:tn||(c=a.type,s=a.pendingProps,f=sf(le.current).createElement(c),f[xn]=a,f[Nn]=s,Ti(f,c,s),q(f),a.stateNode=f):a.memoizedState=Ow(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:return Le(a),s===null&&tn&&(f=a.stateNode=jw(a.type,a.pendingProps,le.current),Ei=a,Us=!0,x=jn,Qa(a.type)?(kg=x,jn=zs(f.firstChild)):jn=x),Ni(s,a,a.pendingProps.children,c),$h(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&tn&&((x=f=jn)&&(f=YT(f,a.type,a.pendingProps,Us),f!==null?(a.stateNode=f,Ei=a,jn=zs(f.firstChild),Us=!1,x=!0):x=!1),x||Ia(a)),Le(a),x=a.type,v=a.pendingProps,A=s!==null?s.memoizedProps:null,f=v.children,Ng(x,v)?f=null:A!==null&&Ng(x,A)&&(a.flags|=32),a.memoizedState!==null&&(x=C0(s,a,uT,null,null,c),Wu._currentValue=x),$h(s,a),Ni(s,a,f,c),a.child;case 6:return s===null&&tn&&((s=c=jn)&&(c=KT(c,a.pendingProps,Us),c!==null?(a.stateNode=c,Ei=a,jn=null,s=!0):s=!1),s||Ia(a)),null;case 13:return _2(s,a,c);case 4:return de(a,a.stateNode.containerInfo),f=a.pendingProps,s===null?a.child=zo(a,null,f,c):Ni(s,a,f,c),a.child;case 11:return h2(s,a,a.type,a.pendingProps,c);case 7:return Ni(s,a,a.pendingProps,c),a.child;case 8:return Ni(s,a,a.pendingProps.children,c),a.child;case 12:return Ni(s,a,a.pendingProps.children,c),a.child;case 10:return f=a.pendingProps,za(a,a.type,f.value),Ni(s,a,f.children,c),a.child;
vendor: 4,272 bytes, line 9
9case 9:return x=a.type._context,f=a.pendingProps.children,Oo(a),x=Ci(x),f=f(x),a.flags|=1,Ni(s,a,f,c),a.child;case 14:return f2(s,a,a.type,a.pendingProps,c);case 15:return p2(s,a,a.type,a.pendingProps,c);case 19:return S2(s,a,c);case 31:return bT(s,a,c);case 22:return m2(s,a,c,a.pendingProps);case 24:return Oo(a),f=Ci(ni),s===null?(x=m0(),x===null&&(x=Tn,v=f0(),x.pooledCache=v,v.refCount++,v!==null&&(x.pooledCacheLanes|=c),x=v),a.memoizedState={parent:f,cache:x},x0(a),za(a,ni,x)):((s.lanes&c)!==0&&(b0(s,a),Tu(a,null,null,c),Nu()),x=s.memoizedState,v=a.memoizedState,x.parent!==f?(x={parent:f,cache:f},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),za(a,ni,f)):(f=v.cache,za(a,ni,f),f!==x.cache&&h0(a,[ni],c,!0))),Ni(s,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function ra(s){s.flags|=4}function J0(s,a,c,f,x){if((a=(s.mode&32)!==0)&&(a=!1),a){if(s.flags|=16777216,(x&335544128)===x)if(s.stateNode.complete)s.flags|=8192;else if(Z2())s.flags|=8192;else throw Io=Ch,g0}else s.flags&=-16777217}function C2(s,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!$w(a))if(Z2())s.flags|=8192;else throw Io=Ch,g0}function Bh(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?Wt():536870912,s.lanes|=a,Vl|=a)}function Lu(s,a){if(!tn)switch(s.tailMode){case"hidden":a=s.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?s.tail=null:c.sibling=null;break;case"collapsed":c=s.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:f.sibling=null}}function Ln(s){var a=s.alternate!==null&&s.alternate.child===s.child,c=0,f=0;if(a)for(var x=s.child;x!==null;)c|=x.lanes|x.childLanes,f|=x.subtreeFlags&65011712,f|=x.flags&65011712,x.return=s,x=x.sibling;else for(x=s.child;x!==null;)c|=x.lanes|x.childLanes,f|=x.subtreeFlags,f|=x.flags,x.return=s,x=x.sibling;return s.subtreeFlags|=f,s.childLanes=c,a}function yT(s,a,c){var f=a.pendingProps;switch(o0(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ln(a),null;case 1:return Ln(a),null;case 3:return c=a.stateNode,f=null,s!==null&&(f=s.memoizedState.cache),a.memoizedState.cache!==f&&(a.flags|=2048),ta(ni),Me(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(s===null||s.child===null)&&(kl(a)?ra(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,c0())),Ln(a),null;case 26:var x=a.type,v=a.memoizedState;return s===null?(ra(a),v!==null?(Ln(a),C2(a,v)):(Ln(a),J0(a,x,null,f,c))):v?v!==s.memoizedState?(ra(a),Ln(a),C2(a,v)):(Ln(a),a.flags&=-16777217):(s=s.memoizedProps,s!==f&&ra(a),Ln(a),J0(a,x,s,f,c)),null;case 27:if(pe(a),c=le.current,x=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==f&&ra(a);else{if(!f){if(a.stateNode===null)throw Error(i(166));return Ln(a),null}s=Ee.current,kl(a)?s_(a):(s=jw(x,f,c),a.stateNode=s,ra(a))}return Ln(a),null;case 5:if(pe(a),x=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==f&&ra(a);else{if(!f){if(a.stateNode===null)throw Error(i(166));return Ln(a),null}if(v=Ee.current,kl(a))s_(a);else{var A=sf(le.current);switch(v){case 1:v=A.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:v=A.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":v=A.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":v=A.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":v=A.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof f.is=="string"?A.createElement("select",{is:f.is}):A.createElement("select"),f.multiple?v.multiple=!0:f.size&&(v.size=f.size);break;default:v=typeof f.is=="string"?A.createElement(x,{is:f.is}):A.createElement(x)}}v[xn]=a,v[Nn]=f;e:for(A=a.child;A!==null;){if(A.tag===5||A.tag===6)v.appendChild(A.stateNode);else if(A.tag!==4&&A.tag!==27&&A.child!==null){A.child.return=A,A=A.child;continue}if(A===a)break e;for(;A.sibling===null;){if(A.return===null||A.return===a)break e;A=A.return}A.sibling.return=A.return,A=A.sibling}a.stateNode=v;e:switch(Ti(v,x,f),x){case"button":case"input":case"select":case"textarea":f=!!f.autoF
vendor: 24,952 bytes, line 9
9ocus;break e;case"img":f=!0;break e;default:f=!1}f&&ra(a)}}return Ln(a),J0(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,c),null;case 6:if(s&&a.stateNode!=null)s.memoizedProps!==f&&ra(a);else{if(typeof f!="string"&&a.stateNode===null)throw Error(i(166));if(s=le.current,kl(a)){if(s=a.stateNode,c=a.memoizedProps,f=null,x=Ei,x!==null)switch(x.tag){case 27:case 5:f=x.memoizedProps}s[xn]=a,s=!!(s.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||_w(s.nodeValue,c)),s||Ia(a,!0)}else s=sf(s).createTextNode(f),s[xn]=a,a.stateNode=s}return Ln(a),null;case 31:if(c=a.memoizedState,s===null||s.memoizedState!==null){if(f=kl(a),c!==null){if(s===null){if(!f)throw Error(i(318));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));s[xn]=a}else Lo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ln(a),s=!1}else c=c0(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),s=!0;if(!s)return a.flags&256?(ms(a),a):(ms(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Ln(a),null;case 13:if(f=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(x=kl(a),f!==null&&f.dehydrated!==null){if(s===null){if(!x)throw Error(i(318));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(i(317));x[xn]=a}else Lo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ln(a),x=!1}else x=c0(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(ms(a),a):(ms(a),null)}return ms(a),(a.flags&128)!==0?(a.lanes=c,a):(c=f!==null,s=s!==null&&s.memoizedState!==null,c&&(f=a.child,x=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(x=f.alternate.memoizedState.cachePool.pool),v=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(v=f.memoizedState.cachePool.pool),v!==x&&(f.flags|=2048)),c!==s&&c&&(a.child.flags|=8192),Bh(a,a.updateQueue),Ln(a),null);case 4:return Me(),s===null&&_g(a.stateNode.containerInfo),Ln(a),null;case 10:return ta(a.type),Ln(a),null;case 19:if(H(Wn),f=a.memoizedState,f===null)return Ln(a),null;if(x=(a.flags&128)!==0,v=f.rendering,v===null)if(x)Lu(f,!1);else{if($n!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(v=Ah(s),v!==null){for(a.flags|=128,Lu(f,!1),s=v.updateQueue,a.updateQueue=s,Bh(a,s),a.subtreeFlags=0,s=c,c=a.child;c!==null;)Jy(c,s),c=c.sibling;return Z(Wn,Wn.current&1|2),tn&&Jr(a,f.treeForkCount),a.child}s=s.sibling}f.tail!==null&&k()>Wh&&(a.flags|=128,x=!0,Lu(f,!1),a.lanes=4194304)}else{if(!x)if(s=Ah(v),s!==null){if(a.flags|=128,x=!0,s=s.updateQueue,a.updateQueue=s,Bh(a,s),Lu(f,!0),f.tail===null&&f.tailMode==="hidden"&&!v.alternate&&!tn)return Ln(a),null}else 2*k()-f.renderingStartTime>Wh&&c!==536870912&&(a.flags|=128,x=!0,Lu(f,!1),a.lanes=4194304);f.isBackwards?(v.sibling=a.child,a.child=v):(s=f.last,s!==null?s.sibling=v:a.child=v,f.last=v)}return f.tail!==null?(s=f.tail,f.rendering=s,f.tail=s.sibling,f.renderingStartTime=k(),s.sibling=null,c=Wn.current,Z(Wn,x?c&1|2:c&1),tn&&Jr(a,f.treeForkCount),s):(Ln(a),null);case 22:case 23:return ms(a),w0(),f=a.memoizedState!==null,s!==null?s.memoizedState!==null!==f&&(a.flags|=8192):f&&(a.flags|=8192),f?(c&536870912)!==0&&(a.flags&128)===0&&(Ln(a),a.subtreeFlags&6&&(a.flags|=8192)):Ln(a),c=a.updateQueue,c!==null&&Bh(a,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),f=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),f!==c&&(a.flags|=2048),s!==null&&H(Do),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),ta(ni),Ln(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function _T(s,a){switch(o0(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return ta(ni),Me(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return pe(a),null;case 31:if(a.memoizedState!==null){if(ms(a),a.alternate===null)throw Error(i(340));Lo()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(ms(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));Lo()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return H(Wn),null;case 4:return Me(),null;case 10:return ta(a.type),null;case 22:case 23:return ms(a),w0(),s!==null&&H(Do),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return ta(ni),null;case 25:return null;default:return null}}function N2(s,a){switch(o0(a),a.tag){case 3:ta(ni),Me();break;case 26:case 27:case 5:pe(a);break;case 4:Me();break;case 31:a.memoizedState!==null&&ms(a);break;case 13:ms(a);break;case 19:H(Wn);break;case 10:ta(a.type);break;case 22:case 23:ms(a),w0(),s!==null&&H(Do);break;case 24:ta(ni)}}function Pu(s,a){try{var c=a.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var x=f.next;c=x;do{if((c.tag&s)===s){f=void 0;var v=c.create,A=c.inst;f=v(),A.destroy=f}c=c.next}while(c!==x)}}catch(B){vn(a,a.return,B)}}function Ga(s,a,c){try{var f=a.updateQueue,x=f!==null?f.lastEffect:null;if(x!==null){var v=x.next;f=v;do{if((f.tag&s)===s){var A=f.inst,B=A.destroy;if(B!==void 0){A.destroy=void 0,x=a;var ee=c,ye=B;try{ye()}catch(Re){vn(x,ee,Re)}}}f=f.next}while(f!==v)}}catch(Re){vn(a,a.return,Re)}}function T2(s){var a=s.updateQueue;if(a!==null){var c=s.stateNode;try{x_(a,c)}catch(f){vn(s,s.return,f)}}}function M2(s,a,c){c.props=Fo(s.type,s.memoizedProps),c.state=s.memoizedState;try{c.componentWillUnmount()}catch(f){vn(s,a,f)}}function Ou(s,a){try{var c=s.ref;if(c!==null){switch(s.tag){case 26:case 27:case 5:var f=s.stateNode;break;case 30:f=s.stateNode;break;default:f=s.stateNode}typeof c=="function"?s.refCleanup=c(f):c.current=f}}catch(x){vn(s,a,x)}}function Er(s,a){var c=s.ref,f=s.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(x){vn(s,a,x)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(x){vn(s,a,x)}else c.current=null}function A2(s){var a=s.type,c=s.memoizedProps,f=s.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&f.focus();break e;case"img":c.src?f.src=c.src:c.srcSet&&(f.srcset=c.srcSet)}}catch(x){vn(s,s.return,x)}}function eg(s,a,c){try{var f=s.stateNode;HT(f,s.type,c,a),f[Nn]=a}catch(x){vn(s,s.return,x)}}function R2(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Qa(s.type)||s.tag===4}function tg(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||R2(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Qa(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function ng(s,a,c){var f=s.tag;if(f===5||f===6)s=s.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(s,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(s),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=Kr));else if(f!==4&&(f===27&&Qa(s.type)&&(c=s.stateNode,a=null),s=s.child,s!==null))for(ng(s,a,c),s=s.sibling;s!==null;)ng(s,a,c),s=s.sibling}function Hh(s,a,c){var f=s.tag;if(f===5||f===6)s=s.stateNode,a?c.insertBefore(s,a):c.appendChild(s);else if(f!==4&&(f===27&&Qa(s.type)&&(c=s.stateNode),s=s.child,s!==null))for(Hh(s,a,c),s=s.sibling;s!==null;)Hh(s,a,c),s=s.sibling}function k2(s){var a=s.stateNode,c=s.memoizedProps;try{for(var f=s.type,x=a.attributes;x.length;)a.removeAttributeNode(x[0]);Ti(a,f,c),a[xn]=s,a[Nn]=c}catch(v){vn(s,s.return,v)}}var aa=!1,ri=!1,ig=!1,j2=typeof WeakSet=="function"?WeakSet:Set,yi=null;function wT(s,a){if(s=s.containerInfo,Eg=df,s=Vy(s),Km(s)){if("selectionStart"in s)var c={start:s.selectionStart,end:s.selectionEnd};else e:{c=(c=s.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var x=f.anchorOffset,v=f.focusNode;f=f.focusOffset;try{c.nodeType,v.nodeType}catch{c=null;break e}var A=0,B=-1,ee=-1,ye=0,Re=0,Ue=s,_e=null;t:for(;;){for(var Te;Ue!==c||x!==0&&Ue.nodeType!==3||(B=A+x),Ue!==v||f!==0&&Ue.nodeType!==3||(ee=A+f),Ue.nodeType===3&&(A+=Ue.nodeValue.length),(Te=Ue.firstChild)!==null;)_e=Ue,Ue=Te;for(;;){if(Ue===s)break t;if(_e===c&&++ye===x&&(B=A),_e===v&&++Re===f&&(ee=A),(Te=Ue.nextSibling)!==null)break;Ue=_e,_e=Ue.parentNode}Ue=Te}c=B===-1||ee===-1?null:{start:B,end:ee}}else c=null}c=c||{start:0,end:0}}else c=null;for(Cg={focusedElem:s,selectionRange:c},df=!1,yi=a;yi!==null;)if(a=yi,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,yi=s;else for(;yi!==null;){switch(a=yi,v=a.alternate,s=a.flags,a.tag){case 0:if((s&4)!==0&&(s=a.updateQueue,s=s!==null?s.events:null,s!==null))for(c=0;c<s.length;c++)x=s[c],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&v!==null){s=void 0,c=a,x=v.memoizedProps,v=v.memoizedState,f=c.stateNode;try{var ft=Fo(c.type,x);s=f.getSnapshotBeforeUpdate(ft,v),f.__reactInternalSnapshotBeforeUpdate=s}catch(jt){vn(c,c.return,jt)}}break;case 3:if((s&1024)!==0){if(s=a.stateNode.containerInfo,c=s.nodeType,c===9)Mg(s);else if(c===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Mg(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(i(163))}if(s=a.sibling,s!==null){s.return=a.return,yi=s;break}yi=a.return}}function L2(s,a,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:la(s,c),f&4&&Pu(5,c);break;case 1:if(la(s,c),f&4)if(s=c.stateNode,a===null)try{s.componentDidMount()}catch(A){vn(c,c.return,A)}else{var x=Fo(c.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(x,a,s.__reactInternalSnapshotBeforeUpdate)}catch(A){vn(c,c.return,A)}}f&64&&T2(c),f&512&&Ou(c,c.return);break;case 3:if(la(s,c),f&64&&(s=c.updateQueue,s!==null)){if(a=null,c.child!==null)switch(c.child.tag){case 27:case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}try{x_(s,a)}catch(A){vn(c,c.return,A)}}break;case 27:a===null&&f&4&&k2(c);case 26:case 5:la(s,c),a===null&&f&4&&A2(c),f&512&&Ou(c,c.return);break;case 12:la(s,c);break;case 31:la(s,c),f&4&&D2(s,c);break;case 13:la(s,c),f&4&&U2(s,c),f&64&&(s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(c=kT.bind(null,c),ZT(s,c))));break;case 22:if(f=c.memoizedState!==null||aa,!f){a=a!==null&&a.memoizedState!==null||ri,x=aa;var v=ri;aa=f,(ri=a)&&!v?ca(s,c,(c.subtreeFlags&8772)!==0):la(s,c),aa=x,ri=v}break;case 30:break;default:la(s,c)}}function P2(s){var a=s.alternate;a!==null&&(s.alternate=null,P2(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&He(a)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var Un=null,Qi=!1;function oa(s,a,c){for(c=c.child;c!==null;)O2(s,a,c),c=c.sibling}function O2(s,a,c){if(oe&&typeof oe.onCommitFiberUnmount=="function")try{oe.onCommitFiberUnmount(X,c)}catch{}switch(c.tag){case 26:ri||Er(c,a),oa(s,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:ri||Er(c,a);var f=Un,x=Qi;Qa(c.type)&&(Un=c.stateNode,Qi=!1),oa(s,a,c),Vu(c.stateNode),Un=f,Qi=x;break;case 5:ri||Er(c,a);case 6:if(f=Un,x=Qi,Un=null,oa(s,a,c),Un=f,Qi=x,Un!==null)if(Qi)try{(Un.nodeType===9?Un.body:Un.nodeName==="HTML"?Un.ownerDocument.body:Un).removeChild(c.stateNode)}catch(v){vn(c,a,v)}else try{Un.removeChild(c.stateNode)}catch(v){vn(c,a,v)}break;case 18:Un!==null&&(Qi?(s=Un,Tw(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,c.stateNode),Ql(s)):Tw(Un,c.stateNode));break;case 4:f=Un,x=Qi,Un=c.stateNode.containerInfo,Qi=!0,oa(s,a,c),Un=f,Qi=x;break;case 0:case 11:case 14:case 15:Ga(2,c,a),ri||Ga(4,c,a),oa(s,a,c);break;case 1:ri||(Er(c,a),f=c.stateNode,typeof f.componentWillUnmount=="function"&&M2(c,a,f)),oa(s,a,c);break;case 21:oa(s,a,c);break;case 22:ri=(f=ri)||c.memoizedState!==null,oa(s,a,c),ri=f;break;default:oa(s,a,c)}}function D2(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Ql(s)}catch(c){vn(a,a.return,c)}}}function U2(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Ql(s)}catch(c){vn(a,a.return,c)}}function ST(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new j2),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new j2),a;default:throw Error(i(435,s.tag))}}function Vh(s,a){var c=ST(s);a.forEach(function(f){if(!c.has(f)){c.add(f);var x=jT.bind(null,s,f);f.then(x,x)}})}function Ji(s,a){var c=a.deletions;if(c!==null)for(var f=0;f<c.length;f++){var x=c[f],v=s,A=a,B=A;e:for(;B!==null;){switch(B.tag){case 27:if(Qa(B.type)){Un=B.stateNode,Qi=!1;break e}break;case 5:Un=B.stateNode,Qi=!1;break e;case 3:case 4:Un=B.stateNode.containerInfo,Qi=!0;break e}B=B.return}if(Un===null)throw Error(i(160));O2(v,A,x),Un=null,Qi=!1,v=x.alternate,v!==null&&(v.return=null),x.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)I2(a,s),a=a.sibling}var er=null;function I2(s,a){var c=s.alternate,f=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Ji(a,s),es(s),f&4&&(Ga(3,s,s.return),Pu(3,s),Ga(5,s,s.return));break;case 1:Ji(a,s),es(s),f&512&&(ri||c===null||Er(c,c.return)),f&64&&aa&&(s=s.updateQueue,s!==null&&(f=s.callbacks,f!==null&&(c=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var x=er;if(Ji(a,s),es(s),f&512&&(ri||c===null||Er(c,c.return)),f&4){var v=c!==null?c.memoizedState:null;if(f=s.memoizedState,c===null)if(f===null)if(s.stateNode===null){e:{f=s.type,c=s.memoizedProps,x=x.ownerDocument||x;t:switch(f){case"title":v=x.getElementsByTagName("title")[0],(!v||v[we]||v[xn]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=x.createElement(f),x.head.insertBefore(v,x.querySelector("head > title"))),Ti(v,f,c),v[xn]=s,q(v),f=v;break e;case"link":var A=Iw("link","href",x).get(f+(c.href||""));if(A){for(var B=0;B<A.length;B++)if(v=A[B],v.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&v.getAttribute("rel")===(c.rel==null?null:c.rel)&&v.getAttribute("title")===(c.title==null?null:c.title)&&v.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){A.splice(B,1);break t}}v=x.createElement(f),Ti(v,f,c),x.head.appendChild(v);break;case"meta":if(A=Iw("meta","content",x).get(f+(c.content||""))){for(B=0;B<A.length;B++)if(v=A[B],v.getAttribute("content")===(c.content==null?null:""+c.content)&&v.getAttribute("name")===(c.name==null?null:c.name)&&v.getAttribute("property")===(c.property==null?null:c.property)&&v.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&v.getAttribute("charset")===(c.charSet==null?null:c.charSet)){A.splice(B,1);break t}}v=x.createElement(f),Ti(v,f,c),x.head.appendChild(v);break;default:throw Error(i(468,f))}v[xn]=s,q(v),f=v}s.stateNode=f}else zw(x,s.type,s.stateNode);else s.stateNode=Uw(x,f,s.memoizedProps);else v!==f?(v===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):v.count--,f===null?zw(x,s.type,s.stateNode):Uw(x,f,s.memoizedProps)):f===null&&s.stateNode!==null&&eg(s,s.memoizedProps,c.memoizedProps)}break;case 27:Ji(a,s),es(s),f&512&&(ri||c===null||Er(c,c.return)),c!==null&&f&4&&eg(s,s.memoizedProps,c.memoizedProps);break;case 5:if(Ji(a,s),es(s),f&512&&(ri||c===null||Er(c,c.return)),s.flags&32){x=s.stateNode;try{Hi(x,"")}catch(ft){vn(s,s.return,ft)}}f&4&&s.stateNode!=null&&(x=s.memoizedProps,eg(s,x,c!==null?c.memoizedProps:x)),f&1024&&(ig=!0);break;case 6:if(Ji(a,s),es(s),f&4){if(s.stateNode===null)throw Error(i(162));f=s.memoizedProps,c=s.stateNode;try{c.nodeValue=f}catch(ft){vn(s,s.return,ft)}}break;case 3:if(of=null,x=er,er=rf(a.containerInfo),Ji(a,s),er=x,es(s),f&4&&c!==null&&c.memoizedState.isDehydrated)try{Ql(a.containerInfo)}catch(ft){vn(s,s.return,ft)}ig&&(ig=!1,z2(s));break;case 4:f=er,er=rf(s.stateNode.containerInfo),Ji(a,s),es(s),er=f;break;case 12:Ji(a,s),es(s);break;case 31:Ji(a,s),es(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Vh(s,f)));break;case 13:Ji(a,s),es(s),s.child.flags&8192&&s.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(qh=k()),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Vh(s,f)));break;case 22:x=s.memoizedState!==null;var ee=c!==null&&c.memoizedState!==null,ye=aa,Re=ri;if(aa=ye||x,ri=Re||ee,Ji(a,s),ri=Re,aa=ye,es(s),f&8192)e:for(a=s.stateNode,a._visibility=x?a._visibility&-2:a._visibility|1,x&&(c===null||ee||aa||ri||Bo(s)),c=null,a=s;;){if(a.tag===5||a.tag===26){if(c===null){ee=c=a;try{if(v=ee.stateNode,x)A=v.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none";else{B=ee.stateNode;var Ue=ee.memoizedProps.style,_e=Ue!=null&&Ue.hasOwnProperty("display")?Ue.display:null;B.style.display=_e==null||typeof _e=="boolean"?"":(""+_e).trim()}}catch(ft){vn(ee,ee.return,ft)}}}else if(a.tag===6){if(c===null){ee=a;try{ee.stateNode.nodeValue=x?"":ee.memoizedProps}catch(ft){vn(ee,ee.return,ft)}}}else if(a.tag===18){if(c===null){ee=a;try{var Te=ee.stateNode;x?Mw(Te,!0):Mw(ee.stateNode,!1)}catch(ft){vn(ee,ee.return,ft)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===s)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break e;for(;a.sibling===null;){if(a.return===null||a.return===s)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}f&4&&(f=s.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,Vh(s,c))));break;case 19:Ji(a,s),es(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,Vh(s,f)));break;case 30:break;case 21:break;default:Ji(a,s),es(s)}}function es(s){var a=s.flags;if(a&2){try{for(var c,f=s.return;f!==null;){if(R2(f)){c=f;break}f=f.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var x=c.stateNode,v=tg(s);Hh(s,v,x);break;case 5:var A=c.stateNode;c.flags&32&&(Hi(A,""),c.flags&=-33);var B=tg(s);Hh(s,B,A);break;case 3:case 4:var ee=c.stateNode.containerInfo,ye=tg(s);ng(s,ye,ee);break;default:throw Error(i(161))}}catch(Re){vn(s,s.return,Re)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function z2(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;z2(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),s=s.sibling}}function la(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)L2(s,a.alternate,a),a=a.sibling}function Bo(s){for(s=s.child;s!==null;){var a=s;switch(a.tag){case 0:case 11:case 14:case 15:Ga(4,a,a.return),Bo(a);break;case 1:Er(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&M2(a,a.return,c),Bo(a);break;case 27:Vu(a.stateNode);case 26:case 5:Er(a,a.return),Bo(a);break;case 22:a.memoizedState===null&&Bo(a);break;case 30:Bo(a);break;default:Bo(a)}s=s.sibling}}function ca(s,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var f=a.alternate,x=s,v=a,A=v.flags;switch(v.tag){case 0:case 11:case 15:ca(x,v,c),Pu(4,v);break;case 1:if(ca(x,v,c),f=v,x=f.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(ye){vn(f,f.return,ye)}if(f=v,x=f.updateQueue,x!==null){var B=f.stateNode;try{var ee=x.shared.hiddenCallbacks;if(ee!==null)for(x.shared.hiddenCallbacks=null,x=0;x<ee.length;x++)g_(ee[x],B)}catch(ye){vn(f,f.return,ye)}}c&&A&64&&T2(v),Ou(v,v.return);break;case 27:k2(v);case 26:case 5:ca(x,v,c),c&&f===null&&A&4&&A2(v),Ou(v,v.return);break;case 12:ca(x,v,c);break;case 31:ca(x,v,c),c&&A&4&&D2(x,v);break;case 13:ca(x,v,c),c&&A&4&&U2(x,v);break;case 22:v.memoizedState===null&&ca(x,v,c),Ou(v,v.return);break;case 30:break;default:ca(x,v,c)}a=a.sibling}}function sg(s,a){var c=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),s=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(s=a.memoizedState.cachePool.pool),s!==c&&(s!=null&&s.refCount++,c!=null&&_u(c))}function rg(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&_u(s))}function tr(s,a,c,f){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)$2(s,a,c,f),a=a.sibling}function $2(s,a,c,f){var x=a.flags;switch(a.tag){case 0:case 11:case 15:tr(s,a,c,f),x&2048&&Pu(9,a);break;case 1:tr(s,a,c,f);break;case 3:tr(s,a,c,f),x&2048&&(s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&_u(s)));break;case 12:if(x&2048){tr(s,a,c,f),s=a.stateNode;try{var v=a.memoizedProps,A=v.id,B=v.onPostCommit;typeof B=="function"&&B(A,a.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(ee){vn(a,a.return,ee)}}else tr(s,a,c,f);break;case 31:tr(s,a,c,f);break;case 13:tr(s,a,c,f);break;case 23:break;case 22:v=a.stateNode,A=a.alternate,a.memoizedState!==null?v._visibility&2?tr(s,a,c,f):Du(s,a):v._visibility&2?tr(s,a,c,f):(v._visibility|=2,Fl(s,a,c,f,(a.subtreeFlags&10256)!==0||!1)),x&2048&&sg(A,a);break;case 24:tr(s,a,c,f),x&2048&&rg(a.alternate,a);break;default:tr(s,a,c,f)}}function Fl(s,a,c,f,x){for(x=x&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var v=s,A=a,B=c,ee=f,ye=A.flags;switch(A.tag){case 0:case 11:case 15:Fl(v,A,B,ee,x),Pu(8,A);break;case 23:break;case 22:var Re=A.stateNode;A.memoizedState!==null?Re._visibility&2?Fl(v,A,B,ee,x):Du(v,A):(Re._visibility|=2,Fl(v,A,B,ee,x)),x&&ye&2048&&sg(A.alternate,A);break;case 24:Fl(v,A,B,ee,x),x&&ye&2048&&rg(A.alternate,A);break;default:Fl(v,A,B,ee,x)}a=a.sibling}}function Du(s,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=s,f=a,x=f.flags;switch(f.tag){case 22:Du(c,f),x&2048&&sg(f.alternate,f);break;case 24:Du(c,f),x&2048&&rg(f.alternate,f);break;default:Du(c,f)}a=a.sibling}}var Uu=8192;function Bl(s,a,c){if(s.subtreeFlags&Uu)for(s=s.child;s!==null;)F2(s,a,c),s=s.sibling}function F2(s,a,c){switch(s.tag){case 26:Bl(s,a,c),s.flags&Uu&&s.memoizedState!==null&&cM(c,er,s.memoizedState,s.memoizedProps);break;case 5:Bl(s,a,c);break;case 3:case 4:var f=er;er=rf(s.stateNode.containerInfo),Bl(s,a,c),er=f;break;case 22:s.memoizedState===null&&(f=s.alternate,f!==null&&f.memoizedState!==null?(f=Uu,Uu=16777216,Bl(s,a,c),Uu=f):Bl(s,a,c));break;default:Bl(s,a,c)}}function B2(s){var a=s.alternate;if(a!==null&&(s=a.child,s!==null)){a.child=null;do a=s.sibling,s.sibling=null,s=a;while(s!==null)}}function Iu(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];yi=f,V2(f,s)}B2(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)H2(s),s=s.sibling}function H2(s){switch(s.tag){case 0:case 11:case 15:Iu(s),s.flags&2048&&Ga(9,s,s.return);break;case 3:Iu(s);break;case 12:Iu(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,Gh(s)):Iu(s);break;default:Iu(s)}}function Gh(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];yi=f,V2(f,s)}B2(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:Ga(8,a,a.return),Gh(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,Gh(a));break;default:Gh(a)}s=s.sibling}}function V2(s,a){for(;yi!==null;){var c=yi;switch(c.tag){case 0:case 11:case 15:Ga(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var f=c.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:_u(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,yi=f;else e:for(c=s;yi!==null;){f=yi;var x=f.sibling,v=f.return;if(P2(f),f===c){yi=null;break e}if(x!==null){x.return=v,yi=x;break e}yi=v}}}var ET={getCacheForType:function(s){var a=Ci(ni),c=a.data.get(s);return c===void 0&&(c=s(),a.data.set(s,c)),c},cacheSignal:function(){return Ci(ni).controller.signal}},CT=typeof WeakMap=="function"?WeakMap:Map,fn=0,Tn=null,Kt=null,Jt=0,bn=0,gs=null,qa=!1,Hl=!1,ag=!1,ua=0,$n=0,Wa=0,Ho=0,og=0,xs=0,Vl=0,zu=null,ts=null,lg=!1,qh=0,G2=0,Wh=1/0,Xh=null,Xa=null,fi=0,Ya=null,Gl=null,da=0,cg=0,ug=null,q2=null,$u=0,dg=null;function bs(){return(fn&2)!==0&&Jt!==0?Jt&-Jt:$.T!==null?xg():qn()}function W2(){if(xs===0)if((Jt&536870912)===0||tn){var s=Pe;Pe<<=1,(Pe&3932160)===0&&(Pe=262144),xs=s}else xs=536870912;return s=ps.current,s!==null&&(s.flags|=32),xs}function ns(s,a,c){(s===Tn&&(bn===2||bn===9)||s.cancelPendingCommit!==null)&&(ql(s,0),Ka(s,Jt,xs,!1)),Ge(s,c),((fn&2)===0||s!==Tn)&&(s===Tn&&((fn&2)===0&&(Ho|=c),$n===4&&Ka(s,Jt,xs,!1)),Cr(s))}function X2(s,a,c){if((fn&6)!==0)throw Error(i(327));var f=!c&&(a&127)===0&&(a&s.expiredLanes)===0||Ye(s,a),x=f?MT(s,a):fg(s,a,!0),v=f;do{if(x===0){Hl&&!f&&Ka(s,a,0,!1);break}else{if(c=s.current.alternate,v&&!NT(c)){x=fg(s,a,!1),v=!1;continue}if(x===2){if(v=a,s.errorRecoveryDisabledLanes&v)var A=0;else A=s.pendingLanes&-536870913,A=A!==0?A:A&536870912?536870912:0;if(A!==0){a=A;e:{var B=s;x=zu;var ee=B.current.memoizedState.isDehydrated;
vendor: 3,884 bytes, line 9
9if(ee&&(ql(B,A).flags|=256),A=fg(B,A,!1),A!==2){if(ag&&!ee){B.errorRecoveryDisabledLanes|=v,Ho|=v,x=4;break e}v=ts,ts=x,v!==null&&(ts===null?ts=v:ts.push.apply(ts,v))}x=A}if(v=!1,x!==2)continue}}if(x===1){ql(s,0),Ka(s,a,0,!0);break}e:{switch(f=s,v=x,v){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:Ka(f,a,xs,!qa);break e;case 2:ts=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(x=qh+300-k(),10<x)){if(Ka(f,a,xs,!qa),ge(f,0,!0)!==0)break e;da=a,f.timeoutHandle=Cw(Y2.bind(null,f,c,ts,Xh,lg,a,xs,Ho,Vl,qa,v,"Throttled",-0,0),x);break e}Y2(f,c,ts,Xh,lg,a,xs,Ho,Vl,qa,v,null,-0,0)}}break}while(!0);Cr(s)}function Y2(s,a,c,f,x,v,A,B,ee,ye,Re,Ue,_e,Te){if(s.timeoutHandle=-1,Ue=a.subtreeFlags,Ue&8192||(Ue&16785408)===16785408){Ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Kr},F2(a,v,Ue);var ft=(v&62914560)===v?qh-k():(v&4194048)===v?G2-k():0;if(ft=uM(Ue,ft),ft!==null){da=v,s.cancelPendingCommit=ft(iw.bind(null,s,a,v,c,f,x,A,B,ee,Re,Ue,null,_e,Te)),Ka(s,v,A,!ye);return}}iw(s,a,v,c,f,x,A,B,ee)}function NT(s){for(var a=s;;){var c=a.tag;if((c===0||c===11||c===15)&&a.flags&16384&&(c=a.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var f=0;f<c.length;f++){var x=c[f],v=x.getSnapshot;x=x.value;try{if(!hs(v(),x))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Ka(s,a,c,f){a&=~og,a&=~Ho,s.suspendedLanes|=a,s.pingedLanes&=~a,f&&(s.warmLanes|=a),f=s.expirationTimes;for(var x=a;0<x;){var v=31-Ae(x),A=1<<v;f[v]=-1,x&=~A}c!==0&&rn(s,c,a)}function Yh(){return(fn&6)===0?(Fu(0),!1):!0}function hg(){if(Kt!==null){if(bn===0)var s=Kt.return;else s=Kt,ea=Po=null,M0(s),Dl=null,Su=0,s=Kt;for(;s!==null;)N2(s.alternate,s),s=s.return;Kt=null}}function ql(s,a){var c=s.timeoutHandle;c!==-1&&(s.timeoutHandle=-1,qT(c)),c=s.cancelPendingCommit,c!==null&&(s.cancelPendingCommit=null,c()),da=0,hg(),Tn=s,Kt=c=Qr(s.current,null),Jt=a,bn=0,gs=null,qa=!1,Hl=Ye(s,a),ag=!1,Vl=xs=og=Ho=Wa=$n=0,ts=zu=null,lg=!1,(a&8)!==0&&(a|=a&32);var f=s.entangledLanes;if(f!==0)for(s=s.entanglements,f&=a;0<f;){var x=31-Ae(f),v=1<<x;a|=s[x],f&=~v}return ua=a,gh(),c}function K2(s,a){Ht=null,$.H=ku,a===Ol||a===Eh?(a=h_(),bn=3):a===g0?(a=h_(),bn=4):bn=a===V0?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,gs=a,Kt===null&&($n=1,Ih(s,Ps(a,s.current)))}function Z2(){var s=ps.current;return s===null?!0:(Jt&4194048)===Jt?Is===null:(Jt&62914560)===Jt||(Jt&536870912)!==0?s===Is:!1}function Q2(){var s=$.H;return $.H=ku,s===null?ku:s}function J2(){var s=$.A;return $.A=ET,s}function Kh(){$n=4,qa||(Jt&4194048)!==Jt&&ps.current!==null||(Hl=!0),(Wa&134217727)===0&&(Ho&134217727)===0||Tn===null||Ka(Tn,Jt,xs,!1)}function fg(s,a,c){var f=fn;fn|=2;var x=Q2(),v=J2();(Tn!==s||Jt!==a)&&(Xh=null,ql(s,a)),a=!1;var A=$n;e:do try{if(bn!==0&&Kt!==null){var B=Kt,ee=gs;switch(bn){case 8:hg(),A=6;break e;case 3:case 2:case 9:case 6:ps.current===null&&(a=!0);var ye=bn;if(bn=0,gs=null,Wl(s,B,ee,ye),c&&Hl){A=0;break e}break;default:ye=bn,bn=0,gs=null,Wl(s,B,ee,ye)}}TT(),A=$n;break}catch(Re){K2(s,Re)}while(!0);return a&&s.shellSuspendCounter++,ea=Po=null,fn=f,$.H=x,$.A=v,Kt===null&&(Tn=null,Jt=0,gh()),A}function TT(){for(;Kt!==null;)ew(Kt)}function MT(s,a){var c=fn;fn|=2;var f=Q2(),x=J2();Tn!==s||Jt!==a?(Xh=null,Wh=k()+500,ql(s,a)):Hl=Ye(s,a);e:do try{if(bn!==0&&Kt!==null){a=Kt;var v=gs;t:switch(bn){case 1:bn=0,gs=null,Wl(s,a,v,1);break;case 2:case 9:if(u_(v)){bn=0,gs=null,tw(a);break}a=function(){bn!==2&&bn!==9||Tn!==s||(bn=7),Cr(s)},v.then(a,a);break e;case 3:bn=7;break e;case 4:bn=5;break e;case 7:u_(v)?(bn=0,gs=null,tw(a)):(bn=0,gs=null,Wl(s,a,v,7));break;case 5:var A=null;
vendor: 1,592 bytes, line 9
9switch(Kt.tag){case 26:A=Kt.memoizedState;case 5:case 27:var B=Kt;if(A?$w(A):B.stateNode.complete){bn=0,gs=null;var ee=B.sibling;if(ee!==null)Kt=ee;else{var ye=B.return;ye!==null?(Kt=ye,Zh(ye)):Kt=null}break t}}bn=0,gs=null,Wl(s,a,v,5);break;case 6:bn=0,gs=null,Wl(s,a,v,6);break;case 8:hg(),$n=6;break e;default:throw Error(i(462))}}AT();break}catch(Re){K2(s,Re)}while(!0);return ea=Po=null,$.H=f,$.A=x,fn=c,Kt!==null?0:(Tn=null,Jt=0,gh(),$n)}function AT(){for(;Kt!==null&&!nt();)ew(Kt)}function ew(s){var a=E2(s.alternate,s,ua);s.memoizedProps=s.pendingProps,a===null?Zh(s):Kt=a}function tw(s){var a=s,c=a.alternate;switch(a.tag){case 15:case 0:a=b2(c,a,a.pendingProps,a.type,void 0,Jt);break;case 11:a=b2(c,a,a.pendingProps,a.type.render,a.ref,Jt);break;case 5:M0(a);default:N2(c,a),a=Kt=Jy(a,ua),a=E2(c,a,ua)}s.memoizedProps=s.pendingProps,a===null?Zh(s):Kt=a}function Wl(s,a,c,f){ea=Po=null,M0(a),Dl=null,Su=0;var x=a.return;try{if(xT(s,x,a,c,Jt)){$n=1,Ih(s,Ps(c,s.current)),Kt=null;return}}catch(v){if(x!==null)throw Kt=x,v;$n=1,Ih(s,Ps(c,s.current)),Kt=null;return}a.flags&32768?(tn||f===1?s=!0:Hl||(Jt&536870912)!==0?s=!1:(qa=s=!0,(f===2||f===9||f===3||f===6)&&(f=ps.current,f!==null&&f.tag===13&&(f.flags|=16384))),nw(a,s)):Zh(a)}function Zh(s){var a=s;do{if((a.flags&32768)!==0){nw(a,qa);return}s=a.return;var c=yT(a.alternate,a,ua);if(c!==null){Kt=c;return}if(a=a.sibling,a!==null){Kt=a;return}Kt=a=s}while(a!==null);$n===0&&($n=5)}function nw(s,a){do{var c=_T(s.alternate,s);if(c!==null){c.flags&=32767,Kt=c;return}if(c=s.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deleti
vendor: 15,171 bytes, line 9
9ons=null),!a&&(s=s.sibling,s!==null)){Kt=s;return}Kt=s=c}while(s!==null);$n=6,Kt=null}function iw(s,a,c,f,x,v,A,B,ee){s.cancelPendingCommit=null;do Qh();while(fi!==0);if((fn&6)!==0)throw Error(i(327));if(a!==null){if(a===s.current)throw Error(i(177));if(v=a.lanes|a.childLanes,v|=t0,vt(s,c,v,A,B,ee),s===Tn&&(Kt=Tn=null,Jt=0),Gl=a,Ya=s,da=c,cg=v,ug=x,q2=f,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,LT(xe,function(){return lw(),null})):(s.callbackNode=null,s.callbackPriority=0),f=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||f){f=$.T,$.T=null,x=V.p,V.p=2,A=fn,fn|=4;try{wT(s,a,c)}finally{fn=A,V.p=x,$.T=f}}fi=1,sw(),rw(),aw()}}function sw(){if(fi===1){fi=0;var s=Ya,a=Gl,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=$.T,$.T=null;var f=V.p;V.p=2;var x=fn;fn|=4;try{I2(a,s);var v=Cg,A=Vy(s.containerInfo),B=v.focusedElem,ee=v.selectionRange;if(A!==B&&B&&B.ownerDocument&&Hy(B.ownerDocument.documentElement,B)){if(ee!==null&&Km(B)){var ye=ee.start,Re=ee.end;if(Re===void 0&&(Re=ye),"selectionStart"in B)B.selectionStart=ye,B.selectionEnd=Math.min(Re,B.value.length);else{var Ue=B.ownerDocument||document,_e=Ue&&Ue.defaultView||window;if(_e.getSelection){var Te=_e.getSelection(),ft=B.textContent.length,jt=Math.min(ee.start,ft),En=ee.end===void 0?jt:Math.min(ee.end,ft);!Te.extend&&jt>En&&(A=En,En=jt,jt=A);var he=By(B,jt),ie=By(B,En);if(he&&ie&&(Te.rangeCount!==1||Te.anchorNode!==he.node||Te.anchorOffset!==he.offset||Te.focusNode!==ie.node||Te.focusOffset!==ie.offset)){var ve=Ue.createRange();ve.setStart(he.node,he.offset),Te.removeAllRanges(),jt>En?(Te.addRange(ve),Te.extend(ie.node,ie.offset)):(ve.setEnd(ie.node,ie.offset),Te.addRange(ve))}}}}for(Ue=[],Te=B;Te=Te.parentNode;)Te.nodeType===1&&Ue.push({element:Te,left:Te.scrollLeft,top:Te.scrollTop});for(typeof B.focus=="function"&&B.focus(),B=0;B<Ue.length;B++){var Oe=Ue[B];Oe.element.scrollLeft=Oe.left,Oe.element.scrollTop=Oe.top}}df=!!Eg,Cg=Eg=null}finally{fn=x,V.p=f,$.T=c}}s.current=a,fi=2}}function rw(){if(fi===2){fi=0;var s=Ya,a=Gl,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=$.T,$.T=null;var f=V.p;V.p=2;var x=fn;fn|=4;try{L2(s,a.alternate,a)}finally{fn=x,V.p=f,$.T=c}}fi=3}}function aw(){if(fi===4||fi===3){fi=0,I();var s=Ya,a=Gl,c=da,f=q2;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?fi=5:(fi=0,Gl=Ya=null,ow(s,s.pendingLanes));var x=s.pendingLanes;if(x===0&&(Xa=null),bi(c),a=a.stateNode,oe&&typeof oe.onCommitFiberRoot=="function")try{oe.onCommitFiberRoot(X,a,void 0,(a.current.flags&128)===128)}catch{}if(f!==null){a=$.T,x=V.p,V.p=2,$.T=null;try{for(var v=s.onRecoverableError,A=0;A<f.length;A++){var B=f[A];v(B.value,{componentStack:B.stack})}}finally{$.T=a,V.p=x}}(da&3)!==0&&Qh(),Cr(s),x=s.pendingLanes,(c&261930)!==0&&(x&42)!==0?s===dg?$u++:($u=0,dg=s):$u=0,Fu(0)}}function ow(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,_u(a)))}function Qh(){return sw(),rw(),aw(),lw()}function lw(){if(fi!==5)return!1;var s=Ya,a=cg;cg=0;var c=bi(da),f=$.T,x=V.p;try{V.p=32>c?32:c,$.T=null,c=ug,ug=null;var v=Ya,A=da;if(fi=0,Gl=Ya=null,da=0,(fn&6)!==0)throw Error(i(331));var B=fn;if(fn|=4,H2(v.current),$2(v,v.current,A,c),fn=B,Fu(0,!1),oe&&typeof oe.onPostCommitFiberRoot=="function")try{oe.onPostCommitFiberRoot(X,v)}catch{}return!0}finally{V.p=x,$.T=f,ow(s,a)}}function cw(s,a,c){a=Ps(c,a),a=H0(s.stateNode,a,2),s=Ba(s,a,2),s!==null&&(Ge(s,2),Cr(s))}function vn(s,a,c){if(s.tag===3)cw(s,s,c);else for(;a!==null;){if(a.tag===3){cw(a,s,c);break}else if(a.tag===1){var f=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Xa===null||!Xa.has(f))){s=Ps(c,s),c=u2(2),f=Ba(a,c,2),f!==null&&(d2(c,f,a,s),Ge(f,2),Cr(f));break}}a=a.return}}function pg(s,a,c){var f=s.pingCache;if(f===null){f=s.pingCache=new CT;var x=new Set;f.set(a,x)}else x=f.get(a),x===void 0&&(x=new Set,f.set(a,x));x.has(c)||(ag=!0,x.add(c),s=RT.bind(null,s,a,c),a.then(s,s))}function RT(s,a,c){var f=s.pingCache;f!==null&&f.delete(a),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,Tn===s&&(Jt&c)===c&&($n===4||$n===3&&(Jt&62914560)===Jt&&300>k()-qh?(fn&2)===0&&ql(s,0):og|=c,Vl===Jt&&(Vl=0)),Cr(s)}function uw(s,a){a===0&&(a=Wt()),s=ko(s,a),s!==null&&(Ge(s,a),Cr(s))}function kT(s){var a=s.memoizedState,c=0;a!==null&&(c=a.retryLane),uw(s,c)}function jT(s,a){var c=0;switch(s.tag){case 31:case 13:var f=s.stateNode,x=s.memoizedState;x!==null&&(c=x.retryLane);break;case 19:f=s.stateNode;break;case 22:f=s.stateNode._retryCache;break;default:throw Error(i(314))}f!==null&&f.delete(a),uw(s,c)}function LT(s,a){return Tt(s,a)}var Jh=null,Xl=null,mg=!1,ef=!1,gg=!1,Za=0;function Cr(s){s!==Xl&&s.next===null&&(Xl===null?Jh=Xl=s:Xl=Xl.next=s),ef=!0,mg||(mg=!0,OT())}function Fu(s,a){if(!gg&&ef){gg=!0;do for(var c=!1,f=Jh;f!==null;){if(s!==0){var x=f.pendingLanes;if(x===0)var v=0;else{var A=f.suspendedLanes,B=f.pingedLanes;v=(1<<31-Ae(42|s)+1)-1,v&=x&~(A&~B),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(c=!0,pw(f,v))}else v=Jt,v=ge(f,f===Tn?v:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(v&3)===0||Ye(f,v)||(c=!0,pw(f,v));f=f.next}while(c);gg=!1}}function PT(){dw()}function dw(){ef=mg=!1;var s=0;Za!==0&>()&&(s=Za);for(var a=k(),c=null,f=Jh;f!==null;){var x=f.next,v=hw(f,a);v===0?(f.next=null,c===null?Jh=x:c.next=x,x===null&&(Xl=c)):(c=f,(s!==0||(v&3)!==0)&&(ef=!0)),f=x}fi!==0&&fi!==5||Fu(s),Za!==0&&(Za=0)}function hw(s,a){for(var c=s.suspendedLanes,f=s.pingedLanes,x=s.expirationTimes,v=s.pendingLanes&-62914561;0<v;){var A=31-Ae(v),B=1<<A,ee=x[A];ee===-1?((B&c)===0||(B&f)!==0)&&(x[A]=pt(B,a)):ee<=a&&(s.expiredLanes|=B),v&=~B}if(a=Tn,c=Jt,c=ge(s,s===a?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f=s.callbackNode,c===0||s===a&&(bn===2||bn===9)||s.cancelPendingCommit!==null)return f!==null&&f!==null&&Mt(f),s.callbackNode=null,s.callbackPriority=0;if((c&3)===0||Ye(s,c)){if(a=c&-c,a===s.callbackPriority)return a;switch(f!==null&&Mt(f),bi(c)){case 2:case 8:c=be;break;case 32:c=xe;break;case 268435456:c=$e;break;default:c=xe}return f=fw.bind(null,s),c=Tt(c,f),s.callbackPriority=a,s.callbackNode=c,a}return f!==null&&f!==null&&Mt(f),s.callbackPriority=2,s.callbackNode=null,2}function fw(s,a){if(fi!==0&&fi!==5)return s.callbackNode=null,s.callbackPriority=0,null;var c=s.callbackNode;if(Qh()&&s.callbackNode!==c)return null;var f=Jt;return f=ge(s,s===Tn?f:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f===0?null:(X2(s,f,a),hw(s,k()),s.callbackNode!=null&&s.callbackNode===c?fw.bind(null,s):null)}function pw(s,a){if(Qh())return null;X2(s,a,!0)}function OT(){WT(function(){(fn&6)!==0?Tt(fe,PT):dw()})}function xg(){if(Za===0){var s=Ll;s===0&&(s=Ie,Ie<<=1,(Ie&261888)===0&&(Ie=256)),Za=s}return Za}function mw(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:lh(""+s)}function gw(s,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,s.id&&c.setAttribute("form",s.id),a.parentNode.insertBefore(c,a),s=new FormData(s),c.parentNode.removeChild(c),s}function DT(s,a,c,f,x){if(a==="submit"&&c&&c.stateNode===x){var v=mw((x[Nn]||null).action),A=f.submitter;A&&(a=(a=A[Nn]||null)?mw(a.formAction):A.getAttribute("formAction"),a!==null&&(v=a,A=null));var B=new hh("action","action",null,f,x);s.push({event:B,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(Za!==0){var ee=A?gw(x,A):new FormData(x);U0(c,{pending:!0,data:ee,method:x.method,action:v},null,ee)}}else typeof v=="function"&&(B.preventDefault(),ee=A?gw(x,A):new FormData(x),U0(c,{pending:!0,data:ee,method:x.method,action:v},v,ee))},currentTarget:x}]})}}for(var bg=0;bg<e0.length;bg++){var vg=e0[bg],UT=vg.toLowerCase(),IT=vg[0].toUpperCase()+vg.slice(1);Js(UT,"on"+IT)}Js(Wy,"onAnimationEnd"),Js(Xy,"onAnimationIteration"),Js(Yy,"onAnimationStart"),Js("dblclick","onDoubleClick"),Js("focusin","onFocus"),Js("focusout","onBlur"),Js(eT,"onTransitionRun"),Js(tT,"onTransitionStart"),Js(nT,"onTransitionCancel"),Js(Ky,"onTransitionEnd"),Je("onMouseEnter",["mouseout","mouseover"]),Je("onMouseLeave",["mouseout","mouseover"]),Je("onPointerEnter",["pointerout","pointerover"]),Je("onPointerLeave",["pointerout","pointerover"]),me("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),me("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),me("onBeforeInput",["compositionend","keypress","textInput","paste"]),me("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),me("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),me("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Bu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),zT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Bu));function xw(s,a){a=(a&4)!==0;for(var c=0;c<s.length;c++){var f=s[c],x=f.event;f=f.listeners;e:{var v=void 0;if(a)for(var A=f.length-1;0<=A;A--){var B=f[A],ee=B.instance,ye=B.currentTarget;if(B=B.listener,ee!==v&&x.isPropagationStopped())break e;v=B,x.currentTarget=ye;try{v(x)}catch(Re){mh(Re)}x.currentTarget=null,v=ee}else for(A=0;A<f.length;A++){if(B=f[A],ee=B.instance,ye=B.currentTarget,B=B.listener,ee!==v&&x.isPropagationStopped())break e;v=B,x.currentTarget=ye;try{v(x)}catch(Re){mh(Re)}x.currentTarget=null,v=ee}}}}function Zt(s,a){var c=a[Fi];c===void 0&&(c=a[Fi]=new Set);var f=s+"__bubble";c.has(f)||(bw(a,s,2,!1),c.add(f))}function yg(s,a,c){var f=0;a&&(f|=4),bw(c,s,f,a)}var tf="_reactListening"+Math.random().toString(36).slice(2);function _g(s){if(!s[tf]){s[tf]=!0,ne.forEach(function(c){c!=="selectionchange"&&(zT.has(c)||yg(c,!1,s),yg(c,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[tf]||(a[tf]=!0,yg("selectionchange",!1,a))}}function bw(s,a,c,f){switch(Ww(a)){case 2:var x=fM;break;case 8:x=pM;break;default:x=Dg}c=x.bind(null,a,c,s),x=void 0,!Fm||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(x=!0),f?x!==void 0?s.addEventListener(a,c,{capture:!0,passive:x}):s.addEventListener(a,c,!0):x!==void 0?s.addEventListener(a,c,{passive:x}):s.addEventListener(a,c,!1)}function wg(s,a,c,f,x){var v=f;if((a&1)===0&&(a&2)===0&&f!==null)e:for(;;){if(f===null)return;var A=f.tag;if(A===3||A===4){var B=f.stateNode.containerInfo;if(B===x)break;if(A===4)for(A=f.return;A!==null;){var ee=A.tag;if((ee===3||ee===4)&&A.stateNode.containerInfo===x)return;A=A.return}for(;B!==null;){if(A=rt(B),A===null)return;if(ee=A.tag,ee===5||ee===6||ee===26||ee===27){f=v=A;continue e}B=B.parentNode}}f=f.return}Sy(function(){var ye=v,Re=zm(c),Ue=[];e:{var _e=Zy.get(s);if(_e!==void 0){var Te=hh,ft=s;switch(s){case"keypress":if(uh(c)===0)break e;case"keydown":case"keyup":Te=jN;break;case"focusin":ft="focus",Te=Gm;break;case"focusout":ft="blur",Te=Gm;break;case"beforeblur":case"afterblur":Te=Gm;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Te=Ny;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Te=yN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Te=ON;break;case Wy:case Xy:case Yy:Te=SN;break;case Ky:Te=UN;break;case"scroll":case"scrollend":Te=bN;break;case"wheel":Te=zN;break;case"copy":case"cut":case"paste":Te=CN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Te=My;break;case"toggle":case"beforetoggle":Te=FN}var jt=(a&4)!==0,En=!jt&&(s==="scroll"||s==="scrollend"),he=jt?_e!==null?_e+"Capture":null:_e;jt=[];for(var ie=ye,ve;ie!==null;){var Oe=ie;if(ve=Oe.stateNode,Oe=Oe.tag,Oe!==5&&Oe!==26&&Oe!==27||ve===null||he===null||(Oe=uu(ie,he),Oe!=null&&jt.push(Hu(ie,Oe,ve))),En)break;ie=ie.return}0<jt.length&&(_e=new Te(_e,ft,null,c,Re),Ue.push({event:_e,listeners:jt}))}}if((a&7)===0){e:{if(_e=s==="mouseover"||s==="pointerover",Te=s==="mouseout"||s==="pointerout",_e&&c!==Im&&(ft=c.relatedTarget||c.fromElement)&&(rt(ft)||ft[Si]))break e;if((Te||_e)&&(_e=Re.window===Re?Re:(_e=Re.ownerDocument)?_e.defaultView||_e.parentWindow:window,Te?(ft=c.relatedTarget||c.toElement,Te=ye,ft=ft?rt(ft):null,ft!==null&&(En=l(ft),jt=ft.tag,ft!==En||jt!==5&&jt!==27&&jt!==6)&&(ft=null)):(Te=null,ft=ye),Te!==ft)){if(jt=Ny,Oe="onMouseLeave",he="onMouseEnter",ie="mouse",(s==="pointerout"||s==="pointerover")&&(jt=My,Oe="onPointerLeave",he="onPointerEnter",ie="pointer"),En=Te==null?_e:lt(Te),ve=ft==null?_e:lt(ft),_e=new jt(Oe,ie+"leave",Te,c,Re),_e.target=En,_e.relatedTarget=ve,Oe=null,rt(Re)===ye&&(jt=new jt(he,ie+"enter",ft,c,Re),jt.target=ve,jt.relatedTarget=En,Oe=jt),En=Oe,Te&&ft)t:{for(jt=$T,he=Te,ie=ft,ve=0,Oe=he;Oe;Oe=jt(Oe))ve++;Oe=0;for(var Et=ie;Et;Et=jt(Et))Oe++;for(;0<ve-Oe;)he=jt(he),ve--;for(;0<Oe-ve;)ie=jt(ie),Oe--;for(;ve--;){if(he===ie||ie!==null&&he===ie.alternate){jt=he;break t}he=jt(he),ie=jt(ie)}jt=null}else jt=null;Te!==null&&vw(Ue,_e,Te,jt,!1),ft!==null&&En!==null&&vw(Ue,En,ft,jt,!0)}}e:{if(_e=ye?lt(ye):window,Te=_e.nodeName&&_e.nodeName.toLowerCase(),Te==="select"||Te==="input"&&_e.type==="file")var un=Dy;else if(Py(_e))if(Uy)un=ZN;else{un=YN;var yt=XN}else Te=_e.nodeName,!Te||Te.toLowerCase()!=="input"||_e.type!=="checkbox"&&_e.type!=="radio"?ye&&_l(ye.elementType)&&(un=Dy):un=KN;if(un&&(un=un(s,ye))){Oy(Ue,un,c,Re);break e}yt&&yt(s,_e,ye),s==="focusout"&&ye&&_e.type==="number"&&ye.memoizedProps.value!=null&&Zs(_e,"number",_e.value)}switch(yt=ye?lt(ye):window,s){case"focusin":(Py(yt)||yt.contentEditable==="true")&&(Cl=yt,Zm=ye,bu=null);break;case"focusout":bu=Zm=Cl=null;break;case"mousedown":Qm=!0;break;case"contextmenu":case"mouseup":case"dragend":Qm=!1,Gy(Ue,c,Re);break;case"selectionchange":if(JN)break;case"keydown":case"keyup":Gy(Ue,c,Re)}var Vt;if(Wm)e:{switch(s){case"compositionstart":var en="onCompositionStart";break e;case"compositionend":en="onCompositionEnd";break e;case"compositionupdate":en="onCompositionUpdate";break e}en=void 0}else El?jy(s,c)&&(en="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(en="onCompositionStart");en&&(Ay&&c.locale!=="ko"&&(El||en!=="onCompositionStart"?en==="onCompositionEnd"&&El&&(Vt=Ey()):(Oa=Re,Bm="value"in Oa?Oa.value:Oa.textContent,El=!0)),yt=nf(ye,en),0<yt.length&&(en=new Ty(en,s,null,c,Re),Ue.push({event:en,listeners:yt}),Vt?en.data=Vt:(Vt=Ly(c),Vt!==null&&(en.data=Vt)))),(Vt=HN?VN(s,c):GN(s,c))&&(en=nf(ye,"onBeforeInput"),0<en.length&&(yt=new Ty("onBeforeInput","beforeinput",null,c,Re),Ue.push({event:yt,listeners:en}),yt.data=Vt)),DT(Ue,s,ye,c,Re)}xw(Ue,a)})}function Hu(s,a,c){return{instance:s,listener:a,currentTarget:c}}function nf(s,a){for(var c=a+"Capture",f=[];s!==null;){var x=s,v=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||v===null||(x=uu(s,c),x!=null&&f.unshift(Hu(s,x,v)),x=uu(s,a),x!=null&&f.pu
vendor: 4,317 bytes, lines 9-10
9sh(Hu(s,x,v))),s.tag===3)return f;s=s.return}return[]}function $T(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function vw(s,a,c,f,x){for(var v=a._reactName,A=[];c!==null&&c!==f;){var B=c,ee=B.alternate,ye=B.stateNode;if(B=B.tag,ee!==null&&ee===f)break;B!==5&&B!==26&&B!==27||ye===null||(ee=ye,x?(ye=uu(c,v),ye!=null&&A.unshift(Hu(c,ye,ee))):x||(ye=uu(c,v),ye!=null&&A.push(Hu(c,ye,ee)))),c=c.return}A.length!==0&&s.push({event:a,listeners:A})}var FT=/\r\n?/g,BT=/\u0000|\uFFFD/g;function yw(s){return(typeof s=="string"?s:""+s).replace(FT,` 10`).replace(BT,"")}function _w(s,a){return a=yw(a),yw(s)===a}function Sn(s,a,c,f,x,v){switch(c){case"children":typeof f=="string"?a==="body"||a==="textarea"&&f===""||Hi(s,f):(typeof f=="number"||typeof f=="bigint")&&a!=="body"&&Hi(s,""+f);break;case"className":$t(s,"class",f);break;case"tabIndex":$t(s,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":$t(s,c,f);break;case"style":Yr(s,f,v);break;case"data":if(a!=="object"){$t(s,"data",f);break}case"src":case"href":if(f===""&&(a!=="a"||c!=="href")){s.removeAttribute(c);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(c);break}f=lh(""+f),s.setAttribute(c,f);break;case"action":case"formAction":if(typeof f=="function"){s.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(c==="formAction"?(a!=="input"&&Sn(s,a,"name",x.name,x,null),Sn(s,a,"formEncType",x.formEncType,x,null),Sn(s,a,"formMethod",x.formMethod,x,null),Sn(s,a,"formTarget",x.formTarget,x,null)):(Sn(s,a,"encType",x.encType,x,null),Sn(s,a,"method",x.method,x,null),Sn(s,a,"target",x.target,x,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(c);break}f=lh(""+f),s.setAttribute(c,f);break;case"onClick":f!=null&&(s.onclick=Kr);break;case"onScroll":f!=null&&Zt("scroll",s);break;case"onScrollEnd":f!=null&&Zt("scrollend",s);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(i(61));if(c=f.__html,c!=null){if(x.children!=null)throw Error(i(60));s.innerHTML=c}}break;case"multiple":s.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":s.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){s.removeAttribute("xlink:href");break}c=lh(""+f),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(c,""+f):s.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(c,""):s.removeAttribute(c);break;case"capture":case"download":f===!0?s.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(c,f):s.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?s.setAttribute(c,f):s.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?s.removeAttribute(c):s.setAttribute(c,f);break;case"popover":Zt("beforetoggle",s),Zt("toggle",s),Ot(s,"popover",f);break;case"xlinkActuate":ae(s,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":ae(s,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;
vendor: 8,426 bytes, line 10
10case"xlinkRole":ae(s,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":ae(s,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":ae(s,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":ae(s,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":ae(s,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":ae(s,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":ae(s,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Ot(s,"is",f);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=gN.get(c)||c,Ot(s,c,f))}}function Sg(s,a,c,f,x,v){switch(c){case"style":Yr(s,f,v);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(i(61));if(c=f.__html,c!=null){if(x.children!=null)throw Error(i(60));s.innerHTML=c}}break;case"children":typeof f=="string"?Hi(s,f):(typeof f=="number"||typeof f=="bigint")&&Hi(s,""+f);break;case"onScroll":f!=null&&Zt("scroll",s);break;case"onScrollEnd":f!=null&&Zt("scrollend",s);break;case"onClick":f!=null&&(s.onclick=Kr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!re.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(x=c.endsWith("Capture"),a=c.slice(2,x?c.length-7:void 0),v=s[Nn]||null,v=v!=null?v[c]:null,typeof v=="function"&&s.removeEventListener(a,v,x),typeof f=="function")){typeof v!="function"&&v!==null&&(c in s?s[c]=null:s.hasAttribute(c)&&s.removeAttribute(c)),s.addEventListener(a,f,x);break e}c in s?s[c]=f:f===!0?s.setAttribute(c,""):Ot(s,c,f)}}}function Ti(s,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Zt("error",s),Zt("load",s);var f=!1,x=!1,v;for(v in c)if(c.hasOwnProperty(v)){var A=c[v];if(A!=null)switch(v){case"src":f=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:Sn(s,a,v,A,c,null)}}x&&Sn(s,a,"srcSet",c.srcSet,c,null),f&&Sn(s,a,"src",c.src,c,null);return;case"input":Zt("invalid",s);var B=v=A=x=null,ee=null,ye=null;for(f in c)if(c.hasOwnProperty(f)){var Re=c[f];if(Re!=null)switch(f){case"name":x=Re;break;case"type":A=Re;break;case"checked":ee=Re;break;case"defaultChecked":ye=Re;break;case"value":v=Re;break;case"defaultValue":B=Re;break;case"children":case"dangerouslySetInnerHTML":if(Re!=null)throw Error(i(137,a));break;default:Sn(s,a,f,Re,c,null)}}us(s,v,B,ee,ye,A,x,!1);return;case"select":Zt("invalid",s),f=A=v=null;for(x in c)if(c.hasOwnProperty(x)&&(B=c[x],B!=null))switch(x){case"value":v=B;break;case"defaultValue":A=B;break;case"multiple":f=B;default:Sn(s,a,x,B,c,null)}a=v,c=A,s.multiple=!!f,a!=null?ds(s,!!f,a,!1):c!=null&&ds(s,!!f,c,!0);return;case"textarea":Zt("invalid",s),v=x=f=null;for(A in c)if(c.hasOwnProperty(A)&&(B=c[A],B!=null))switch(A){case"value":f=B;break;case"defaultValue":x=B;break;case"children":v=B;break;case"dangerouslySetInnerHTML":if(B!=null)throw Error(i(91));break;default:Sn(s,a,A,B,c,null)}ei(s,f,x,v);return;case"option":for(ee in c)c.hasOwnProperty(ee)&&(f=c[ee],f!=null)&&(ee==="selected"?s.selected=f&&typeof f!="function"&&typeof f!="symbol":Sn(s,a,ee,f,c,null));return;case"dialog":Zt("beforetoggle",s),Zt("toggle",s),Zt("cancel",s),Zt("close",s);break;case"iframe":case"object":Zt("load",s);break;case"video":case"audio":for(f=0;f<Bu.length;f++)Zt(Bu[f],s);break;case"image":Zt("error",s),Zt("load",s);break;case"details":Zt("toggle",s);break;case"embed":case"source":case"link":Zt("error",s),Zt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ye in c)if(c.hasOwnProperty(ye)&&(f=c[ye],f!=null))switch(ye){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:Sn(s,a,ye,f,c,null)}return;default:if(_l(a)){for(Re in c)c.hasOwnProperty(Re)&&(f=c[Re],f!==void 0&&Sg(s,a,Re,f,c,void 0));return}}for(B in c)c.hasOwnProperty(B)&&(f=c[B],f!=null&&Sn(s,a,B,f,c,null))}function HT(s,a,c,f){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,v=null,A=null,B=null,ee=null,ye=null,Re=null;for(Te in c){var Ue=c[Te];if(c.hasOwnProperty(Te)&&Ue!=null)switch(Te){case"checked":break;case"value":break;case"defaultValue":ee=Ue;default:f.hasOwnProperty(Te)||Sn(s,a,Te,null,f,Ue)}}for(var _e in f){var Te=f[_e];if(Ue=c[_e],f.hasOwnProperty(_e)&&(Te!=null||Ue!=null))switch(_e){case"type":v=Te;break;case"name":x=Te;break;case"checked":ye=Te;break;case"defaultChecked":Re=Te;break;case"value":A=Te;break;case"defaultValue":B=Te;break;case"children":case"dangerouslySetInnerHTML":if(Te!=null)throw Error(i(137,a));break;default:Te!==Ue&&Sn(s,a,_e,Te,f,Ue)}}Bi(s,A,B,ee,ye,Re,v,x);return;case"select":Te=A=B=_e=null;for(v in c)if(ee=c[v],c.hasOwnProperty(v)&&ee!=null)switch(v){case"value":break;case"multiple":Te=ee;default:f.hasOwnProperty(v)||Sn(s,a,v,null,f,ee)}for(x in f)if(v=f[x],ee=c[x],f.hasOwnProperty(x)&&(v!=null||ee!=null))switch(x){case"value":_e=v;break;case"defaultValue":B=v;break;case"multiple":A=v;default:v!==ee&&Sn(s,a,x,v,f,ee)}a=B,c=A,f=Te,_e!=null?ds(s,!!c,_e,!1):!!f!=!!c&&(a!=null?ds(s,!!c,a,!0):ds(s,!!c,c?[]:"",!1));return;case"textarea":Te=_e=null;for(B in c)if(x=c[B],c.hasOwnProperty(B)&&x!=null&&!f.hasOwnProperty(B))switch(B){case"value":break;case"children":break;default:Sn(s,a,B,null,f,x)}for(A in f)if(x=f[A],v=c[A],f.hasOwnProperty(A)&&(x!=null||v!=null))switch(A){case"value":_e=x;break;case"defaultValue":Te=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(i(91));break;default:x!==v&&Sn(s,a,A,x,f,v)}gn(s,_e,Te);return;case"option":for(var ft in c)_e=c[ft],c.hasOwnProperty(ft)&&_e!=null&&!f.hasOwnProperty(ft)&&(ft==="selected"?s.selected=!1:Sn(s,a,ft,null,f,_e));for(ee in f)_e=f[ee],Te=c[ee],f.hasOwnProperty(ee)&&_e!==Te&&(_e!=null||Te!=null)&&(ee==="selected"?s.selected=_e&&typeof _e!="function"&&typeof _e!="symbol":Sn(s,a,ee,_e,f,Te));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var jt in c)_e=c[jt],c.hasOwnProperty(jt)&&_e!=null&&!f.hasOwnProperty(jt)&&Sn(s,a,jt,null,f,_e);for(ye in f)if(_e=f[ye],Te=c[ye],f.hasOwnProperty(ye)&&_e!==Te&&(_e!=null||Te!=null))switch(ye){case"children":case"dangerouslySetInnerHTML":if(_e!=null)throw Error(i(137,a));break;default:Sn(s,a,ye,_e,f,Te)}return;default:if(_l(a)){for(var En in c)_e=c[En],c.hasOwnProperty(En)&&_e!==void 0&&!f.hasOwnProperty(En)&&Sg(s,a,En,void 0,f,_e);for(Re in f)_e=f[Re],Te=c[Re],!f.hasOwnProperty(Re)||_e===Te||_e===void 0&&Te===void 0||Sg(s,a,Re,_e,f,Te);return}}for(var he in c)_e=c[he],c.hasOwnProperty(he)&&_e!=null&&!f.hasOwnProperty(he)&&Sn(s,a,he,null,f,_e);for(Ue in f)_e=f[Ue],Te=c[Ue],!f.hasOwnProperty(Ue)||_e===Te||_e==null&&Te==null||Sn(s,a,Ue,_e,f,Te)}function ww(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function VT(){if(typeof performance.getEntriesByType=="function"){for(var s=0,a=0,c=performance.getEntriesByType("resource"),f=0;f<c.length;f++){var x=c[f],v=x.transferSize,A=x.initiatorType,B=x.duration;if(v&&B&&ww(A)){for(A=0,B=x.responseEnd,f+=1;f<c.length;f++){var ee=c[f],ye=ee.startTime;if(ye>B)break;var Re=ee.transferSize,Ue=ee.initiatorType;Re&&ww(Ue)&&(ee=ee.responseEnd,A+=Re*(ee<B?1:(B-ye)/(ee-ye)))}if(--f,a+=8*(v+A)/(x.duration/1e3),s++,10<s)break}}if(0<s)return a/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Eg=null,Cg=null;function sf(s){return s.nodeType===9?s:s.ownerDocument}function Sw(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Ew(s,a){if(s===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&a==="foreignObject"?0:s}function Ng(s,a){return s==="textarea"||s==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Tg=null;function GT(){var s=window.event;
vendor: 9,784 bytes, line 10
10return s&&s.type==="popstate"?s===Tg?!1:(Tg=s,!0):(Tg=null,!1)}var Cw=typeof setTimeout=="function"?setTimeout:void 0,qT=typeof clearTimeout=="function"?clearTimeout:void 0,Nw=typeof Promise=="function"?Promise:void 0,WT=typeof queueMicrotask=="function"?queueMicrotask:typeof Nw<"u"?function(s){return Nw.resolve(null).then(s).catch(XT)}:Cw;function XT(s){setTimeout(function(){throw s})}function Qa(s){return s==="head"}function Tw(s,a){var c=a,f=0;do{var x=c.nextSibling;if(s.removeChild(c),x&&x.nodeType===8)if(c=x.data,c==="/$"||c==="/&"){if(f===0){s.removeChild(x),Ql(a);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")Vu(s.ownerDocument.documentElement);else if(c==="head"){c=s.ownerDocument.head,Vu(c);for(var v=c.firstChild;v;){var A=v.nextSibling,B=v.nodeName;v[we]||B==="SCRIPT"||B==="STYLE"||B==="LINK"&&v.rel.toLowerCase()==="stylesheet"||c.removeChild(v),v=A}}else c==="body"&&Vu(s.ownerDocument.body);c=x}while(c);Ql(a)}function Mw(s,a){var c=s;s=0;do{var f=c.nextSibling;if(c.nodeType===1?a?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(a?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),f&&f.nodeType===8)if(c=f.data,c==="/$"){if(s===0)break;s--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||s++;c=f}while(c)}function Mg(s){var a=s.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var c=a;switch(a=a.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Mg(c),He(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}s.removeChild(c)}}function YT(s,a,c,f){for(;s.nodeType===1;){var x=c;if(s.nodeName.toLowerCase()!==a.toLowerCase()){if(!f&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(f){if(!s[we])switch(a){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(v=s.getAttribute("rel"),v==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(v!==x.rel||s.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||s.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||s.getAttribute("title")!==(x.title==null?null:x.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(v=s.getAttribute("src"),(v!==(x.src==null?null:x.src)||s.getAttribute("type")!==(x.type==null?null:x.type)||s.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&v&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(a==="input"&&s.type==="hidden"){var v=x.name==null?null:""+x.name;if(x.type==="hidden"&&s.getAttribute("name")===v)return s}else return s;if(s=zs(s.nextSibling),s===null)break}return null}function KT(s,a,c){if(a==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!c||(s=zs(s.nextSibling),s===null))return null;return s}function Aw(s,a){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=zs(s.nextSibling),s===null))return null;return s}function Ag(s){return s.data==="$?"||s.data==="$~"}function Rg(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function ZT(s,a){var c=s.ownerDocument;if(s.data==="$~")s._reactRetry=a;else if(s.data!=="$?"||c.readyState!=="loading")a();else{var f=function(){a(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),s._reactRetry=f}}function zs(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return s}var kg=null;function Rw(s){s=s.nextSibling;for(var a=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"||c==="/&"){if(a===0)return zs(s.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}s=s.nextSibling}return null}function kw(s){s=s.previousSibling;for(var a=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return s;a--}else c!=="/$"&&c!=="/&"||a++}s=s.previousSibling}return null}function jw(s,a,c){switch(a=sf(c),s){case"html":if(s=a.documentElement,!s)throw Error(i(452));return s;case"head":if(s=a.head,!s)throw Error(i(453));return s;case"body":if(s=a.body,!s)throw Error(i(454));return s;default:throw Error(i(451))}}function Vu(s){for(var a=s.attributes;a.length;)s.removeAttributeNode(a[0]);He(s)}var $s=new Map,Lw=new Set;function rf(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var ha=V.d;V.d={f:QT,r:JT,D:eM,C:tM,L:nM,m:iM,X:rM,S:sM,M:aM};function QT(){var s=ha.f(),a=Yh();return s||a}function JT(s){var a=Ke(s);a!==null&&a.tag===5&&a.type==="form"?K_(a):ha.r(s)}var Yl=typeof document>"u"?null:document;function Pw(s,a,c){var f=Yl;if(f&&typeof a=="string"&&a){var x=It(a);x='link[rel="'+s+'"][href="'+x+'"]',typeof c=="string"&&(x+='[crossorigin="'+c+'"]'),Lw.has(x)||(Lw.add(x),s={rel:s,crossOrigin:c,href:a},f.querySelector(x)===null&&(a=f.createElement("link"),Ti(a,"link",s),q(a),f.head.appendChild(a)))}}function eM(s){ha.D(s),Pw("dns-prefetch",s,null)}function tM(s,a){ha.C(s,a),Pw("preconnect",s,a)}function nM(s,a,c){ha.L(s,a,c);var f=Yl;if(f&&s&&a){var x='link[rel="preload"][as="'+It(a)+'"]';a==="image"&&c&&c.imageSrcSet?(x+='[imagesrcset="'+It(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(x+='[imagesizes="'+It(c.imageSizes)+'"]')):x+='[href="'+It(s)+'"]';var v=x;switch(a){case"style":v=Kl(s);break;case"script":v=Zl(s)}$s.has(v)||(s=g({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:s,as:a},c),$s.set(v,s),f.querySelector(x)!==null||a==="style"&&f.querySelector(Gu(v))||a==="script"&&f.querySelector(qu(v))||(a=f.createElement("link"),Ti(a,"link",s),q(a),f.head.appendChild(a)))}}function iM(s,a){ha.m(s,a);var c=Yl;if(c&&s){var f=a&&typeof a.as=="string"?a.as:"script",x='link[rel="modulepreload"][as="'+It(f)+'"][href="'+It(s)+'"]',v=x;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Zl(s)}if(!$s.has(v)&&(s=g({rel:"modulepreload",href:s},a),$s.set(v,s),c.querySelector(x)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(qu(v)))return}f=c.createElement("link"),Ti(f,"link",s),q(f),c.head.appendChild(f)}}}function sM(s,a,c){ha.S(s,a,c);var f=Yl;if(f&&s){var x=L(f).hoistableStyles,v=Kl(s);a=a||"default";var A=x.get(v);if(!A){var B={loading:0,preload:null};if(A=f.querySelector(Gu(v)))B.loading=5;else{s=g({rel:"stylesheet",href:s,"data-precedence":a},c),(c=$s.get(v))&&jg(s,c);var ee=A=f.createElement("link");q(ee),Ti(ee,"link",s),ee._p=new Promise(function(ye,Re){ee.onload=ye,ee.onerror=Re}),ee.addEventListener("load",function(){B.loading|=1}),ee.addEventListener("error",function(){B.loading|=2}),B.loading|=4,af(A,a,f)}A={type:"stylesheet",instance:A,count:1,state:B},x.set(v,A)}}}function rM(s,a){ha.X(s,a);var c=Yl;if(c&&s){var f=L(c).hoistableScripts,x=Zl(s),v=f.get(x);v||(v=c.querySelector(qu(x)),v||(s=g({src:s,async:!0},a),(a=$s.get(x))&&Lg(s,a),v=c.createElement("script"),q(v),Ti(v,"link",s),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(x,v))}}function aM(s,a){ha.M(s,a);var c=Yl;if(c&&s){var f=L(c).hoistableScripts,x=Zl(s),v=f.get(x);v||(v=c.querySelector(qu(x)),v||(s=g({src:s,async:!0,type:"module"},a),(a=$s.get(x))&&Lg(s,a),v=c.createElement("script"),q(v),Ti(v,"link",s),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(x,v))}}function Ow(s,a,c,f){var x=(x=le.current)?rf(x):null;if(!x)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=Kl(c.href),c=L(x).hoistableStyles,f=c.get(a),f||(f={type:"style",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=Kl(c.href);var v=L(x).hoistableStyles,A=v.get(s);if(A||(x=x.ownerDocument||x,A={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(s,A),(v=x.querySelector(Gu(s)))&&!v._p&&(A.instance=v,A.state.loading=5),$s.has(s)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},$s.set(s,c),v||oM(x,s,c,A.state))),a&&f===null)throw Error(i(528,""));return A}if(a&&f!==null)throw Error(i(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Zl(c),c=L(x).hoistableScripts,f=c.get(a),f||(f={type:"script",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function Kl(s){return'href="'+It(s)+'"'}function Gu(s){return'link[rel="stylesheet"]['+s+"]"}function Dw(s){return g({},s,{"data-precedence":s.precedence,precedence:null})}function oM(s,a,c,f){s.querySelector('link[rel="preload"][as="style"]['+a+"]")?f.loading=1:(a=s.createElement("link"),f.preload=a,a.addEventListener("load",function(){return f.loading|=1}),a.addEventListener("error",function(){return f.loading|=2}),Ti(a,"link",c),q(a),s.head.appendChild(a))}function Zl(s){return'[src="'+It(s)+'"]'}function qu(s){return"script[async]"+s}function Uw(s,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var f=s.querySelector('style[data-href~="'+It(c.href)+'"]');if(f)return a.instance=f,q(f),f;var x=g({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});
vendor: 4,124 bytes, line 10
10return f=(s.ownerDocument||s).createElement("style"),q(f),Ti(f,"style",x),af(f,c.precedence,s),a.instance=f;case"stylesheet":x=Kl(c.href);var v=s.querySelector(Gu(x));if(v)return a.state.loading|=4,a.instance=v,q(v),v;f=Dw(c),(x=$s.get(x))&&jg(f,x),v=(s.ownerDocument||s).createElement("link"),q(v);var A=v;return A._p=new Promise(function(B,ee){A.onload=B,A.onerror=ee}),Ti(v,"link",f),a.state.loading|=4,af(v,c.precedence,s),a.instance=v;case"script":return v=Zl(c.src),(x=s.querySelector(qu(v)))?(a.instance=x,q(x),x):(f=c,(x=$s.get(v))&&(f=g({},c),Lg(f,x)),s=s.ownerDocument||s,x=s.createElement("script"),q(x),Ti(x,"link",f),s.head.appendChild(x),a.instance=x);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(f=a.instance,a.state.loading|=4,af(f,c.precedence,s));return a.instance}function af(s,a,c){for(var f=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=f.length?f[f.length-1]:null,v=x,A=0;A<f.length;A++){var B=f[A];if(B.dataset.precedence===a)v=B;else if(v!==x)break}v?v.parentNode.insertBefore(s,v.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(s,a.firstChild))}function jg(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.title==null&&(s.title=a.title)}function Lg(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.integrity==null&&(s.integrity=a.integrity)}var of=null;function Iw(s,a,c){if(of===null){var f=new Map,x=of=new Map;x.set(c,f)}else x=of,f=x.get(c),f||(f=new Map,x.set(c,f));if(f.has(s))return f;for(f.set(s,null),c=c.getElementsByTagName(s),x=0;x<c.length;x++){var v=c[x];if(!(v[we]||v[xn]||s==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var A=v.getAttribute(a)||"";A=s+A;var B=f.get(A);B?B.push(v):f.set(A,[v])}}return f}function zw(s,a,c){s=s.ownerDocument||s,s.head.insertBefore(c,a==="title"?s.querySelector("head > title"):null)}function lM(s,a,c){if(c===1||a.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(s=a.disabled,typeof a.precedence=="string"&&s==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function $w(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function cM(s,a,c,f){if(c.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var x=Kl(f.href),v=a.querySelector(Gu(x));if(v){a=v._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(s.count++,s=lf.bind(s),a.then(s,s)),c.state.loading|=4,c.instance=v,q(v);return}v=a.ownerDocument||a,f=Dw(f),(x=$s.get(x))&&jg(f,x),v=v.createElement("link"),q(v);var A=v;A._p=new Promise(function(B,ee){A.onload=B,A.onerror=ee}),Ti(v,"link",f),c.instance=v}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(s.count++,c=lf.bind(s),a.addEventListener("load",c),a.addEventListener("error",c))}}var Pg=0;function uM(s,a){return s.stylesheets&&s.count===0&&uf(s,s.stylesheets),0<s.count||0<s.imgCount?function(c){var f=setTimeout(function(){if(s.stylesheets&&uf(s,s.stylesheets),s.unsuspend){var v=s.unsuspend;s.unsuspend=null,v()}},6e4+a);0<s.imgBytes&&Pg===0&&(Pg=62500*VT());var x=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&uf(s,s.stylesheets),s.unsuspend)){var v=s.unsuspend;s.unsuspend=null,v()}},(s.imgBytes>Pg?50:800)+a);return s.unsuspend=c,function(){s.unsuspend=null,clearTimeout(f),clearTimeout(x)}}:null}function lf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)uf(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;
vendor: 11,052 bytes, line 10
10this.unsuspend=null,s()}}}var cf=null;function uf(s,a){s.stylesheets=null,s.unsuspend!==null&&(s.count++,cf=new Map,a.forEach(dM,s),cf=null,lf.call(s))}function dM(s,a){if(!(a.state.loading&4)){var c=cf.get(s);if(c)var f=c.get(null);else{c=new Map,cf.set(s,c);for(var x=s.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<x.length;v++){var A=x[v];(A.nodeName==="LINK"||A.getAttribute("media")!=="not all")&&(c.set(A.dataset.precedence,A),f=A)}f&&c.set(null,f)}x=a.instance,A=x.getAttribute("data-precedence"),v=c.get(A)||f,v===f&&c.set(null,x),c.set(A,x),this.count++,f=lf.bind(this),x.addEventListener("load",f),x.addEventListener("error",f),v?v.parentNode.insertBefore(x,v.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(x,s.firstChild)),a.state.loading|=4}}var Wu={$$typeof:N,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function hM(s,a,c,f,x,v,A,B,ee){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ce(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ce(0),this.hiddenUpdates=ce(null),this.identifierPrefix=f,this.onUncaughtError=x,this.onCaughtError=v,this.onRecoverableError=A,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ee,this.incompleteTransitions=new Map}function Fw(s,a,c,f,x,v,A,B,ee,ye,Re,Ue){return s=new hM(s,a,c,A,ee,ye,Re,Ue,B),a=1,v===!0&&(a|=24),v=fs(3,null,null,a),s.current=v,v.stateNode=s,a=f0(),a.refCount++,s.pooledCache=a,a.refCount++,v.memoizedState={element:f,isDehydrated:c,cache:a},x0(v),s}function Bw(s){return s?(s=Ml,s):Ml}function Hw(s,a,c,f,x,v){x=Bw(x),f.context===null?f.context=x:f.pendingContext=x,f=Fa(a),f.payload={element:c},v=v===void 0?null:v,v!==null&&(f.callback=v),c=Ba(s,f,a),c!==null&&(ns(c,s,a),Cu(c,s,a))}function Vw(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<a?c:a}}function Og(s,a){Vw(s,a),(s=s.alternate)&&Vw(s,a)}function Gw(s){if(s.tag===13||s.tag===31){var a=ko(s,67108864);a!==null&&ns(a,s,67108864),Og(s,67108864)}}function qw(s){if(s.tag===13||s.tag===31){var a=bs();a=Qn(a);var c=ko(s,a);c!==null&&ns(c,s,a),Og(s,a)}}var df=!0;function fM(s,a,c,f){var x=$.T;$.T=null;var v=V.p;try{V.p=2,Dg(s,a,c,f)}finally{V.p=v,$.T=x}}function pM(s,a,c,f){var x=$.T;$.T=null;var v=V.p;try{V.p=8,Dg(s,a,c,f)}finally{V.p=v,$.T=x}}function Dg(s,a,c,f){if(df){var x=Ug(f);if(x===null)wg(s,a,f,hf,c),Xw(s,f);else if(gM(x,s,a,c,f))f.stopPropagation();else if(Xw(s,f),a&4&&-1<mM.indexOf(s)){for(;x!==null;){var v=Ke(x);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var A=ze(v.pendingLanes);if(A!==0){var B=v;for(B.pendingLanes|=2,B.entangledLanes|=2;A;){var ee=1<<31-Ae(A);B.entanglements[1]|=ee,A&=~ee}Cr(v),(fn&6)===0&&(Wh=k()+500,Fu(0))}}break;case 31:case 13:B=ko(v,2),B!==null&&ns(B,v,2),Yh(),Og(v,2)}if(v=Ug(f),v===null&&wg(s,a,f,hf,c),v===x)break;x=v}x!==null&&f.stopPropagation()}else wg(s,a,f,null,c)}}function Ug(s){return s=zm(s),Ig(s)}var hf=null;function Ig(s){if(hf=null,s=rt(s),s!==null){var a=l(s);if(a===null)s=null;else{var c=a.tag;if(c===13){if(s=u(a),s!==null)return s;s=null}else if(c===31){if(s=h(a),s!==null)return s;s=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;s=null}else a!==s&&(s=null)}}return hf=s,null}function Ww(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Q()){case fe:return 2;case be:return 8;case xe:case Xe:return 32;case $e:return 268435456;default:return 32}default:return 32}}var zg=!1,Ja=null,eo=null,to=null,Xu=new Map,Yu=new Map,no=[],mM="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Xw(s,a){switch(s){case"focusin":case"focusout":Ja=null;break;case"dragenter":case"dragleave":eo=null;break;case"mouseover":case"mouseout":to=null;break;case"pointerover":case"pointerout":Xu.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Yu.delete(a.pointerId)}}function Ku(s,a,c,f,x,v){return s===null||s.nativeEvent!==v?(s={blockedOn:a,domEventName:c,eventSystemFlags:f,nativeEvent:v,targetContainers:[x]},a!==null&&(a=Ke(a),a!==null&&Gw(a)),s):(s.eventSystemFlags|=f,a=s.targetContainers,x!==null&&a.indexOf(x)===-1&&a.push(x),s)}function gM(s,a,c,f,x){switch(a){case"focusin":return Ja=Ku(Ja,s,a,c,f,x),!0;case"dragenter":return eo=Ku(eo,s,a,c,f,x),!0;case"mouseover":return to=Ku(to,s,a,c,f,x),!0;case"pointerover":var v=x.pointerId;return Xu.set(v,Ku(Xu.get(v)||null,s,a,c,f,x)),!0;case"gotpointercapture":return v=x.pointerId,Yu.set(v,Ku(Yu.get(v)||null,s,a,c,f,x)),!0}return!1}function Yw(s){var a=rt(s.target);if(a!==null){var c=l(a);if(c!==null){if(a=c.tag,a===13){if(a=u(c),a!==null){s.blockedOn=a,cs(s.priority,function(){qw(c)});return}}else if(a===31){if(a=h(c),a!==null){s.blockedOn=a,cs(s.priority,function(){qw(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function ff(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var c=Ug(s.nativeEvent);if(c===null){c=s.nativeEvent;var f=new c.constructor(c.type,c);Im=f,c.target.dispatchEvent(f),Im=null}else return a=Ke(c),a!==null&&Gw(a),s.blockedOn=c,!1;a.shift()}return!0}function Kw(s,a,c){ff(s)&&c.delete(a)}function xM(){zg=!1,Ja!==null&&ff(Ja)&&(Ja=null),eo!==null&&ff(eo)&&(eo=null),to!==null&&ff(to)&&(to=null),Xu.forEach(Kw),Yu.forEach(Kw)}function pf(s,a){s.blockedOn===a&&(s.blockedOn=null,zg||(zg=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,xM)))}var mf=null;function Zw(s){mf!==s&&(mf=s,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){mf===s&&(mf=null);for(var a=0;a<s.length;a+=3){var c=s[a],f=s[a+1],x=s[a+2];if(typeof f!="function"){if(Ig(f||c)===null)continue;break}var v=Ke(c);v!==null&&(s.splice(a,3),a-=3,U0(v,{pending:!0,data:x,method:c.method,action:f},f,x))}}))}function Ql(s){function a(ee){return pf(ee,s)}Ja!==null&&pf(Ja,s),eo!==null&&pf(eo,s),to!==null&&pf(to,s),Xu.forEach(a),Yu.forEach(a);for(var c=0;c<no.length;c++){var f=no[c];f.blockedOn===s&&(f.blockedOn=null)}for(;0<no.length&&(c=no[0],c.blockedOn===null);)Yw(c),c.blockedOn===null&&no.shift();if(c=(s.ownerDocument||s).$$reactFormReplay,c!=null)for(f=0;f<c.length;f+=3){var x=c[f],v=c[f+1],A=x[Nn]||null;if(typeof v=="function")A||Zw(c);else if(A){var B=null;if(v&&v.hasAttribute("formAction")){if(x=v,A=v[Nn]||null)B=A.formAction;else if(Ig(x)!==null)continue}else B=A.action;typeof B=="function"?c[f+1]=B:(c.splice(f,3),f-=3),Zw(c)}}}function Qw(){function s(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(A){return x=A})},focusReset:"manual",scroll:"manual"})}function a(){x!==null&&(x(),x=null),f||setTimeout(c,20)}function c(){if(!f&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,x=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){f=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),x!==null&&(x(),x=null)}}}function $g(s){this._internalRoot=s}gf.prototype.render=$g.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(i(409));var c=a.current,f=bs();Hw(c,f,s,a,null,null)},gf.prototype.unmount=$g.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;Hw(s.current,2,null,s,null,null),Yh(),a[Si]=null}};function gf(s){this._internalRoot=s}gf.prototype.unstable_scheduleHydration=function(s){if(s){var a=qn();s={blockedOn:null,target:s,priority:a};for(var c=0;c<no.length&&a!==0&&a<no[c].priority;c++);no.splice(c,0,s),c===0&&Yw(s)}};var Jw=e.version;if(Jw!=="19.2.4")throw Error(i(527,Jw,"19.2.4"));V.findDOMNode=function(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=p(a),s=s!==null?m(s):null,s=s===null?null:s.stateNode,s};var bM={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xf.isDisabled&&xf.supportsFiber)try{X=xf.inject(bM),oe=xf}catch{}}return Qu.createRoot=function(s,a){if(!r(s))throw Error(i(299));var c=!1,f="",x=a2,v=o2,A=l2;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(x=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(A=a.onRecoverableError)),a=Fw(s,1,!1,null,null,c,f,null,x,v,A,Qw),s[Si]=a.current,_g(s),new $g(a)},Qu.hydrateRoot=function(s,a,c){if(!r(s))throw Error(i(299));var f=!1,x="",v=a2,A=o2,B=l2,ee=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onUncaughtError!==void 0&&(v=c.onUncaughtError),c.onCaughtError!==void 0&&(A=c.onCaughtError),c.onRecoverableError!==void 0&&(B=c.onRecoverableError),c.formState!==void 0&&(ee=c.formState)),a=Fw(s,1,!0,a,c??null,f,x,ee,v,A,B,Qw),a.context=Bw(null),c=a.current,f=bs(),f=Qn(f),x=F
10a(f),x.callback=null,Ba(c,x,f),c=f,a.current.lanes=c,Ge(a,c),Cr(a),s[Si]=a.current,_g(s),new gf(a)},Qu.version="19.2.4",Qu}var c3;function MM(){if(c3)return Hg.exports;c3=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Hg.exports=TM(),Hg.exports}var AM=MM();var u3="popstate";function d3(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function RM(n={}){function e(i,r){let l=r.state?.masked,{pathname:u,search:h,hash:d}=l||i.location;return c1("",{pathname:u,search:h,hash:d},r.state&&r.state.usr||null,r.state&&r.state.key||"default",l?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function t(i,r){return typeof r=="string"?r:Pd(r)}return jM(e,t,null,n)}function In(n,e){if(n===!1||n===null||typeof n>"u")throw new Error(e)}function Ys(n,e){if(!n){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function kM(){return Math.random().toString(36).substring(2,10)}function h3(n,e){return{usr:n.state,key:n.key,idx:e,masked:n.unstable_mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function c1(n,e,t=null,i,r){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof e=="string"?Vc(e):e,state:t,key:e&&e.key||i||kM(),unstable_mask:r}}function Pd({pathname:n="/",search:e="",hash:t=""}){return e&&e!=="?"&&(n+=e.charAt(0)==="?"?e:"?"+e),t&&t!=="#"&&(n+=t.charAt(0)==="#"?t:"#"+t),n}function Vc(n){let e={};if(n){let t=n.indexOf("#");t>=0&&(e.hash=n.substring(t),n=n.substring(0,t));let i=n.indexOf("?");i>=0&&(e.search=n.substring(i),n=n.substring(0,i)),n&&(e.pathname=n)}return e}function jM(n,e,t,i={}){let{window:r=document.defaultView,v5Compat:l=!1}=i,u=r.history,h="POP",d=null,p=m();p==null&&(p=0,u.replaceState({...u.state,idx:p},""));function m(){return(u.state||{idx:null}).idx}function g(){h="POP";let w=m(),S=w==null?null:w-p;p=w,d&&d({action:h,location:C.location,delta:S})}function b(w,S){h="PUSH";let T=d3(w)?w:c1(C.location,w,S);p=m()+1;let N=h3(T,p),j=C.createHref(T.unstable_mask||T);try{u.pushState(N,"",j)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;r.location.assign(j)}l&&d&&d({action:h,location:C.location,delta:1})}function y(w,S){h="REPLACE";let T=d3(w)?w:c1(C.location,w,S);p=m();let N=h3(T,p),j=C.createHref(T.unstable_mask||T);u.replaceState(N,"",j),l&&d&&d({action:h,location:C.location,delta:0})}function _(w){return LM(w)}let C={get action(){return h},get location(){return n(r,u)},listen(w){if(d)throw new Error("A history only accepts one active listener");return r.addEventListener(u3,g),d=w,()=>{r.removeEventListener(u3,g),d=null}},createHref(w){return e(r,w)},createURL:_,encodeLocation(w){let S=_(w);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:b,replace:y,go(w){return u.go(w)}};return C}function LM(n,e=!1){let t="http://localhost";
10typeof window<"u"&&(t=window.location.origin!=="null"?window.location.origin:window.location.href),In(t,"No window.location.(origin|href) available to create URL");let i=typeof n=="string"?n:Pd(n);return i=i.replace(/ $/,"%20"),!e&&i.startsWith("//")&&(i=t+i),new URL(i,t)}function _6(n,e,t="/"){return PM(n,e,t,!1)}function PM(n,e,t,i){let r=typeof e=="string"?Vc(e):e,l=Aa(r.pathname||"/",t);if(l==null)return null;let u=w6(n);OM(u);let h=null;for(let d=0;h==null&&d<u.length;++d){let p=qM(l);h=VM(u[d],p,i)}return h}function w6(n,e=[],t=[],i="",r=!1){let l=(u,h,d=r,p)=>{let m={relativePath:p===void 0?u.path||"":p,caseSensitive:u.caseSensitive===!0,childrenIndex:h,route:u};if(m.relativePath.startsWith("/")){if(!m.relativePath.startsWith(i)&&d)return;In(m.relativePath.startsWith(i),`Absolute route path "${m.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),m.relativePath=m.relativePath.slice(i.length)}let g=Lr([i,m.relativePath]),b=t.concat(m);u.children&&u.children.length>0&&(In(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),w6(u.children,e,b,g,d)),!(u.path==null&&!u.index)&&e.push({path:g,score:BM(g,u.index),routesMeta:b})};return n.forEach((u,h)=>{if(u.path===""||!u.path?.includes("?"))l(u,h);else for(let d of S6(u.path))l(u,h,!0,d)}),e}function S6(n){let e=n.split("/");if(e.length===0)return[];let[t,...i]=e,r=t.endsWith("?"),l=t.replace(/\?$/,"");if(i.length===0)return r?[l,""]:[l];let u=S6(i.join("/")),h=[];return h.push(...u.map(d=>d===""?l:[l,d].join("/"))),r&&h.push(...u),h.map(d=>n.startsWith("/")&&d===""?"/":d)}function OM(n){n.sort((e,t)=>e.score!==t.score?t.score-e.score:HM(e.routesMeta.map(i=>i.childrenIndex),t.routesMeta.map(i=>i.childrenIndex)))}var DM=/^:[\w-]+$/,UM=3,IM=2,zM=1,$M=10,FM=-2,f3=n=>n==="*";function BM(n,e){let t=n.split("/"),i=t.length;return t.some(f3)&&(i+=FM),e&&(i+=IM),t.filter(r=>!f3(r)).reduce((r,l)=>r+(DM.test(l)?UM:l===""?zM:$M),i)}function HM(n,e){return n.length===e.length&&n.slice(0,-1).every((i,r)=>i===e[r])?n[n.length-1]-e[e.length-1]:0}function VM(n,e,t=!1){let{routesMeta:i}=n,r={},l="/",u=[];for(let h=0;h<i.length;++h){let d=i[h],p=h===i.length-1,m=l==="/"?e:e.slice(l.length)||"/",g=kp({path:d.relativePath,caseSensitive:d.caseSensitive,end:p},m),b=d.route;if(!g&&p&&t&&!i[i.length-1].route.index&&(g=kp({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},m)),!g)return null;
10Object.assign(r,g.params),u.push({params:r,pathname:Lr([l,g.pathname]),pathnameBase:KM(Lr([l,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(l=Lr([l,g.pathnameBase]))}return u}function kp(n,e){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[t,i]=GM(n.path,n.caseSensitive,n.end),r=e.match(t);if(!r)return null;let l=r[0],u=l.replace(/(.)\/+$/,"$1"),h=r.slice(1);return{params:i.reduce((p,{paramName:m,isOptional:g},b)=>{if(m==="*"){let _=h[b]||"";u=l.slice(0,l.length-_.length).replace(/(.)\/+$/,"$1")}const y=h[b];return g&&!y?p[m]=void 0:p[m]=(y||"").replace(/%2F/g,"/"),p},{}),pathname:l,pathnameBase:u,pattern:n}}function GM(n,e=!1,t=!0){Ys(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let i=[],r="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,h,d,p,m)=>{if(i.push({paramName:h,isOptional:d!=null}),d){let g=m.charAt(p+u.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(i.push({paramName:"*"}),r+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?r+="\\/*$":n!==""&&n!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),i]}function qM(n){try{return n.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Ys(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),n}}function Aa(n,e){if(e==="/")return n;if(!n.toLowerCase().startsWith(e.toLowerCase()))return null;let t=e.endsWith("/")?e.length-1:e.length,i=n.charAt(t);return i&&i!=="/"?null:n.slice(t)||"/"}var WM=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function XM(n,e="/"){let{pathname:t,search:i="",hash:r=""}=typeof n=="string"?Vc(n):n,l;return t?(t=t.replace(/\/\/+/g,"/"),t.startsWith("/")?l=p3(t.substring(1),"/"):l=p3(t,e)):l=e,{pathname:l,search:ZM(i),hash:QM(r)}}function p3(n,e){let t=e.replace(/\/+$/,"").split("/");return n.split("/").forEach(r=>{r===".."?t.length>1&&t.pop():r!=="."&&t.push(r)}),t.length>1?t.join("/"):"/"}function Wg(n,e,t,i){return`Cannot include a '${n}' character in a manually specified \`to.${e}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${t}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function YM(n){return n.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ev(n){let e=YM(n);return e.map((t,i)=>i===e.length-1?t.pathname:t.pathnameBase)}function Jp(n,e,t,i=!1){let r;typeof n=="string"?r=Vc(n):(r={...n},In(!r.pathname||!r.pathname.includes("?"),Wg("?","pathname","search",r)),In(!r.pathname||!r.pathname.includes("#"),Wg("#","pathname","hash",r)),In(!r.search||!r.search.includes("#"),Wg("#","search","hash",r)));let l=n===""||r.pathname==="",u=l?"/":r.pathname,h;if(u==null)h=t;else{let g=e.length-1;if(!i&&u.startsWith("..")){let b=u.split("/");for(;b[0]==="..";)b.shift(),g-=1;r.pathname=b.join("/")}h=g>=0?e[g]:"/"}let d=XM(r,h),p=u&&u!=="/"&&u.endsWith("/"),m=(l||u===".")&&t.endsWith("/");return!d.pathname.endsWith("/")&&(p||m)&&(d.pathname+="/"),d}var Lr=n=>n.join("/").replace(/\/\/+/g,"/"),KM=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),ZM=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,QM=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,JM=class{constructor(n,e,t,i=!1){this.status=n,this.statusText=e||"",this.internal=i,t instanceof Error?(this.data=t.toString(),this.error=t):this.data=t}};function eA(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function tA(n){return n.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var E6=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function C6(n,e){let t=n;if(typeof t!="string"||!WM.test(t))return{absoluteURL:void 0,isExternal:!1,to:t};let i=t,r=!1;if(E6)try{let l=new URL(window.location.href),u=t.startsWith("//")?new URL(l.protocol+t):new URL(t),h=Aa(u.pathname,e);u.origin===l.origin&&h!=null?t=h+u.search+u.hash:r=!0}catch{Ys(!1,`<Link to="${t}">
10 contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:r,to:t}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var N6=["POST","PUT","PATCH","DELETE"];new Set(N6);var nA=["GET",...N6];new Set(nA);var Gc=E.createContext(null);Gc.displayName="DataRouter";var em=E.createContext(null);em.displayName="DataRouterState";var iA=E.createContext(!1),T6=E.createContext({isTransitioning:!1});T6.displayName="ViewTransition";var sA=E.createContext(new Map);sA.displayName="Fetchers";var rA=E.createContext(null);rA.displayName="Await";var ks=E.createContext(null);ks.displayName="Navigation";var Yd=E.createContext(null);Yd.displayName="Location";var yr=E.createContext({outlet:null,matches:[],isDataRoute:!1});yr.displayName="Route";var tv=E.createContext(null);tv.displayName="RouteError";var M6="REACT_ROUTER_ERROR",aA="REDIRECT",oA="ROUTE_ERROR_RESPONSE";function lA(n){if(n.startsWith(`${M6}:${aA}:{`))try{let e=JSON.parse(n.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function cA(n){if(n.startsWith(`${M6}:${oA}:{`))try{let e=JSON.parse(n.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new JM(e.status,e.statusText,e.data)}catch{}}function uA(n,{relative:e}={}){In(qc(),"useHref() may be used only in the context of a <Router> component.");let{basename:t,navigator:i}=E.useContext(ks),{hash:r,pathname:l,search:u}=Kd(n,{relative:e}),h=l;return t!=="/"&&(h=l==="/"?t:Lr([t,l])),i.createHref({pathname:h,search:u,hash:r})}function qc(){return E.useContext(Yd)!=null}function js(){return In(qc(),"useLocation() may be used only in the context of a <Router> component."),E.useContext(Yd).location}var A6="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function R6(n){E.useContext(ks).static||E.useLayoutEffect(n)}function ml(){let{isDataRoute:n}=E.useContext(yr);return n?SA():dA()}function dA(){In(qc(),"useNavigate() may be used only in the context of a <Router> component.");let n=E.useContext(Gc),{basename:e,navigator:t}=E.useContext(ks),{matches:i}=E.useContext(yr),{pathname:r}=js(),l=JSON.stringify(ev(i)),u=E.useRef(!1);return R6(()=>{u.current=!0}),E.useCallback((d,p={})=>
10{if(Ys(u.current,A6),!u.current)return;if(typeof d=="number"){t.go(d);return}let m=Jp(d,JSON.parse(l),r,p.relative==="path");n==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:Lr([e,m.pathname])),(p.replace?t.replace:t.push)(m,p.state,p)},[e,t,l,r,n])}E.createContext(null);function nv(){let{matches:n}=E.useContext(yr),e=n[n.length-1];return e?e.params:{}}function Kd(n,{relative:e}={}){let{matches:t}=E.useContext(yr),{pathname:i}=js(),r=JSON.stringify(ev(t));return E.useMemo(()=>Jp(n,JSON.parse(r),i,e==="path"),[n,r,i,e])}function hA(n,e){return k6(n,e)}function k6(n,e,t){In(qc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=E.useContext(ks),{matches:r}=E.useContext(yr),l=r[r.length-1],u=l?l.params:{},h=l?l.pathname:"/",d=l?l.pathnameBase:"/",p=l&&l.route;{let w=p&&p.path||"";L6(h,!p||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. 11 12Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let m=js(),g;if(e){let w=typeof e=="string"?Vc(e):e;In(d==="/"||w.pathname?.startsWith(d),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${w.pathname}" was given in the \`location\` prop.`),g=w}else g=m;let b=g.pathname||"/",y=b;if(d!=="/"){let w=d.replace(/^\//,"").split("/");y="/"+b.replace(/^\//,"").split("/").slice(w.length).join("/")}let _=_6(n,{pathname:y});Ys(p||_!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Ys(_==null||_[_.length-1].route.element!==void 0||_[_.length-1].route.Component!==void 0||_[_.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let C=xA(_&&_.map(w=>Object.assign({},w,{params:Object.assign({},u,w.params),pathname:Lr([d,i.encodeLocation?i.encodeLocation(w.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?d:Lr([d,i.encodeLocation?i.encodeLocation(w.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),r,t);return e&&C?E.createElement(Yd.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},C):C}function fA(){let n=wA(),e=eA(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),t=n instanceof Error?n.stack:null,i="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:i},l={padding:"2px 4px",backgroundColor:i},u=null;return console.error("Error handled by React Router default ErrorBoundary:",n),u=E.createElement(E.Fragment,null,E.createElement("p",null,"ð¿ Hey developer ð"),E.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",E.createElement("code",{style:l},"ErrorBoundary")," or"," ",E.createElement("code",{style:l},"errorElement")," prop on your route.")),E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},e),t?E.createElement("pre",{style:r},t):null,u)}var pA=E.createElement(fA,null),j6=class extends E.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,e){return e.location!==n.location||e.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:e.error,location:e.location,revalidation:n.revalidation||e.revalidation}}componentDidCatch(n,e){this.props.onError?this.props.onError(n,e):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const t=cA(n.digest);t&&(n=t)}let e=n!==void 0?E.createElement(yr.Provider,{value:this.props.routeContext},E.createElement(tv.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?E.createElement(mA,{error:n},e):e}};j6.contextType=iA;
12var Xg=new WeakMap;function mA({children:n,error:e}){let{basename:t}=E.useContext(ks);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let i=lA(e.digest);if(i){let r=Xg.get(e);if(r)throw r;let l=C6(i.location,t);if(E6&&!Xg.get(e))if(l.isExternal||i.reloadDocument)window.location.href=l.absoluteURL||l.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:i.replace}));throw Xg.set(e,u),u}return E.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return n}function gA({routeContext:n,match:e,children:t}){let i=E.useContext(Gc);return i&&i.static&&i.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=e.route.id),E.createElement(yr.Provider,{value:n},t)}function xA(n,e=[],t){let i=t?.state;if(n==null){if(!i)return null;if(i.errors)n=i.matches;else if(e.length===0&&!i.initialized&&i.matches.length>0)n=i.matches;else return null}let r=n,l=i?.errors;if(l!=null){let m=r.findIndex(g=>g.route.id&&l?.[g.route.id]!==void 0);In(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),r=r.slice(0,Math.min(r.length,m+1))}let u=!1,h=-1;if(t&&i){u=i.renderFallback;for(let m=0;m<r.length;m++){let g=r[m];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(h=m),g.route.id){let{loaderData:b,errors:y}=i,_=g.route.loader&&!b.hasOwnProperty(g.route.id)&&(!y||y[g.route.id]===void 0);if(g.route.lazy||_){t.isStatic&&(u=!0),h>=0?r=r.slice(0,h+1):r=[r[0]];break}}}}let d=t?.onError,p=i&&d?(m,g)=>{d(m,{location:i.location,params:i.matches?.[0]?.params??{},unstable_pattern:tA(i.matches),errorInfo:g})}:void 0;return r.reduceRight((m,g,b)=>{let y,_=!1,C=null,w=null;i&&(y=l&&g.route.id?l[g.route.id]:void 0,C=g.route.errorElement||pA,u&&(h<0&&b===0?(L6("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),_=!0,w=null):h===b&&(_=!0,w=g.route.hydrateFallbackElement||null)));let S=e.concat(r.slice(0,b+1)),T=()=>{let N;return y?N=C:_?N=w:g.route.Component?N=E.createElement(g.route.Component,null):g.route.element?N=g.route.element:N=m,E.createElement(gA,{match:g,routeContext:{outlet:m,matches:S,isDataRoute:i!=null},children:N})};return i&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?E.createElement(j6,{location:i.location,revalidation:i.revalidation,component:C,error:y,children:T(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:p}):T()},null)}function iv(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bA(n){let e=E.useContext(Gc);return In(e,iv(n)),e}function vA(n){let e=E.useContext(em);return In(e,iv(n)),e}function yA(n){let e=E.useContext(yr);return In(e,iv(n)),e}function sv(n){let e=yA(n),t=e.matches[e.matches.length-1];return In(t.route.id,`${n} can only be used on routes that contain a unique "id"`),t.route.id}function _A(){return sv("useRouteId")}function wA(){let n=E.useContext(tv),e=vA("useRouteError"),t=sv("useRouteError");return n!==void 0?n:e.errors?.[t]}function SA(){let{router:n}=bA("useNavigate"),e=sv("useNavigate"),t=E.useRef(!1);return R6(()=>{t.current=!0}),E.useCallback(async(r,l={})=>{Ys(t.current,A6),t.current&&(typeof r=="number"?await n.navigate(r):await n.navigate(r,{fromRouteId:e,...l}))},[n,e])}var m3={};function L6(n,e,t){!e&&!m3[n]&&(m3[n]=!0,Ys(!1,t))}E.memo(EA);function EA({routes:n,future:e,state:t,isStatic:i,onError:r}){return k6(n,void 0,{state:t,isStatic:i,onError:r})}function pd({to:n,replace:e,state:t,relative:i}){In(qc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=E.useContext(ks);Ys(!r,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:l}=E.useContext(yr),{pathname:u}=js(),h=ml(),d=Jp(n,ev(l),u,i==="path"),p=JSON.stringify(d);return E.useEffect(()=>{h(JSON.parse(p),{replace:e,state:t,relative:i})},[h,p,i,e,t]),null}function on(n){In(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function CA({basename:n="/",children:e=null,location:t,navigationType:i="POP",navigator:r,static:l=!1,unstable_useTransitions:u}){In(!qc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=n.replace(/^\/*/,"/"),d=E.useMemo(()=>({basename:h,navigator:r,static:l,unstable_useTransitions:u,future:{}}),[h,r,l,u]);typeof t=="string"&&(t=Vc(t));let{pathname:p="/",search:m="",hash:g="",state:b=null,key:y="default",unstable_mask:_}=t,C=E.useMemo(()=>{let w=Aa(p,h);return w==null?null:{location:{pathname:w,search:m,hash:g,state:b,key:y,unstable_mask:_},navigationType:i}},[h,p,m,g,b,y,i,_]);
12return Ys(C!=null,`<Router basename="${h}"> is not able to match the URL "${p}${m}${g}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:E.createElement(ks.Provider,{value:d},E.createElement(Yd.Provider,{children:e,value:C}))}function NA({children:n,location:e}){return hA(u1(n),e)}function u1(n,e=[]){let t=[];return E.Children.forEach(n,(i,r)=>{if(!E.isValidElement(i))return;let l=[...e,r];if(i.type===E.Fragment){t.push.apply(t,u1(i.props.children,l));return}In(i.type===on,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),In(!i.props.index||!i.props.children,"An index route cannot have child routes.");let u={id:i.props.id||l.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(u.children=u1(i.props.children,l)),t.push(u)}),t}var gp="get",xp="application/x-www-form-urlencoded";function tm(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function TA(n){return tm(n)&&n.tagName.toLowerCase()==="button"}function MA(n){return tm(n)&&n.tagName.toLowerCase()==="form"}function AA(n){return tm(n)&&n.tagName.toLowerCase()==="input"}function RA(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function kA(n,e){return n.button===0&&(!e||e==="_self")&&!RA(n)}function d1(n=""){return new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((e,t)=>{let i=n[t];return e.concat(Array.isArray(i)?i.map(r=>[t,r]):[[t,i]])},[]))}function jA(n,e){let t=d1(n);return e&&e.forEach((i,r)=>{t.has(r)||e.getAll(r).forEach(l=>{t.append(r,l)})}),t}var bf=null;function LA(){if(bf===null)try{new FormData(document.createElement("form"),0),bf=!1}catch{bf=!0}return bf}var PA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Yg(n){return n!=null&&!PA.has(n)?(Ys(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${xp}"`),null):n}function OA(n,e){let t,i,r,l,u;if(MA(n)){let h=n.getAttribute("action");i=h?Aa(h,e):null,t=n.getAttribute("method")||gp,r=Yg(n.getAttribute("enctype"))||xp,l=new FormData(n)}else if(TA(n)||AA(n)&&(n.type==="submit"||n.type==="image")){let h=n.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let d=n.getAttribute("formaction")||h.getAttribute("action");if(i=d?Aa(d,e):null,t=n.getAttribute("formmethod")||h.getAttribute("method")||gp,r=Yg(n.getAttribute("formenctype"))||Yg(h.getAttribute("enctype"))||xp,l=new FormData(h,n),!LA()){let{name:p,type:m,value:g}=n;if(m==="image"){let b=p?`${p}.`:"";l.append(`${b}x`,"0"),l.append(`${b}y`,"0")}else p&&l.append(p,g)}}else{if(tm(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');t=gp,i=null,r=xp,u=n}return l&&r==="text/plain"&&(u=l,l=void 0),{action:i,method:t.toLowerCase(),encType:r,formData:l,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function rv(n,e){if(n===!1||n===null||typeof n>"u")throw new Error(e)}function DA(n,e,t,i){let r=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return t?r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${i}`:r.pathname=`${r.pathname}.${i}`:r.pathname==="/"?r.pathname=`_root.${i}`:e&&Aa(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${i}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${i}`,r}async function UA(n,e){if(n.id in e)return e[n.id];try{let t=await import(n.module);return e[n.id]=t,t}catch(t){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.
12isSpaMode,window.location.reload(),new Promise(()=>{})}}function IA(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function zA(n,e,t){let i=await Promise.all(n.map(async r=>{let l=e.routes[r.route.id];if(l){let u=await UA(l,t);return u.links?u.links():[]}return[]}));return HA(i.flat(1).filter(IA).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function g3(n,e,t,i,r,l){let u=(d,p)=>t[p]?d.route.id!==t[p].route.id:!0,h=(d,p)=>t[p].pathname!==d.pathname||t[p].route.path?.endsWith("*")&&t[p].params["*"]!==d.params["*"];return l==="assets"?e.filter((d,p)=>u(d,p)||h(d,p)):l==="data"?e.filter((d,p)=>{let m=i.routes[d.route.id];if(!m||!m.hasLoader)return!1;if(u(d,p)||h(d,p))return!0;if(d.route.shouldRevalidate){let g=d.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:t[0]?.params||{},nextUrl:new URL(n,window.origin),nextParams:d.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function $A(n,e,{includeHydrateFallback:t}={}){return FA(n.map(i=>{let r=e.routes[i.route.id];if(!r)return[];let l=[r.module];return r.clientActionModule&&(l=l.concat(r.clientActionModule)),r.clientLoaderModule&&(l=l.concat(r.clientLoaderModule)),t&&r.hydrateFallbackModule&&(l=l.concat(r.hydrateFallbackModule)),r.imports&&(l=l.concat(r.imports)),l}).flat(1))}function FA(n){return[...new Set(n)]}function BA(n){let e={},t=Object.keys(n).sort();for(let i of t)e[i]=n[i];return e}function HA(n,e){let t=new Set;return new Set(e),n.reduce((i,r)=>{let l=JSON.stringify(BA(r));return t.has(l)||(t.add(l),i.push({key:l,link:r})),i},[])}function P6(){let n=E.useContext(Gc);return rv(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function VA(){let n=E.useContext(em);return rv(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var av=E.createContext(void 0);av.displayName="FrameworkContext";function O6(){let n=E.useContext(av);return rv(n,"You must render this element inside a <HydratedRouter> element"),n}function GA(n,e){let t=E.useContext(av),[i,r]=E.useState(!1),[l,u]=E.useState(!1),{onFocus:h,onBlur:d,onMouseEnter:p,onMouseLeave:m,onTouchStart:g}=e,b=E.useRef(null);E.useEffect(()=>{if(n==="render"&&u(!0),n==="viewport"){let C=S=>{S.forEach(T=>{u(T.isIntersecting)})},w=new IntersectionObserver(C,{threshold:.5});return b.current&&w.observe(b.current),()=>{w.disconnect()}}},[n]),E.useEffect(()=>{if(i){let C=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(C)}}},[i]);let y=()=>{r(!0)},_=()=>{r(!1),u(!1)};return t?n!=="intent"?[l,b,{}]:[l,b,{onFocus:Ju(h,y),onBlur:Ju(d,_),onMouseEnter:Ju(p,y),onMouseLeave:Ju(m,_),onTouchStart:Ju(g,y)}]:[!1,b,{}]}function Ju(n,e){return t=>{n&&n(t),t.defaultPrevented||e(t)}}function qA({page:n,...e}){let{router:t}=P6(),i=E.useMemo(()=>_6(t.routes,n,t.basename),[t.routes,n,t.basename]);return i?E.createElement(XA,{page:n,matches:i,...e}):null}function WA(n){let{manifest:e,routeModules:t}=O6(),[i,r]=E.useState([]);return E.useEffect(()=>{let l=!1;return zA(n,e,t).then(u=>{l||r(u)}),()=>{l=!0}},[n,e,t]),i}function XA({page:n,matches:e,...t}){let i=js(),{future:r,manifest:l,routeModules:u}=O6(),{basename:h}=P6(),{loaderData:d,matches:p}=VA(),m=E.useMemo(()=>g3(n,e,p,l,i,"data"),[n,e,p,l,i]),g=E.useMemo(()=>g3(n,e,p,l,i,"assets"),[n,e,p,l,i]),b=E.useMemo(()=>{if(n===i.pathname+i.search+i.hash)return[];let C=new Set,w=!1;if(e.forEach(T=>{let N=l.routes[T.route.id];!N||!N.hasLoader||(!m.some(j=>j.route.id===T.route.id)&&T.route.id in d&&u[T.route.id]?.shouldRevalidate||N.hasClientLoader?w=!0:C.add(T.route.id))}),C.size===0)return[];let S=DA(n,h,r.unstable_trailingSlashAwareDataRequests,"data");return w&&C.size>0&&S.searchParams.set("_routes",e.filter(T=>C.has(T.route.id)).map(T=>T.route.id).join(",")),[S.pathname+S.search]},[h,r.unstable_trailingSlashAwareDataRequests,d,i,l,m,e,n,u]),y=E.useMemo(()=>$A(g,l),[g,l]),_=WA(g);return E.createElement(E.Fragment,null,b.map(C=>E.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...t})),y.map(C=>E.createElement("link",{key:C,rel:"modulepreload",href:C,...t})),_.map(({key:C,link:w})=>E.createElement("link",{key:C,nonce:t.nonce,...w,crossOrigin:w.crossOrigin??t.crossOrigin})))}function YA(...n){return e=>
12{n.forEach(t=>{typeof t=="function"?t(e):t!=null&&(t.current=e)})}}var KA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{KA&&(window.__reactRouterVersion="7.13.1")}catch{}function ZA({basename:n,children:e,unstable_useTransitions:t,window:i}){let r=E.useRef();r.current==null&&(r.current=RM({window:i,v5Compat:!0}));let l=r.current,[u,h]=E.useState({action:l.action,location:l.location}),d=E.useCallback(p=>{t===!1?h(p):E.startTransition(()=>h(p))},[t]);return E.useLayoutEffect(()=>l.listen(d),[l,d]),E.createElement(CA,{basename:n,children:e,location:u.location,navigationType:u.action,navigator:l,unstable_useTransitions:t})}var D6=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ut=E.forwardRef(function({onClick:e,discover:t="render",prefetch:i="none",relative:r,reloadDocument:l,replace:u,unstable_mask:h,state:d,target:p,to:m,preventScrollReset:g,viewTransition:b,unstable_defaultShouldRevalidate:y,..._},C){let{basename:w,navigator:S,unstable_useTransitions:T}=E.useContext(ks),N=typeof m=="string"&&D6.test(m),j=C6(m,w);m=j.to;let O=uA(m,{relative:r}),R=js(),z=null;if(h){let F=Jp(h,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);w!=="/"&&(F.pathname=F.pathname==="/"?w:Lr([w,F.pathname])),z=S.createHref(F)}let[M,P,G]=GA(i,_),U=e9(m,{replace:u,unstable_mask:h,state:d,target:p,preventScrollReset:g,relative:r,viewTransition:b,unstable_defaultShouldRevalidate:y,unstable_useTransitions:T});function Y(F){e&&e(F),F.defaultPrevented||U(F)}let W=!(j.isExternal||l),J=E.createElement("a",{..._,...G,href:(W?z:void 0)||j.absoluteURL||O,onClick:W?Y:e,ref:YA(C,P),target:p,"data-discover":!N&&t==="render"?"true":void 0});return M&&!N?E.createElement(E.Fragment,null,J,E.createElement(qA,{page:O})):J});Ut.displayName="Link";var U6=E.forwardRef(function({"aria-current":e="page",caseSensitive:t=!1,className:i="",end:r=!1,style:l,to:u,viewTransition:h,children:d,...p},m){let g=Kd(u,{relative:p.relative}),b=js(),y=E.useContext(em),{navigator:_,basename:C}=E.useContext(ks),w=y!=null&&r9(g)&&h===!0,S=_.encodeLocation?_.encodeLocation(g).pathname:g.pathname,T=b.pathname,N=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;t||(T=T.toLowerCase(),N=N?N.toLowerCase():null,S=S.toLowerCase()),N&&C&&(N=Aa(N,C)||N);const j=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let O=T===S||!r&&T.startsWith(S)&&T.charAt(j)==="/",R=N!=null&&(N===S||!r&&N.startsWith(S)&&N.charAt(S.length)==="/"),z={isActive:O,isPending:R,isTransitioning:w},M=O?e:void 0,P;typeof i=="function"?P=i(z):P=[i,O?"active":null,R?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let G=typeof l=="function"?l(z):l;return E.createElement(Ut,{...p,"aria-current":M,className:P,ref:m,style:G,to:u,viewTransition:h},typeof d=="function"?d(z):d)});U6.displayName="NavLink";var QA=E.forwardRef(({discover:n="render",fetcherKey:e,navigate:t,reloadDocument:i,replace:r,state:l,method:u=gp,action:h,onSubmit:d,relative:p,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:b,...y},_)=>{let{unstable_useTransitions:C}=E.useContext(ks),w=i9(),S=s9(h,{relative:p}),T=u.toLowerCase()==="get"?"get":"post",N=typeof h=="string"&&D6.test(h),j=O=>{if(d&&d(O),O.defaultPrevented)return;O.preventDefault();let R=O.nativeEvent.submitter,z=R?.getAttribute("formmethod")||u,M=()=>w(R||O.currentTarget,{fetcherKey:e,method:z,navigate:t,replace:r,state:l,relative:p,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:b});C&&t!==!1?E.startTransition(()=>M()):M()};return E.createElement("form",{ref:_,method:T,action:S,onSubmit:i?d:j,...y,"data-discover":!N&&n==="render"?"true":void 0})});QA.displayName="Form";function JA(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function I6(n){let e=E.useContext(Gc);return In(e,JA(n)),e}function e9(n,{target:e,replace:t,unstable_mask:i,state:r,preventScrollReset:l,relative:u,viewTransition:h,unstable_defaultShouldRevalidate:d,unstable_useTransitions:p}={}){let m=ml(),g=js(),b=Kd(n,{relative:u});return E.useCallback(y=>{if(kA(y,e)){y.preventDefault();let _=t!==void 0?t:Pd(g)===Pd(b),C=()=>m(n,{replace:_,unstable_mask:i,state:r,preventScrollReset:l,relative:u,viewTransition:h,unstable_defaultShouldRevalidate:d});p?E.startTransition(()=>C()):C()}}
12,[g,m,b,t,i,r,e,n,l,u,h,d,p])}function Ki(n){Ys(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let e=E.useRef(d1(n)),t=E.useRef(!1),i=js(),r=E.useMemo(()=>jA(i.search,t.current?null:e.current),[i.search]),l=ml(),u=E.useCallback((h,d)=>{const p=d1(typeof h=="function"?h(new URLSearchParams(r)):h);t.current=!0,l("?"+p,d)},[l,r]);return[r,u]}var t9=0,n9=()=>`__${String(++t9)}__`;function i9(){let{router:n}=I6("useSubmit"),{basename:e}=E.useContext(ks),t=_A(),i=n.fetch,r=n.navigate;return E.useCallback(async(l,u={})=>{let{action:h,method:d,encType:p,formData:m,body:g}=OA(l,e);if(u.navigate===!1){let b=u.fetcherKey||n9();await i(b,t,u.action||h,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:m,body:g,formMethod:u.method||d,formEncType:u.encType||p,flushSync:u.flushSync})}else await r(u.action||h,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:m,body:g,formMethod:u.method||d,formEncType:u.encType||p,replace:u.replace,state:u.state,fromRouteId:t,flushSync:u.flushSync,viewTransition:u.viewTransition})},[i,r,e,t])}function s9(n,{relative:e}={}){let{basename:t}=E.useContext(ks),i=E.useContext(yr);In(i,"useFormAction must be used inside a RouteContext");let[r]=i.matches.slice(-1),l={...Kd(n||".",{relative:e})},u=js();if(n==null){l.search=u.search;let h=new URLSearchParams(l.search),d=h.getAll("index");if(d.some(m=>m==="")){h.delete("index"),d.filter(g=>g).forEach(g=>h.append("index",g));let m=h.toString();l.search=m?`?${m}`:""}}return(!n||n===".")&&r.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),t!=="/"&&(l.pathname=l.pathname==="/"?t:Lr([t,l.pathname])),Pd(l)}function r9(n,{relative:e}={}){let t=E.useContext(T6);In(t!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=I6("useViewTransitionState"),r=Kd(n,{relative:e});if(!t.isTransitioning)return!1;let l=Aa(t.currentLocation.pathname,i)||t.currentLocation.pathname,u=Aa(t.nextLocation.pathname,i)||t.nextLocation.pathname;return kp(r.pathname,u)!=null||kp(r.pathname,l)!=null}y6();const a9="modulepreload",o9=function(n){return"/"+n},x3={},xr=function(e,t,i){let r=Promise.resolve();if(t&&t.length>0){let d=function(p){return Promise.all(p.map(m=>Promise.resolve(m).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),h=u?.nonce||u?.getAttribute("nonce");r=d(t.map(p=>{if(p=o9(p),p in x3)return;x3[p]=!0;const m=p.endsWith(".css"),g=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const b=document.createElement("link");if(b.rel=m?"stylesheet":a9,m||(b.as="script"),b.crossOrigin="",b.href=p,h&&b.setAttribute("nonce",h),document.head.appendChild(b),m)return new Promise((y,_)=>{b.addEventListener("load",y),b.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${p}`)))})}))}function l(u){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return r.then(u=>{for(const h of u||[])h.status==="rejected"&&l(h.reason);return e().catch(l)})};function l9(n={}){const{immediate:e=!1,onNeedRefresh:t,onOfflineReady:i,onRegistered:r,onRegisteredSW:l,onRegisterError:u}=n;let h,d;const p=async(g=!0)=>{await d};async function m(){if("serviceWorker"in navigator){if(h=await xr(async()=>{const{Workbox:g}=await import("./workbox-window.prod.es5-BIl4cyR9.js");return{Workbox:g}},[]).then(({Workbox:g})=>new g("/sw.js",{scope:"/",type:"classic"})).catch(g=>{u?.(g)}),!h)return;h.addEventListener("activated",g=>{(g.isUpdate||g.isExternal)&&window.location.reload()}
12),h.addEventListener("installed",g=>{g.isUpdate||i?.()}),h.register({immediate:e}).then(g=>{l?l("/sw.js",g):r?.(g)}).catch(g=>{u?.(g)})}}return d=m(),p}var c9=Object.defineProperty,u9=Object.defineProperties,d9=Object.getOwnPropertyDescriptors,jp=Object.getOwnPropertySymbols,z6=Object.prototype.hasOwnProperty,$6=Object.prototype.propertyIsEnumerable,h1=(n,e,t)=>e in n?c9(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Cs=(n,e)=>{for(var t in e||(e={}))z6.call(e,t)&&h1(n,t,e[t]);if(jp)for(var t of jp(e))$6.call(e,t)&&h1(n,t,e[t]);return n},F6=(n,e)=>u9(n,d9(e)),h9=(n,e)=>{var t={};for(var i in n)z6.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&jp)for(var i of jp(n))e.indexOf(i)<0&&$6.call(n,i)&&(t[i]=n[i]);return t},wi=(n,e,t)=>(h1(n,typeof e!="symbol"?e+"":e,t),t),Lc=(n,e,t)=>new Promise((i,r)=>{var l=d=>{try{h(t.next(d))}catch(p){r(p)}},u=d=>{try{h(t.throw(d))}catch(p){r(p)}},h=d=>d.done?i(d.value):Promise.resolve(d.value).then(l,u);h((t=t.apply(n,e)).next())}),f9="hCaptcha-script",bp="hCaptchaOnLoad",b3="script-error",po="@hCaptcha/loader";function p9(n){return Object.entries(n).filter(([,e])=>e||e===!1).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(String(t))}`).join("&")}function B6(n){let e=n&&n.ownerDocument||document,t=e.defaultView||e.parentWindow||window;return{document:e,window:t}}function H6(n){return n||document.head}function m9(n){var e;n.setTag("source",po),n.setTag("url",document.URL),n.setContext("os",{UA:navigator.userAgent}),n.setContext("browser",Cs({},g9())),n.setContext("device",F6(Cs({},b9()),{screen_width_pixels:screen.width,screen_height_pixels:screen.height,language:navigator.language,orientation:((e=screen.orientation)==null?void 0:e.type)||"Unknown",processor_count:navigator.hardwareConcurrency,platform:navigator.platform}))}function g9(){var n,e,t,i,r,l;let u=navigator.userAgent,h,d;return u.indexOf("Firefox")!==-1?(h="Firefox",d=(n=u.match(/Firefox\/([\d.]+)/))==null?void 0:n[1]):u.indexOf("Edg")!==-1?(h="Microsoft Edge",d=(e=u.match(/Edg\/([\d.]+)/))==null?void 0:e[1]):u.indexOf("Chrome")!==-1&&u.indexOf("Safari")!==-1?(h="Chrome",d=(t=u.match(/Chrome\/([\d.]+)/))==null?void 0:t[1]):u.indexOf("Safari")!==-1&&u.indexOf("Chrome")===-1?(h="Safari",d=(i=u.match(/Version\/([\d.]+)/))==null?void 0:i[1]):u.indexOf("Opera")!==-1||u.indexOf("OPR")!==-1?(h="Opera",d=(r=u.match(/(Opera|OPR)\/([\d.]+)/))==null?void 0:r[2]):u.indexOf("MSIE")!==-1||u.indexOf("Trident")!==-1?(h="Internet Explorer",d=(l=u.match(/(MSIE |rv:)([\d.]+)/))==null?void 0:l[2]):(h="Unknown",d="Unknown"),{name:h,version:d}}function x9(n){return new Promise(e=>setTimeout(e,n))}function b9(){let n=navigator.userAgent,e;n.indexOf("Win")!==-1?e="Windows":n.indexOf("Mac")!==-1?e="Mac":n.indexOf("Linux")!==-1?e="Linux":n.indexOf("Android")!==-1?e="Android":n.indexOf("like Mac")!==-1||n.indexOf("iPhone")!==-1||n.indexOf("iPad")!==-1?e="iOS":e="Unknown";let t;return/Mobile|iPhone|iPod|Android/i.test(n)?t="Mobile":/Tablet|iPad/i.test(n)?t="Tablet":t="Desktop",{model:e,family:e,device:t}}var v9=class V6{constructor(e){wi(this,"_parent"),wi(this,"breadcrumbs",[]),wi(this,"context",{}),wi(this,"extra",{}),wi(this,"tags",{}),wi(this,"request"),wi(this,"user"),this._parent=e}get parent(){return this._parent}child(){return new V6(this)}setRequest(e){return this.request=e,this}removeRequest(){return this.request=void 0,this}addBreadcrumb(e){return typeof e.timestamp>"u"&&(e.timestamp=new Date().toISOString()),this.breadcrumbs.push(e),this}setExtra(e,t){return this.extra[e]=t,this}removeExtra(e){return delete this.extra[e],this}setContext(e,t){return typeof t.type>"u"&&(t.type=e),this.context[e]=t,this}removeContext(e){return delete this.context[e],this}setTags(e){return this.tags=Cs(Cs({},this.tags),e),this}setTag(e,t){return this.tags[e]=t,this}removeTag(e){return delete this.tags[e],this}setUser(e){return this.user=e,this}removeUser(){return this.user=void 0,this}toBody(){let e=[],t=this;for(;t;)e.push(t),t=t.parent;return e.reverse().reduce((i,r)=>{var l;return i.breadcrumbs=[...(l=i.breadcrumbs)!=null?l:[],...r.breadcrumbs],i.extra=Cs(Cs({},i.extra),r.extra),i.contexts=Cs(Cs({},i.contexts),r.context),i.tags=Cs(Cs({},i.tags),r.tags),r.user&&(i.user=r.user),r.request&&(i.request=r.request),i},{breadcrumbs:[],extra:{},contexts:{},tags:{},request:void 0,user:void 0})}clear(){this.breadcrumbs=[],this.context={},this.tags={},this.user=void 0}},y9=/^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,_9=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js))(?::(\d+))?(?::(\d+))?\s*$/i,w9=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,S9=
12/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w.-]+)(?::(\d+))?\/(.+)/,vf="?",v3="An unknown error occurred",E9="0.0.4";function C9(n){for(let e=0;e<n.length;e++)n[e]=Math.floor(Math.random()*256);return n}function Oi(n){return(n+256).toString(16).substring(1)}function N9(){let n=C9(new Array(16));return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Oi(n[0])+Oi(n[1])+Oi(n[2])+Oi(n[3])+"-"+Oi(n[4])+Oi(n[5])+"-"+Oi(n[6])+Oi(n[7])+"-"+Oi(n[8])+Oi(n[9])+"-"+Oi(n[10])+Oi(n[11])+Oi(n[12])+Oi(n[13])+Oi(n[14])+Oi(n[15])}var T9=[[y9,"chrome"],[w9,"winjs"],[_9,"gecko"]];function M9(n){var e,t,i,r;if(!n.stack)return null;let l=[],u=(i=(t=(e=n.stack).split)==null?void 0:t.call(e,` 13`))!=null?i:[];for(let h=0;h<u.length;++h){let d=null,p=null,m=null;for(let[g,b]of T9)if(p=g.exec(u[h]),p){m=b;break}if(!(!p||!m)){if(m==="chrome")d={filename:(r=p[2])!=null&&r.startsWith("address at ")?p[2].substring(11):p[2],function:p[1]||vf,lineno:p[3]?+p[3]:null,colno:p[4]?+p[4]:null};else if(m==="winjs")d={filename:p[2],function:p[1]||vf,lineno:+p[3],colno:p[4]?+p[4]:null};else if(m==="gecko")h===0&&!p[5]&&n.columnNumber!==void 0&&l.length>0&&(l[0].column=n.columnNumber+1),d={filename:p[3],function:p[1]||vf,lineno:p[4]?+p[4]:null,colno:p[5]?+p[5]:null};else continue;!d.function&&d.lineno&&(d.function=vf),l.push(d)}}return l.length?l.reverse():null}function A9(n){let e=M9(n);return{type:n.name,value:n.message,stacktrace:{frames:e??[]}}}function R9(n){let e=S9.exec(n),t=e?e.slice(1):[];if(t.length!==6)throw new Error("Invalid DSN");let i=t[5].split("/"),r=i.slice(0,-1).join("/");return t[0]+"://"+t[3]+(t[4]?":"+t[4]:"")+(r?"/"+r:"")+"/api/"+i.pop()+"/envelope/?sentry_version=7&sentry_key="+t[1]+(t[2]?"&sentry_secret="+t[2]:"")}function k9(n,e,t){var i,r;let l=Cs({event_id:N9().replaceAll("-",""),platform:"javascript",sdk:{name:"@hcaptcha/sentry",version:E9},environment:e,release:t,timestamp:Date.now()/1e3},n.scope.toBody());if(n.type==="exception"){l.message=(r=(i=n.error)==null?void 0:i.message)!=null?r:"Unknown error",l.fingerprint=[l.message];let u=[],h=n.error;for(let d=0;d<5&&h&&(u.push(A9(h)),!(!h.cause||!(h.cause instanceof Error)));d++)h=h.cause;l.exception={values:u.reverse()}}return n.type==="message"&&(l.message=n.message,l.level=n.level),l}function j9(n){if(n instanceof Error)return n;if(typeof n=="string")return new Error(n);if(typeof n=="object"&&n!==null&&!Array.isArray(n)){let t=n,{message:i}=t,r=h9(t,["message"]),l=new Error(typeof i=="string"?i:v3);return Object.assign(l,r)}let e=new Error(v3);return Object.assign(e,{cause:n})}function L9(n,e,t){return Lc(this,null,function*(){var i,r;try{if(typeof fetch<"u"&&typeof AbortSignal<"u"){let l;if(t){let d=new AbortController;l=d.signal,setTimeout(()=>d.abort(),t)}let u=yield fetch(n,F6(Cs({},e),{signal:l})),h=yield u.text();return{status:u.status,body:h}}return yield new Promise((l,u)=>{var h,d;let p=new XMLHttpRequest;if(p.open((h=e?.method)!=null?h:"GET",n),p.onload=()=>l({status:p.status,body:p.responseText}),p.onerror=()=>u(new Error("XHR Network Error")),e?.headers)for(let[m,g]of Object.entries(e.headers))p.setRequestHeader(m,g);if(t){let m=setTimeout(()=>{p.abort(),u(new Error("Request timed out"))},t);p.onloadend=()=>{clearTimeout(m)}}p.send((d=e?.body)==null?void 0:d.toString())})}catch(l){return{status:0,body:(r=(i=l?.toString)==null?void 0:i.call(l))!=null?r:"Unknown error"}}})}var is,f1=(is=class{constructor(n){wi(this,"apiURL"),wi(this,"dsn"),wi(this,"environment"),wi(this,"release"),wi(this,"sampleRate"),wi(this,"debug"),wi(this,"_scope"),wi(this,"shouldBuffer",!1),wi(this,"bufferlimit",20),wi(this,"buffer",[]);var e,t,i,r,l;this.environment=n.environment,this.release=n.release,this.sampleRate=(e=n.sampleRate)!=null?e:1,this.debug=(t=n.debug)!=null?t:!1,this._scope=(i=n.scope)!=null?i:new v9,this.apiURL=R9(n.dsn),this.dsn=n.dsn,this.shouldBuffer=(r=n.buffer)!=null?r:!1,this.bufferlimit=(l=n.bufferLimit)!=null?l:20}static init(n){is._instance||(is._instance=new is(n))}static get instance(){if(!is._instance)throw new Error("Sentry has not been initialized");return is._instance}log(...n){this.debug&&console.log(...n)}get scope(){return this._scope}static get scope(){return is.instance.scope}withScope(n){let e=this._scope.child();n(e)}static withScope(n){is.instance.withScope(n)}captureException(n,e){this.captureEvent({type:"exception",level:"error",error:j9(n),scope:e??this._scope})}static captureException(n,e){is.instance.captureException(n,e)}captureMessage(n,e="info",t){this.captureEvent({type:"message",level:e,message:n,scope:t??this._scope})}static captureMessage(n,e="info",t){is.instance.captureMessage(n,e,t)}captureEvent(n){if(Math.random()>=this.sampleRate){this.log("Dropped event due to sample rate");return}if(this.shouldBuffer){if(this.buffer.length>=this.bufferlimit)return;this.buffer.push(n)}else this.sendEvent(n)}sendEvent(n,e=5e3){return Lc(this,null,function*(){try{this.log("Sending sentry event",n);let t=k9(n,this.environment,this.release),i={event_id:t.event_id,dsn:this.dsn}
13,r={type:"event"},l=JSON.stringify(i)+` 14`+JSON.stringify(r)+` 15`+JSON.stringify(t),u=yield L9(this.apiURL,{method:"POST",headers:{"Content-Type":"application/x-sentry-envelope"},body:l},e);this.log("Sentry response",u.status),u.status!==200&&(console.log(u.body),console.error("Failed to send event to Sentry",u))}catch(t){console.error("Failed to send event",t)}})}flush(n=5e3){return Lc(this,null,function*(){try{this.log("Flushing sentry events",this.buffer.length);let e=this.buffer.splice(0,this.buffer.length).map(t=>this.sendEvent(t,n));yield Promise.all(e),this.log("Flushed all events")}catch(e){console.error("Failed to flush events",e)}})}static flush(n=5e3){return is.instance.flush(n)}static reset(){is._instance=void 0}},wi(is,"_instance"),is),P9="https://[email protected]/6",O9="2.3.0",D9="production";function U9(n=!0){if(!n)return y3();f1.init({dsn:P9,release:O9,environment:D9});let e=f1.scope;return m9(e),y3(e)}function y3(n=null){return{addBreadcrumb:e=>{n&&n.addBreadcrumb(e)},captureRequest:e=>{n&&n.setRequest(e)},captureException:e=>{n&&f1.captureException(e,n)}}}function I9({scriptLocation:n,query:e,loadAsync:t=!0,crossOrigin:i="anonymous",apihost:r="https://js.hcaptcha.com",cleanup:l=!1,secureApi:u=!1,scriptSource:h=""}={},d){let p=H6(n),m=B6(p);return new Promise((g,b)=>{let y=m.document.createElement("script");y.id=f9,h?y.src=`${h}?onload=${bp}`:u?y.src=`${r}/1/secure-api.js?onload=${bp}`:y.src=`${r}/1/api.js?onload=${bp}`,y.crossOrigin=i,y.async=t;let _=(C,w)=>{try{!u&&l&&p.removeChild(y),w(C)}catch(S){b(S)}};y.onload=C=>_(C,g),y.onerror=C=>{d&&d(y.src),_(C,b)},y.src+=e!==""?`&${e}`:"",p.appendChild(y)})}var yf=[];function z9(n={cleanup:!1},e){try{e.addBreadcrumb({category:po,message:"hCaptcha loader params",data:n});let t=H6(n.scriptLocation),i=B6(t),r=yf.find(({scope:u})=>u===i.window);if(r)return e.addBreadcrumb({category:po,message:"hCaptcha already loaded"}),r.promise;let l=new Promise((u,h)=>Lc(this,null,function*(){try{i.window[bp]=()=>{e.addBreadcrumb({category:po,message:"hCaptcha script called onload function"}),u(i.window.hcaptcha)};let d=p9({custom:n.custom,render:n.render,sentry:n.sentry,assethost:n.assethost,imghost:n.imghost,reportapi:n.reportapi,endpoint:n.endpoint,host:n.host,recaptchacompat:n.recaptchacompat,hl:n.hl,uj:n.uj});yield I9(Cs({query:d},n),p=>{e.captureRequest({url:p,method:"GET"})}),e.addBreadcrumb({category:po,message:"hCaptcha loaded",data:r})}catch{e.addBreadcrumb({category:po,message:"hCaptcha failed to load"});let p=yf.findIndex(m=>m.scope===i.window);p!==-1&&yf.splice(p,1),h(new Error(b3))}}));return yf.push({promise:l,scope:i.window}),l}catch(t){return e.captureException(t),Promise.reject(new Error(b3))}}function G6(n,e,t=0){return Lc(this,null,function*(){var i,r;let l=(i=n.maxRetries)!=null?i:2,u=(r=n.retryDelay)!=null?r:1e3,h=t<l?"Retry loading hCaptcha Api":"Exceeded maximum retries";try{return yield z9(n,e)}catch(d){return e.addBreadcrumb({category:po,message:h}),t>=l?(e.captureException(d),Promise.reject(d)):(e.addBreadcrumb({category:po,message:`Waiting ${u}ms before retry attempt ${t+1}`}),yield x9(u),t+=1,G6(n,e,t))}})}function $9(){return Lc(this,arguments,function*(n={}){let e=U9(n.sentry);return yield G6(n,e)})}function _3(n){let e=n&&n.ownerDocument||document,t=e.defaultView||e.parentWindow||window;return{document:e,window:t}}function w3(n){return n||document.head}var F9=class extends E.Component{constructor(n){super(n),this._hcaptcha=void 0,this.renderCaptcha=this.renderCaptcha.bind(this),this.resetCaptcha=this.resetCaptcha.bind(this),this.removeCaptcha=this.removeCaptcha.bind(this),this.isReady=this.isReady.bind(this),this._onReady=null,this.loadCaptcha=this.loadCaptcha.bind(this),this.handleOnLoad=this.handleOnLoad.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleExpire=this.handleExpire.bind(this),this.handleError=this.handleError.bind(this),this.handleOpen=this.handleOpen.bind(this),this.handleClose=this.handleClose.bind(this),this.handleChallengeExpired=this.handleChallengeExpired.bind(this),this.ref=E.createRef(),this.apiScriptRequested=!1,this.sentryHub=null,this.captchaId="",this._pendingExecute=null,this.state={isApiReady:!1,isRemoved:!1,elementId:n.id}}componentDidMount(){let n=w3(this.props.scriptLocation),e=_3(n);if(this._hcaptcha=e.window.hcaptcha||void 0,typeof this._hcaptcha<"u"){this.setState({isApiReady:!0},()=>{this.renderCaptcha()});return}this.loadCaptcha()}componentWillUnmount(){let n=this._hcaptcha,e=this.captchaId;if(this._cancelPendingExecute("react-component-unmounted"),!!this.isReady())try{n.reset(e),n.remove(e)}catch{}finally{this.captchaId="",this._onReady=null}}shouldComponentUpdate(n,e){return!(this.state.isApiReady!==e.isApiReady||this.state.isRemoved!==e.isRemoved)}componentDidUpdate(n){["sitekey","size","theme","tabindex","languageOverride","endpoint"].every(e=>n[e]===this.props[e])||this.removeCaptcha(()=>{this.renderCaptcha()})}loadCaptcha(){if(this.apiScriptRequested)return;let{apihost:n,assethost:e,endpoint:t,host:i,imghost:r,languageOverride:l,reCaptchaCompat:u,reportapi:h,sentry:d,custom:p,loadAsync:m,scriptLocation:g,scriptSource:b,secureApi:y,cleanup:_=!0,userJourneys:C}=this.props;$9({render:"explicit",apihost:n,assethost:e,endpoint:t,hl:l,host:i,imghost:r,re
15captchacompat:u===!1?"off":null,reportapi:h,sentry:d,custom:p,loadAsync:m,scriptLocation:g,scriptSource:b,secureApi:y,cleanup:_,uj:C!==void 0?C:!1}).then(this.handleOnLoad,this.handleError).catch(this.handleError),this.apiScriptRequested=!0}renderCaptcha(n){let{onReady:e}=this.props,{isApiReady:t}=this.state,i=this.captchaId;if(!t||i)return;let r=Object.assign({"open-callback":this.handleOpen,"close-callback":this.handleClose,"error-callback":this.handleError,"chalexpired-callback":this.handleChallengeExpired,"expired-callback":this.handleExpire,callback:this.handleSubmit},this.props,{hl:this.props.hl||this.props.languageOverride,languageOverride:void 0}),l=this._hcaptcha.render(this.ref.current,r);this.captchaId=l,this.setState({isRemoved:!1},()=>{n&&n(),e&&e(),this._onReady&&this._onReady(l)})}resetCaptcha(){let n=this._hcaptcha,e=this.captchaId;this.isReady()&&(n.reset(e),this._cancelPendingExecute("hcaptcha-reset"))}removeCaptcha(n){let e=this._hcaptcha,t=this.captchaId;this._cancelPendingExecute("hcaptcha-removed"),this.isReady()&&this.setState({isRemoved:!0},()=>{this.captchaId="",e.remove(t),n&&n()})}handleOnLoad(){this.setState({isApiReady:!0},()=>{let n=w3(this.props.scriptLocation),e=_3(n);this._hcaptcha=e.window.hcaptcha,this.renderCaptcha(()=>{let{onLoad:t}=this.props;t&&t()})})}handleSubmit(n){let{onVerify:e}=this.props,{isRemoved:t}=this.state,i=this._hcaptcha,r=this.captchaId;if(typeof i>"u"||t)return;let l=i.getResponse(r),u=i.getRespKey(r);e&&e(l,u)}handleExpire(){let{onExpire:n}=this.props,e=this._hcaptcha,t=this.captchaId;this.isReady()&&(e.reset(t),n&&n())}handleError(n){let{onError:e}=this.props,t=this._hcaptcha,i=this.captchaId;this.isReady()&&t.reset(i),e&&e(n)}isReady(){let{isApiReady:n,isRemoved:e}=this.state;return n&&!e}_cancelPendingExecute(n){if(!this._pendingExecute)return;let e=this._pendingExecute;this._pendingExecute=null;let t=new Error(n);e.reject(t)}handleOpen(){!this.isReady()||!this.props.onOpen||this.props.onOpen()}handleClose(){!this.isReady()||!this.props.onClose||this.props.onClose()}handleChallengeExpired(){!this.isReady()||!this.props.onChalExpired||this.props.onChalExpired()}execute(n=null){n=typeof n=="object"?n:null;try{let e=this._hcaptcha,t=this.captchaId;if(n&&n.async&&this._pendingExecute&&this._cancelPendingExecute("hcaptcha-execute-replaced"),!this.isReady())return n&&n.async?new Promise((r,l)=>{this._pendingExecute={resolve:r,reject:l},this._onReady=u=>{if(this._pendingExecute)try{let h=e.execute(u,n);h&&typeof h.then=="function"?h.then(d=>{this._pendingExecute=null,r(d)}).catch(d=>{this._pendingExecute=null,l(d)}):(this._pendingExecute=null,l(new Error("hcaptcha-execute-no-promise")))}catch(h){this._pendingExecute=null,l(h)}}}):(this._onReady=r=>{e.execute(r,n)},null);let i=e.execute(t,n);return n&&n.async&&i&&typeof i.then=="function"?new Promise((r,l)=>{this._pendingExecute={resolve:r,reject:l},i.then(u=>{this._pendingExecute=null,r(u)}).catch(u=>{this._pendingExecute=null,l(u)})}):i}catch(e){return n&&n.async?Promise.reject(e):null}}close(){let n=this._hcaptcha,e=this.captchaId;if(this._cancelPendingExecute("hcaptcha-closed"),!!this.isReady())return n.close(e)}setData(n){let e=this._hcaptcha,t=this.captchaId;this.isReady()&&(n&&typeof n!="object"&&(n=null),e.setData(t,n))}getResponse(){return this._hcaptcha.getResponse(this.captchaId)}getRespKey(){return this._hcaptcha.getRespKey(this.captchaId)}render(){let{elementId:n}=this.state;return E.createElement("div",{ref:this.ref,id:n})}};E.createContext();var q6=F9;const W6=(...n)=>n.filter((e,t,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===t).join(" ").trim();const B9=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const H9=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,i)=>i?i.toUpperCase():t.toLowerCase());const S3=n=>{const e=H9(n);return e.charAt(0).toUpperCase()+e.slice(1)};var V9={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const G9=n=>{for(const e in n)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};const q9=E.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:i,className:r="",children:l,iconNode:u,...h},d)=>E.createElement("svg",{ref:d,...V9,width:e,height:e,stroke:n,strokeWidth:i?Number(t)*24/Number(e):t,className:W6("lucide",r),...!l&&!G9(h)&&{"aria-hidden":"true"},...h},[...u.map(([p,m])=>E.createElement(p,m)),...Array.isArray(l)?l:[l]]));const bt=(n,e)=>{const t=E.forwardRef(({className:i,...r},l)=>E.createElement(q9,{ref:l,iconNode:e,className:W6(`lucide-${B9(S3(n))}`,`lucide-${n}`,i),...r}));return t.displayName=S3(n),t};const W9=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l
15-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],p1=bt("activity",W9);const X9=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Y9=bt("archive",X9);const K9=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],X6=bt("arrow-left",K9);const Z9=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],E3=bt("bookmark",Z9);const Q9=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],J9=bt("calendar-clock",Q9);const eR=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],C3=bt("calendar-days",eR);const tR=[["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M21 12.598V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5",key:"1glfrc"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]],nR=bt("calendar-plus",tR);const iR=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],Y6=bt("camera",iR);const sR=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],zr=bt("check",sR);const rR=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],K6=bt("chevron-down",rR);const aR=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],nm=bt("chevron-left",aR);const oR=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],im=bt("chevron-right",oR);const lR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],ov=bt("circle-alert",lR);const cR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],uR=bt("circle-check",cR);const dR=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Z6=bt("circle-play",dR);const hR=[["path",{d:"m12.296 3.464 3.02 3.956",key:"qash78"}],["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z",key:"1h7j8b"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"4lm6w1"}],["path",{d:"m6.18 5.276 3.1 3.899",key:"zjj9t3"}]],Q6=bt("clapperboard",hR);const fR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],lv=bt("clock-3",fR);const pR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],J6=bt("clock",pR);const mR=[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48",key:"bq4yh3"}],["path",{d:"M15 6h1v4",key:"11y1tn"}],["path",{d:"m6.134 14.768.866-.5 2 3.464",key:"17snzx"}],["circle",{cx:"16",cy:"8",r:"6",key:"14bfc9"}]],gR=bt("coins",mR);const xR=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Wc=bt("copy",xR);const bR=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],e5=bt("crown",bR);const vR=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],m1=bt("download",vR);const yR=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Lp=bt("external-link",yR);const _R=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],t5=bt("eye",_R);const wR=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]],Pc=bt("film",wR);const SR=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",ke
15y:"1slcih"}]],cv=bt("flame",SR);const ER=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8",key:"1sqzm4"}],["path",{d:"M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5",key:"kc0143"}],["rect",{x:"3",y:"7",width:"18",height:"4",rx:"1",key:"1hberx"}]],g1=bt("gift",ER);const CR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],n5=bt("globe",CR);const NR=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],TR=bt("history",NR);const MR=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],AR=bt("house",MR);const RR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],kR=bt("info",RR);const jR=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],LR=bt("key-round",jR);const PR=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],OR=bt("key",PR);const DR=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],fr=bt("loader-circle",DR);const UR=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],IR=bt("lock-keyhole",UR);const zR=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],x1=bt("lock-open",zR);const $R=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],FR=bt("mail",$R);const BR=[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]],HR=bt("medal",BR);const VR=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],GR=bt("message-square-text",VR);const qR=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Ts=bt("play",qR);const WR=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Od=bt("plus",WR);const XR=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],YR=bt("qr-code",XR);const KR=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],ul=bt("radio",KR);const ZR=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Dd=bt("refresh-cw",ZR);const QR=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],JR=bt("rotate-ccw",QR);const e8=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],N3=bt("save",e8);const t8=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],_d=bt("search",t8);const n8=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],i8=bt("settings",n8);const s8=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
15y:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],r8=bt("shield-alert",s8);const a8=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],o8=bt("sliders-horizontal",a8);const l8=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],pr=bt("sparkles",l8);const c8=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],dl=bt("star",c8);const u8=[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]],d8=bt("swords",u8);const h8=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],f8=bt("trash-2",h8);const p8=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],_o=bt("trophy",p8);const m8=[["path",{d:"M7 21h10",key:"1b0cd5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}]],g8=bt("tv-minimal",m8);const x8=[["path",{d:"m17 2-5 5-5-5",key:"16satq"}],["rect",{width:"20",height:"15",x:"2",y:"7",rx:"2",key:"1e6viu"}]],wo=bt("tv",x8);const b8=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],v8=bt("user-plus",b8);const y8=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],T3=bt("users",y8);const _8=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],M3=bt("wallet",_8);const w8=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ar=bt("x",w8);const S8=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],i5=bt("zap",S8);function sm(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(n);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(n,i[r])&&(t[i[r]]=n[i[r]]);return t}function E8(n,e,t,i){function r(l){return l instanceof t?l:new t(function(u){u(l)})}return new(t||(t=Promise))(function(l,u){function h(m){try{p(i.next(m))}catch(g){u(g)}}function d(m){try{p(i.throw(m))}catch(g){u(g)}}function p(m){m.done?l(m.value):r(m.value).then(h,d)}p((i=i.apply(n,e||[])).next())})}const C8=n=>n?(...e)=>n(...e):(...e)=>fetch(...e);
15class uv extends Error{constructor(e,t="FunctionsError",i){super(e),this.name=t,this.context=i}}class N8 extends uv{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class A3 extends uv{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class R3 extends uv{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var b1;(function(n){n.Any="any",n.ApNortheast1="ap-northeast-1",n.ApNortheast2="ap-northeast-2",n.ApSouth1="ap-south-1",n.ApSoutheast1="ap-southeast-1",n.ApSoutheast2="ap-southeast-2",n.CaCentral1="ca-central-1",n.EuCentral1="eu-central-1",n.EuWest1="eu-west-1",n.EuWest2="eu-west-2",n.EuWest3="eu-west-3",n.SaEast1="sa-east-1",n.UsEast1="us-east-1",n.UsWest1="us-west-1",n.UsWest2="us-west-2"})(b1||(b1={}));class T8{constructor(e,{headers:t={},customFetch:i,region:r=b1.Any}={}){this.url=e,this.headers=t,this.region=r,this.fetch=C8(i)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return E8(this,arguments,void 0,function*(t,i={}){var r;let l,u;try{const{headers:h,method:d,body:p,signal:m,timeout:g}=i;let b={},{region:y}=i;y||(y=this.region);const _=new URL(`${this.url}/${t}`);y&&y!=="any"&&(b["x-region"]=y,_.searchParams.set("forceFunctionRegion",y));let C;p&&(h&&!Object.prototype.hasOwnProperty.call(h,"Content-Type")||!h)?typeof Blob<"u"&&p instanceof Blob||p instanceof ArrayBuffer?(b["Content-Type"]="application/octet-stream",C=p):typeof p=="string"?(b["Content-Type"]="text/plain",C=p):typeof FormData<"u"&&p instanceof FormData?C=p:(b["Content-Type"]="application/json",C=JSON.stringify(p)):p&&typeof p!="string"&&!(typeof Blob<"u"&&p instanceof Blob)&&!(p instanceof ArrayBuffer)&&!(typeof FormData<"u"&&p instanceof FormData)?C=JSON.stringify(p):C=p;let w=m;g&&(u=new AbortController,l=setTimeout(()=>u.abort(),g),m?(w=u.signal,m.addEventListener("abort",()=>u.abort())):w=u.signal);const S=yield this.fetch(_.toString(),{method:d||"POST",headers:Object.assign(Object.assign(Object.assign({},b),this.headers),h),body:C,signal:w}).catch(O=>{throw new N8(O)}),T=S.headers.get("x-relay-error");if(T&&T==="true")throw new A3(S);if(!S.ok)throw new R3(S);let N=((r=S.headers.get("Content-Type"))!==null&&r!==void 0?r:"text/plain").split(";")[0].trim(),j;return N==="application/json"?j=yield S.json():N==="application/octet-stream"||N==="application/pdf"?j=yield S.blob():N==="text/event-stream"?j=S:N==="multipart/form-data"?j=yield S.formData():j=yield S.text(),{data:j,error:null,response:S}}catch(h){return{data:null,error:h,response:h instanceof R3||h instanceof A3?h.context:void 0}}finally{l&&clearTimeout(l)}})}}var M8=class extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.co
15de=n.code}},A8=class{constructor(n){var e,t,i;this.shouldThrowOnError=!1,this.method=n.method,this.url=n.url,this.headers=new Headers(n.headers),this.schema=n.schema,this.body=n.body,this.shouldThrowOnError=(e=n.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=n.signal,this.isMaybeSingle=(t=n.isMaybeSingle)!==null&&t!==void 0?t:!1,this.urlLengthLimit=(i=n.urlLengthLimit)!==null&&i!==void 0?i:8e3,n.fetch?this.fetch=n.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(n,e){return this.headers=new Headers(this.headers),this.headers.set(n,e),this}then(n,e){var t=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const i=this.fetch;let r=i(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async l=>{let u=null,h=null,d=null,p=l.status,m=l.statusText;if(l.ok){var g,b;if(t.method!=="HEAD"){var y;const S=await l.text();S===""||(t.headers.get("Accept")==="text/csv"||t.headers.get("Accept")&&(!((y=t.headers.get("Accept"))===null||y===void 0)&&y.includes("application/vnd.pgrst.plan+text"))?h=S:h=JSON.parse(S))}const C=(g=t.headers.get("Prefer"))===null||g===void 0?void 0:g.match(/count=(exact|planned|estimated)/),w=(b=l.headers.get("content-range"))===null||b===void 0?void 0:b.split("/");C&&w&&w.length>1&&(d=parseInt(w[1])),t.isMaybeSingle&&t.method==="GET"&&Array.isArray(h)&&(h.length>1?(u={code:"PGRST116",details:`Results contain ${h.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},h=null,d=null,p=406,m="Not Acceptable"):h.length===1?h=h[0]:h=null)}else{var _;const C=await l.text();try{u=JSON.parse(C),Array.isArray(u)&&l.status===404&&(h=[],u=null,p=200,m="OK")}catch{l.status===404&&C===""?(p=204,m="No Content"):u={message:C}}if(u&&t.isMaybeSingle&&(!(u==null||(_=u.details)===null||_===void 0)&&_.includes("0 rows"))&&(u=null,p=200,m="OK"),u&&t.shouldThrowOnError)throw new M8(u)}return{error:u,data:h,count:d,status:p,statusText:m}});return this.shouldThrowOnError||(r=r.catch(l=>{var u;let h="",d="",p="";const m=l?.cause;if(m){var g,b,y,_;const S=(g=m?.message)!==null&&g!==void 0?g:"",T=(b=m?.code)!==null&&b!==void 0?b:"";h=`${(y=l?.name)!==null&&y!==void 0?y:"FetchError"}: ${l?.message}`,h+=` 16 17Caused by: ${(_=m?.name)!==null&&_!==void 0?_:"Error"}: ${S}`,T&&(h+=` (${T})`),m?.stack&&(h+=` 18${m.stack}`)}else{var C;h=(C=l?.stack)!==null&&C!==void 0?C:""}const w=this.url.toString().length;return l?.name==="AbortError"||l?.code==="ABORT_ERR"?(p="",d="Request was aborted (timeout or manual cancellation)",w>this.urlLengthLimit&&(d+=`. Note: Your request URL is ${w} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):(m?.name==="HeadersOverflowError"||m?.code==="UND_ERR_HEADERS_OVERFLOW")&&(p="",d="HTTP headers exceeded server limits (typically 16KB)",w>this.urlLengthLimit&&(d+=`. Your request URL is ${w} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{error:{message:`${(u=l?.name)!==null&&u!==void 0?u:"FetchError"}: ${l?.message}`,details:h,hint:d,code:p},data:null,count:null,status:0,statusText:""}})),r.then(n,e)}returns(){return this}overrideTypes(){return this}},R8=class extends A8{select(n){let e=!1;const t=(n??"*").split("").map(i=>/\s/.test(i)&&!e?"":(i==='"'&&(e=!e),i)).join("");return this.url.searchParams.set("select",t),this.headers.append("Prefer","return=representation"),this}order(n,{ascending:e=!0,nullsFirst:t,foreignTable:i,referencedTable:r=i}={}){const l=r?`${r}.order`:"order",u=this.url.searchParams.get(l);return this.url.searchParams.set(l,`${u?`${u},`:""}${n}.${e?"asc":"desc"}${t===void 0?"":t?".nullsfirst":".nullslast"}`),this}limit(n,{foreignTable:e,referencedTable:t=e}={}){const i=typeof t>"u"?"limit":`${t}.limit`;return this.url.searchParams.set(i,`${n}`),this}range(n,e,{foreignTable:t,referencedTable:i=t}={}){const r=typeof i>"u"?"offset":`${i}.offset`,l=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(r,`${n}`),this.url.searchParams.set(l,`${e-n+1}`),this}abortSignal(n){return this.signal=n,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
18explain({analyze:n=!1,verbose:e=!1,settings:t=!1,buffers:i=!1,wal:r=!1,format:l="text"}={}){var u;const h=[n?"analyze":null,e?"verbose":null,t?"settings":null,i?"buffers":null,r?"wal":null].filter(Boolean).join("|"),d=(u=this.headers.get("Accept"))!==null&&u!==void 0?u:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${l}; for="${d}"; options=${h};`),l==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(n){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${n}`),this}};const k3=new RegExp("[,()]");var yc=class extends R8{eq(n,e){return this.url.searchParams.append(n,`eq.${e}`),this}neq(n,e){return this.url.searchParams.append(n,`neq.${e}`),this}gt(n,e){return this.url.searchParams.append(n,`gt.${e}`),this}gte(n,e){return this.url.searchParams.append(n,`gte.${e}`),this}lt(n,e){return this.url.searchParams.append(n,`lt.${e}`),this}lte(n,e){return this.url.searchParams.append(n,`lte.${e}`),this}like(n,e){return this.url.searchParams.append(n,`like.${e}`),this}likeAllOf(n,e){return this.url.searchParams.append(n,`like(all).{${e.join(",")}}`),this}likeAnyOf(n,e){return this.url.searchParams.append(n,`like(any).{${e.join(",")}}`),this}ilike(n,e){return this.url.searchParams.append(n,`ilike.${e}`),this}ilikeAllOf(n,e){return this.url.searchParams.append(n,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(n,e){return this.url.searchParams.append(n,`ilike(any).{${e.join(",")}}`),this}regexMatch(n,e){return this.url.searchParams.append(n,`match.${e}`),this}regexIMatch(n,e){return this.url.searchParams.append(n,`imatch.${e}`),this}is(n,e){return this.url.searchParams.append(n,`is.${e}`),this}isDistinct(n,e){return this.url.searchParams.append(n,`isdistinct.${e}`),this}in(n,e){const t=Array.from(new Set(e)).map(i=>typeof i=="string"&&k3.test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(n,`in.(${t})`),this}notIn(n,e){const t=Array.from(new Set(e)).map(i=>typeof i=="string"&&k3.test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(n,`not.in.(${t})`),this}contains(n,e){return typeof e=="string"?this.url.searchParams.append(n,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(n,`cs.{${e.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(e)}`),this}containedBy(n,e){return typeof e=="string"?this.url.searchParams.append(n,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(n,`cd.{${e.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(e)}`),this}rangeGt(n,e){return this.url.searchParams.append(n,`sr.${e}`),this}rangeGte(n,e){return this.url.searchParams.append(n,`nxl.${e}`),this}rangeLt(n,e){return this.url.searchParams.append(n,`sl.${e}`),this}rangeLte(n,e){return this.url.searchParams.append(n,`nxr.${e}`),this}rangeAdjacent(n,e){return this.url.searchParams.append(n,`adj.${e}`),this}overlaps(n,e){return typeof e=="string"?this.url.searchParams.append(n,`ov.${e}`):this.url.searchParams.append(n,`ov.{${e.join(",")}}`),this}textSearch(n,e,{config:t,type:i}={}){let r="";i==="plain"?r="pl":i==="phrase"?r="ph":i==="websearch"&&(r="w");const l=t===void 0?"":`(${t})`;return this.url.searchParams.append(n,`${r}fts${l}.${e}`),this}match(n){return Object.entries(n).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(n,e,t){return this.url.searchParams.append(n,`not.${e}.${t}`),this}or(n,{foreignTable:e,referencedTable:t=e}={}){const i=t?`${t}.or`:"or";return this.url.searchParams.append(i,`(${n})`),this}filter(n,e,t){return this.url.searchParams.append(n,`${e}.${t}`),this}},k8=class{constructor(n,{headers:e={},schema:t,fetch:i,urlLengthLimit:r=8e3}){this.url=n,this.headers=new Headers(e),this.schema=t,this.fetch=i,this.urlLengthLimit=r}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(n,e){const{head:t=!1,count:i}=e??{},r=t?"HEAD":"GET";let l=!1;const u=(n??"*").split("").map(p=>/\s/.test(p)&&!l?"":(p==='"'&&(l=!l),p)).join(""),{url:h,headers:d}=this.cloneRequestState();return h.searchParams.set("select",u),i&&d.append("Prefer",`count=${i}`),new yc({method:r,url:h,headers:d,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}insert(n,{count:e,defaultToNull:t=!0}={}){var i;const r="POST",{url:l,headers:u}=this.cloneRequestState();if(e&&u.append("Prefer",`count=${e}`),t||u.append("Prefer","missing=default"),Array.isArray(n)){const h=n.reduce((d,p)=>d.concat(Object.keys(p)),[]);if(h.length>0){const d=[...new Set(h)].map(p=>`"${p}"`);l.searchParams.set("columns",d.join(","))}}return new yc({method:r,url:l,headers:u,schema:this.schema,body:n,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit})}
18upsert(n,{onConflict:e,ignoreDuplicates:t=!1,count:i,defaultToNull:r=!0}={}){var l;const u="POST",{url:h,headers:d}=this.cloneRequestState();if(d.append("Prefer",`resolution=${t?"ignore":"merge"}-duplicates`),e!==void 0&&h.searchParams.set("on_conflict",e),i&&d.append("Prefer",`count=${i}`),r||d.append("Prefer","missing=default"),Array.isArray(n)){const p=n.reduce((m,g)=>m.concat(Object.keys(g)),[]);if(p.length>0){const m=[...new Set(p)].map(g=>`"${g}"`);h.searchParams.set("columns",m.join(","))}}return new yc({method:u,url:h,headers:d,schema:this.schema,body:n,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch,urlLengthLimit:this.urlLengthLimit})}update(n,{count:e}={}){var t;const i="PATCH",{url:r,headers:l}=this.cloneRequestState();return e&&l.append("Prefer",`count=${e}`),new yc({method:i,url:r,headers:l,schema:this.schema,body:n,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit})}delete({count:n}={}){var e;const t="DELETE",{url:i,headers:r}=this.cloneRequestState();return n&&r.append("Prefer",`count=${n}`),new yc({method:t,url:i,headers:r,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit})}};function Ud(n){"@babel/helpers - typeof";return Ud=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ud(n)}function j8(n,e){if(Ud(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(Ud(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function L8(n){var e=j8(n,"string");return Ud(e)=="symbol"?e:e+""}function P8(n,e,t){return(e=L8(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function j3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function _f(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?j3(Object(t),!0).forEach(function(i){P8(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):j3(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}var O8=class s5{constructor(e,{headers:t={},schema:i,fetch:r,timeout:l,urlLengthLimit:u=8e3}={}){this.url=e,this.headers=new Headers(t),this.schemaName=i,this.urlLengthLimit=u;const h=r??globalThis.fetch;l!==void 0&&l>0?this.fetch=(d,p)=>{const m=new AbortController,g=setTimeout(()=>m.abort(),l),b=p?.signal;if(b){if(b.aborted)return clearTimeout(g),h(d,p);const y=()=>{clearTimeout(g),m.abort()};return b.addEventListener("abort",y,{once:!0}),h(d,_f(_f({},p),{},{signal:m.signal})).finally(()=>{clearTimeout(g),b.removeEventListener("abort",y)})}return h(d,_f(_f({},p),{},{signal:m.signal})).finally(()=>clearTimeout(g))}:this.fetch=h}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new k8(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}schema(e){return new s5(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}rpc(e,t={},{head:i=!1,get:r=!1,count:l}={}){var u;let h;const d=new URL(`${this.url}/rpc/${e}`);let p;const m=y=>y!==null&&typeof y=="object"&&(!Array.isArray(y)||y.some(m)),g=i&&Object.values(t).some(m);g?(h="POST",p=t):i||r?(h=i?"HEAD":"GET",Object.entries(t).filter(([y,_])=>_!==void 0).map(([y,_])=>[y,Array.isArray(_)?`{${_.join(",")}}`:`${_}`]).forEach(([y,_])=>{d.searchParams.append(y,_)})):(h="POST",p=t);const b=new Headers(this.headers);return g?b.set("Prefer",l?`count=${l},return=minimal`:"return=minimal"):l&&b.set("Prefer",`count=${l}`),new yc({method:h,url:d,headers:b,schema:this.schemaName,body:p,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch,urlLengthLimit:this.urlLengthLimit})}};class D8{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const t=globalThis.process;
18if(t){const i=t.versions;if(i&&i.node){const r=i.node,l=parseInt(r.replace(/^v/,"").split(".")[0]);return l>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${l} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${l} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option: 19import ws from "ws" 20new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=` 21 22Suggested solution: ${e.workaround}`),new Error(t)}static createWebSocket(e,t){const i=this.getWebSocketConstructor();return new i(e,t)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const U8="2.98.0",I8=`realtime-js/${U8}`,z8="1.0.0",r5="2.0.0",L3=r5,v1=1e4,$8=1e3,F8=100;var ho;(function(n){n[n.connecting=0]="connecting",n[n.open=1]="open",n[n.closing=2]="closing",n[n.closed=3]="closed"})(ho||(ho={}));var pi;(function(n){n.closed="closed",n.errored="errored",n.joined="joined",n.joining="joining",n.leaving="leaving"})(pi||(pi={}));var or;(function(n){n.close="phx_close",n.error="phx_error",n.join="phx_join",n.reply="phx_reply",n.leave="phx_leave",n.access_token="access_token"})(or||(or={}));var y1;(function(n){n.websocket="websocket"})(y1||(y1={}));var tl;(function(n){n.Connecting="connecting",n.Open="open",n.Closing="closing",n.Closed="closed"})(tl||(tl={}));class B8{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,t){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return t(this._binaryEncodeUserBroadcastPush(e));let i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(i))}_binaryEncodeUserBroadcastPush(e){var t;return this._isArrayBuffer((t=e.payload)===null||t===void 0?void 0:t.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var t,i;const r=(i=(t=e.payload)===null||t===void 0?void 0:t.payload)!==null&&i!==void 0?i:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,r)}_encodeJsonUserBroadcastPush(e){var t,i;const r=(i=(t=e.payload)===null||t===void 0?void 0:t.payload)!==null&&i!==void 0?i:{},u=new TextEncoder().encode(JSON.stringify(r)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,u)}_encodeUserBroadcastPush(e,t,i){var r,l;const u=e.topic,h=(r=e.ref)!==null&&r!==void 0?r:"",d=(l=e.join_ref)!==null&&l!==void 0?l:"",p=e.payload.event,m=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},g=Object.keys(m).length===0?"":JSON.stringify(m);if(d.length>255)throw new Error(`joinRef length ${d.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`ref length ${h.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`topic length ${u.length} exceeds maximum of 255`);if(p.length>255)throw new Error(`userEvent length ${p.length} exceeds maximum of 255`);if(g.length>255)throw new Error(`metadata length ${g.length} exceeds maximum of 255`);const b=this.USER_BROADCAST_PUSH_META_LENGTH+d.length+h.length+u.length+p.length+g.length,y=new ArrayBuffer(this.HEADER_LENGTH+b);let _=new DataView(y),C=0;_.setUint8(C++,this.KINDS.userBroadcastPush),_.setUint8(C++,d.length),_.setUint8(C++,h.length),_.setUint8(C++,u.length),_.setUint8(C++,p.length),_.setUint8(C++,g.length),_.setUint8(C++,t),Array.from(d,S=>
22_.setUint8(C++,S.charCodeAt(0))),Array.from(h,S=>_.setUint8(C++,S.charCodeAt(0))),Array.from(u,S=>_.setUint8(C++,S.charCodeAt(0))),Array.from(p,S=>_.setUint8(C++,S.charCodeAt(0))),Array.from(g,S=>_.setUint8(C++,S.charCodeAt(0)));var w=new Uint8Array(y.byteLength+i.byteLength);return w.set(new Uint8Array(y),0),w.set(new Uint8Array(i),y.byteLength),w.buffer}decode(e,t){if(this._isArrayBuffer(e)){let i=this._binaryDecode(e);return t(i)}if(typeof e=="string"){const i=JSON.parse(e),[r,l,u,h,d]=i;return t({join_ref:r,ref:l,topic:u,event:h,payload:d})}return t({})}_binaryDecode(e){const t=new DataView(e),i=t.getUint8(0),r=new TextDecoder;if(i===this.KINDS.userBroadcast)return this._decodeUserBroadcast(e,t,r)}_decodeUserBroadcast(e,t,i){const r=t.getUint8(1),l=t.getUint8(2),u=t.getUint8(3),h=t.getUint8(4);let d=this.HEADER_LENGTH+4;const p=i.decode(e.slice(d,d+r));d=d+r;const m=i.decode(e.slice(d,d+l));d=d+l;const g=i.decode(e.slice(d,d+u));d=d+u;const b=e.slice(d,e.byteLength),y=h===this.JSON_ENCODING?JSON.parse(i.decode(b)):b,_={type:this.BROADCAST_EVENT,event:m,payload:y};return u>0&&(_.meta=JSON.parse(g)),{join_ref:null,ref:null,topic:p,event:this.BROADCAST_EVENT,payload:_}}_isArrayBuffer(e){var t;return e instanceof ArrayBuffer||((t=e?.constructor)===null||t===void 0?void 0:t.name)==="ArrayBuffer"}_pick(e,t){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([i])=>t.includes(i)))}}class a5{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Rn;(function(n){n.abstime="abstime",n.bool="bool",n.date="date",n.daterange="daterange",n.float4="float4",n.float8="float8",n.int2="int2",n.int4="int4",n.int4range="int4range",n.int8="int8",n.int8range="int8range",n.json="json",n.jsonb="jsonb",n.money="money",n.numeric="numeric",n.oid="oid",n.reltime="reltime",n.text="text",n.time="time",n.timestamp="timestamp",n.timestamptz="timestamptz",n.timetz="timetz",n.tsrange="tsrange",n.tstzrange="tstzrange"})(Rn||(Rn={}));const P3=(n,e,t={})=>{var i;const r=(i=t.skipTypes)!==null&&i!==void 0?i:[];return e?Object.keys(e).reduce((l,u)=>(l[u]=H8(u,n,e,r),l),{}):{}},H8=(n,e,t,i)=>{const r=e.find(h=>h.name===n),l=r?.type,u=t[n];return l&&!i.includes(l)?o5(l,u):_1(u)},o5=(n,e)=>{if(n.charAt(0)==="_"){const t=n.slice(1,n.length);return W8(e,t)}switch(n){case Rn.bool:return V8(e);case Rn.float4:case Rn.float8:case Rn.int2:case Rn.int4:case Rn.int8:case Rn.numeric:case Rn.oid:return G8(e);case Rn.json:case Rn.jsonb:return q8(e);case Rn.timestamp:return X8(e);case Rn.abstime:case Rn.date:case Rn.daterange:case Rn.int4range:case Rn.int8range:case Rn.money:case Rn.reltime:case Rn.text:case Rn.time:case Rn.timestamptz:case Rn.timetz:case Rn.tsrange:case Rn.tstzrange:return _1(e);default:return _1(e)}},_1=n=>n,V8=n=>{switch(n){case"t":return!0;case"f":return!1;default:return n}},G8=n=>{if(typeof n=="string"){const e=parseFloat(n);if(!Number.isNaN(e))return e}return n},q8=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n},W8=(n,e)=>{if(typeof n!="string")return n;const t=n.length-1,i=n[t];if(n[0]==="{"&&i==="}"){let l;const u=n.slice(1,t);try{l=JSON.parse("["+u+"]")}catch{l=u?u.split(","):[]}return l.map(h=>o5(e,h))}return n},X8=n=>typeof n=="string"?n.replace(" ","T"):n,l5=n=>{const e=new URL(n);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class Kg{constructor(e,t,i={},r=v1){this.channel=e,this.event=t,this.payload=i,this.timeout=r,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,j
22oin_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var i;return this._hasReceived(e)&&t((i=this.receivedResp)===null||i===void 0?void 0:i.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=t=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=t,this._matchReceive(t)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter(i=>i.status===e).forEach(i=>i.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var O3;(function(n){n.SYNC="sync",n.JOIN="join",n.LEAVE="leave"})(O3||(O3={}));class wd{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const i=t?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(i.state,{},r=>{const{onJoin:l,onLeave:u,onSync:h}=this.caller;this.joinRef=this.channel._joinRef(),this.state=wd.syncState(this.state,r,l,u),this.pendingDiffs.forEach(d=>{this.state=wd.syncDiff(this.state,d,l,u)}),this.pendingDiffs=[],h()}),this.channel._on(i.diff,{},r=>{const{onJoin:l,onLeave:u,onSync:h}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(r):(this.state=wd.syncDiff(this.state,r,l,u),h())}),this.onJoin((r,l,u)=>{this.channel._trigger("presence",{event:"join",key:r,currentPresences:l,newPresences:u})}),this.onLeave((r,l,u)=>{this.channel._trigger("presence",{event:"leave",key:r,currentPresences:l,leftPresences:u})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,i,r){const l=this.cloneDeep(e),u=this.transformState(t),h={},d={};return this.map(l,(p,m)=>{u[p]||(d[p]=m)}),this.map(u,(p,m)=>{const g=l[p];if(g){const b=m.map(w=>w.presence_ref),y=g.map(w=>w.presence_ref),_=m.filter(w=>y.indexOf(w.presence_ref)<0),C=g.filter(w=>b.indexOf(w.presence_ref)<0);_.length>0&&(h[p]=_),C.length>0&&(d[p]=C)}else h[p]=m}),this.syncDiff(l,{joins:h,leaves:d},i,r)}static syncDiff(e,t,i,r){const{joins:l,leaves:u}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return i||(i=()=>{}),r||(r=()=>{}),this.map(l,(h,d)=>{var p;const m=(p=e[h])!==null&&p!==void 0?p:[];if(e[h]=this.cloneDeep(d),m.length>0){const g=e[h].map(y=>y.presence_ref),b=m.filter(y=>g.indexOf(y.presence_ref)<0);e[h].unshift(...b)}i(h,m,d)}),this.map(u,(h,d)=>{let p=e[h];if(!p)return;const m=d.map(g=>g.presence_ref);p=p.filter(g=>m.indexOf(g.presence_ref)<0),e[h]=p,r(h,p,d),p.length===0&&delete e[h]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(i=>t(i,e[i]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((t,i)=>{const r=e[i];return"metas"in r?t[i]=r.metas.map(l=>(l.presence_ref=l.phx_ref,delete l.phx_ref,delete l.phx_ref_prev,l)):t[i]=r,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var D3;(function(n){n.ALL="*",n.INSERT="INSERT",n.UPDATE="UPDATE",n.DELETE="DELETE"})(D3||(D3={}));var Sd;(function(n){n.BROADCAST="broadcast",n.PRESENCE="presence",n.POSTGRES_CHANGES="postgres_changes",n.SYSTEM="system"})(Sd||(Sd={}));var va;(function(n){n.SUBSCRIBED="SUBSCRIBED",n.TIMED_OUT="TIMED_OUT",n.CLOSED="CLOSED",n.CHANNEL_ERROR="CHANNEL_ERROR"})(va||(va={}));class Cc{constructor(e,t={config:{}},i){var r,l;if(this.topic=e,this.params=t,this.socket=i,this.bindings={},this.state=pi.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new Kg(this,or.join,this.params,this.timeout),this.rejoinTimer=new a5(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=pi.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(u=>u.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=pi.closed,this.socket._remove(this)}),this._onError(u=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,u),this.state=pi.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=pi.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",u=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,u),this.state=pi.errored,this.rejoinTimer.scheduleTimeout())}),this._on(or.reply,{},(u,h)=>{this._trigger(this._replyEventName(h),u)}),this.presence=new wd(this),this.broadcastEndpointURL=l5(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((l=(r=this.params.config)===null||r===void 0?void 0:r.broadcast)===null||l===void 0)&&l.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,t=this.timeout){var i,r,l;if(this.socket.isConnected()||this.socket.connect(),this.state==pi.closed){const{config:{broadcast:u,presence:h,private:d}}=this.params,p=(r=(i=this.bindings.postgres_changes)===null||i===void 0?void 0:i.map(y=>y.filter))!==null&&r!==void 0?r:[],m=!!this.bindings[Sd.PRESENCE]&&this.bindings[Sd.PRESENCE].length>0||((l=this.params.config.presence)===null||l===void 0?void 0:l.enabled)===!0,g={},b={broadcast:u,presence:Object.assign(Object.assign({},h),{enabled:m}),postgres_changes:p,private:d};this.socket.accessTokenValue&&(g.access_token=this.socket.accessTokenValue),this._onError(y=>e?.(va.CHANNEL_ERROR,y)),this._onClose(()=>e?.(va.CLOSED)),this.updateJoinPayload(Object.assign({config:b},g)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:y})=>{var _;if(this.socket._isManualToken()||this.socket.setAuth(),y===void 0){e?.(va.SUBSCRIBED);return}else{const C=this.bindings.postgres_changes,w=(_=C?.length)!==null&&_!==void 0?_:0,S=[];for(let T=0;T<w;T++){const N=C[T],{filter:{event:j,schema:O,table:R,filter:z}}=N,M=y&&y[T];
22if(M&&M.event===j&&Cc.isFilterValueEqual(M.schema,O)&&Cc.isFilterValueEqual(M.table,R)&&Cc.isFilterValueEqual(M.filter,z))S.push(Object.assign(Object.assign({},N),{id:M.id}));else{this.unsubscribe(),this.state=pi.errored,e?.(va.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=S,e&&e(va.SUBSCRIBED);return}}).receive("error",y=>{this.state=pi.errored,e?.(va.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(y).join(", ")||"error")))}).receive("timeout",()=>{e?.(va.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,i){return this.state===pi.joined&&e===Sd.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(e,t,i)}async httpSend(e,t,i={}){var r;if(t==null)return Promise.reject("Payload is required for httpSend()");const l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const u={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:t,private:this.private}]})},h=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(r=i.timeout)!==null&&r!==void 0?r:this.timeout);if(h.status===202)return{success:!0};let d=h.statusText;try{const p=await h.json();d=p.error||p.message||d}catch{}return Promise.reject(new Error(d))}async send(e,t={}){var i,r;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated
22in the future. Please use httpSend() explicitly for REST delivery.");const{event:l,payload:u}=e,h={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(h.Authorization=`Bearer ${this.socket.accessTokenValue}`);const d={method:"POST",headers:h,body:JSON.stringify({messages:[{topic:this.subTopic,event:l,payload:u,private:this.private}]})};try{const p=await this._fetchWithTimeout(this.broadcastEndpointURL,d,(i=t.timeout)!==null&&i!==void 0?i:this.timeout);return await((r=p.body)===null||r===void 0?void 0:r.cancel()),p.ok?"ok":"error"}catch(p){return p.name==="AbortError"?"timed out":"error"}}else return new Promise(l=>{var u,h,d;const p=this._push(e.type,e,t.timeout||this.timeout);e.type==="broadcast"&&!(!((d=(h=(u=this.params)===null||u===void 0?void 0:u.config)===null||h===void 0?void 0:h.broadcast)===null||d===void 0)&&d.ack)&&l("ok"),p.receive("ok",()=>l("ok")),p.receive("error",()=>l("error")),p.receive("timeout",()=>l("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=pi.leaving;const t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(or.close,"leave",this._joinRef())};this.joinPush.destroy();let i=null;return new Promise(r=>{i=new Kg(this,or.leave,{},e),i.receive("ok",()=>{t(),r("ok")}).receive("timeout",()=>{t(),r("timed out")}).receive("error",()=>{r("error")}),i.send(),this._canPush()||i.trigger("ok",{})}).finally(()=>{i?.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=pi.closed,this.bindings={}}async _fetchWithTimeout(e,t,i){const r=new AbortController,l=setTimeout(()=>r.abort(),i),u=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:r.signal}));return clearTimeout(l),u}_push(e,t,i=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let r=new Kg(this,e,t,i);return this._canPush()?r.send():this._addToPushBuffer(r),r}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>F8){const t=this.pushBuffer.shift();t&&(t.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${t.event}`,t.payload))}}_onMessage(e,t,i){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,i){var r,l;const u=e.toLocaleLowerCase(),{close:h,error:d,leave:p,join:m}=or;if(i&&[h,d,p,m].indexOf(u)>=0&&i!==this._joinRef())return;let b=this._onMessage(u,t,i);if(t&&!b)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(u)?(r=this.bindings.postgres_changes)===null||r===void 0||r.filter(y=>{var _,C,w;return((_=y.filter)===null||_===void 0?void 0:_.event)==="*"||((w=(C=y.filter)===null||C===void 0?void 0:C.event)===null||w===void 0?void 0:w.toLocaleLowerCase())===u}).map(y=>y.callback(b,i)):(l=this.bindings[u])===null||l===void 0||l.filter(y=>{var _,C,w,S,T,N;if(["broadcast","presence","postgres_changes"].includes(u))if("id"in y){const j=y.id,O=(_=y.filter)===null||_===void 0?void 0:_.event;return j&&((C=t.ids)===null||C===void 0?void 0:C.includes(j))&&(O==="*"||O?.toLocaleLowerCase()===((w=t.data)===null||w===void 0?void 0:w.type.toLocaleLowerCase()))}else{const j=(T=(S=y?.filter)===null||S===void 0?void 0:S.event)===null||T===void 0?void 0:T.toLocaleLowerCase();return j==="*"||j===((N=t?.event)===null||N===void 0?void 0:N.toLocaleLowerCase())}else return y.type.toLocaleLowerCase()===u}).map(y=>{if(typeof b=="object"&&"ids"in b){const _=b.data,{schema:C,table:w,commit_timestamp:S,type:T,errors:N}=_;b=Object.assign(Object.assign({},{schema:C,table:w,commit_timestamp:S,eventType:T,new:{},old:{},errors:N}),this._getPayloadRecords(_))}y.callback(b,i)})}_isClosed(){return this.state===pi.closed}_isJoined(){return this.state===pi.joined}_isJoining(){return this.state===pi.joining}_isLeaving(){return this.state===pi.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,i){const r=e.toLocaleLowerCase(),l={type:r,filter:t,callback:i};return this.bindings[r]?this.bindings[r].push(l):this.bindings[r]=[l],this}_off(e,t){const i=e.toLocaleLowerCase();return this.bindings[i]&&(this.bindings[i]=this.bindings[i].filter(r=>{var l;return!(((l=r.type)===null||l===void 0?void 0:l.toLocaleLowerCase())===i&&Cc.isEqual(r.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}static isFilterValueEqual(e,t){return(e??void 0)===(t??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(or.close,{},e)}_onError(e){this._on(or.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=pi.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const t={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(t.new=P3(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(t.old=P3(e.columns,e.old_record)),t}}const Zg=()=>{},wf={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Y8=[1e3,2e3,5e3,1e4],K8=1e4,Z8=` 23 addEventListener("message", (e) => { 24 if (e.data.event === "start") { 25 setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); 26 } 27 });`;class Q8{constructor(e,t){var i;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=v1,this.transport=null,this.heartbeatIntervalMs=wf.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Zg,this.ref=0,this.reconnectTimer=null,this.vsn=L3,this.logger=Zg,this.conn=null,this.sendBuffer=[],this.serializer
27=new B8,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=r=>r?(...l)=>r(...l):(...l)=>fetch(...l),!(!((i=t?.params)===null||i===void 0)&&i.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=t.params.apikey,this.endPoint=`${e}/${y1.websocket}`,this.httpEndpoint=l5(e),this._initializeOptions(t),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(t?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=D8.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const t=e.message;throw t.includes("Node.js")?new Error(`${t} 28 29To use Realtime in Node.js, you need to provide a WebSocket implementation: 30 31Option 1: Use Node.js 22+ which has native WebSocket support 32Option 2: Install and provide the "ws" package: 33 34 npm install ws 35 36 import ws from "ws" 37 const client = new RealtimeClient(url, { 38 ...options, 39 transport: ws 40 })`):new Error(`WebSocket not available: ${t}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,t){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const i=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(i),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,t??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),t}async removeAllChannels(){const e=await Promise.all(this.channels.map(t=>t.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,t,i){this.logger(e,t,i)}connectionState(){switch(this.conn&&this.conn.readyState){case ho.connecting:return tl.Connecting;case ho.open:return tl.Open;case ho.closing:return tl.Closing;default:return tl.Closed}}isConnected(){return this.connectionState()===tl.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,t={config:{}}){const i=`realtime:${e}`,r=this.getChannels().find(l=>l.topic===i);if(r)return r;{const l=new Cc(`realtime:${e}`,t,this);return this.channels.push(l),l}}push(e){const{topic:t,event:i,payload:r,ref:l}=e,u=()=>{this.encode(e,h=>{var d;(d=this.conn)===null||d===void 0||d.send(h)})};this.log("push",`${t} ${i} (${l})`,r),this.isConnected()?u():this.sendBuffer.push(u)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close($8,"heartbeat timeout"),setTimeout(()=>{var t;this.isConnected()||(t=this.reconnectTimer)===null||t===void 0||t.scheduleTimeout()},wf.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>
400&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(i=>i.topic===e&&(i._isJoined()||i._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,t=>{if(t.topic==="phoenix"&&t.event==="phx_reply"&&t.ref&&t.ref===this.pendingHeartbeatRef){const p=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(t.payload.status==="ok"?"ok":"error",p)}catch(m){this.log("error","error in heartbeat callback",m)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:i,event:r,payload:l,ref:u}=t,h=u?`(${u})`:"",d=l.status||"";this.log("receive",`${d} ${i} ${r} ${h}`.trim(),l),this.channels.filter(p=>p._isMember(i)).forEach(p=>p._trigger(r,l,u)),this._triggerStateCallbacks("message",t)})}_clearTimer(e){var t;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((t=this.reconnectTimer)===null||t===void 0||t.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===ho.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===ho.open||this.conn.readyState===ho.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.accessTokenValue&&(this.channels.forEach(t=>{t.updateJoinPayload({access_token:this.accessTokenValue})}),this.sendBuffer=[],this.channels.forEach(t=>{t._isJoining()&&(t.joinPush.sent=!1,t.joinPush.send())})),this.flushSendBuffer()}).catch(t=>{this.log("error","error waiting for auth on connect",t),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=t=>{this.log("worker","worker error",t.message),this._terminateWorker()},this.workerRef.onmessage=t=>{t.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(e){var t;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(t=this.reconnectTimer)===null||t===void 0||t.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e);try{this.heartbeatCallback("error")}catch(t){this.log("error","error in heartbeat callback",t)}}_triggerChanError(){this.channels.forEach(e=>e._trigger(or.error))}_appendParams(e,t){if(Object.keys(t).length===0)return e;const i=e.match(/\?/)?"&":"?",r=new URLSearchParams(t);return`${e}${i}${r}`}_workerObjectUrl(e){let t;if(e)t=e;else{const i=new Blob([Z8],{type:"application/javascript"});t=URL.createObjectURL(i)}return t}_setConnectionState(e,t=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=t)}async _performAuth(e=null){let t,i=!1;if(e)t=e,i=!0;else if(this.accessToken)try{t=await this.accessToken()}catch(r){this.log("error","Error fetching access token from callback",r),t=this.accessTokenValue}else t=this.accessTokenValue;i?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEac
40h(r=>{const l={access_token:t,version:I8};t&&r.updateJoinPayload(l),r.joinedOnce&&r._isJoined()&&r._push(or.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log("error",`Error setting auth in ${e}`,t)})}_triggerStateCallbacks(e,t){try{this.stateChangeCallbacks[e].forEach(i=>{try{i(t)}catch(r){this.log("error",`error in ${e} callback`,r)}})}catch(i){this.log("error",`error triggering ${e} callbacks`,i)}}_setupReconnectionTimer(){this.reconnectTimer=new a5(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},wf.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var t,i,r,l,u,h,d,p,m,g,b,y;switch(this.transport=(t=e?.transport)!==null&&t!==void 0?t:null,this.timeout=(i=e?.timeout)!==null&&i!==void 0?i:v1,this.heartbeatIntervalMs=(r=e?.heartbeatIntervalMs)!==null&&r!==void 0?r:wf.HEARTBEAT_INTERVAL,this.worker=(l=e?.worker)!==null&&l!==void 0?l:!1,this.accessToken=(u=e?.accessToken)!==null&&u!==void 0?u:null,this.heartbeatCallback=(h=e?.heartbeatCallback)!==null&&h!==void 0?h:Zg,this.vsn=(d=e?.vsn)!==null&&d!==void 0?d:L3,e?.params&&(this.params=e.params),e?.logger&&(this.logger=e.logger),(e?.logLevel||e?.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(p=e?.reconnectAfterMs)!==null&&p!==void 0?p:(_=>Y8[_-1]||K8),this.vsn){case z8:this.encode=(m=e?.encode)!==null&&m!==void 0?m:((_,C)=>C(JSON.stringify(_))),this.decode=(g=e?.decode)!==null&&g!==void 0?g:((_,C)=>C(JSON.parse(_)));break;case r5:this.encode=(b=e?.encode)!==null&&b!==void 0?b:this.serializer.encode.bind(this.serializer),this.decode=(y=e?.decode)!==null&&y!==void 0?y:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e?.workerUrl}}}var Id=class extends Error{constructor(n,e){super(n),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&e.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function J8(n,e,t){const i=new URL(e,n);if(t)for(const[r,l]of Object.entries(t))l!==void 0&&i.searchParams.set(r,l);return i.toString()}async function ek(n){return!n||n.type==="none"?{}:n.type==="bearer"?{Authorization:`Bearer ${n.token}`}:n.type==="header"?{[n.name]:n.value}:n.type==="custom"?await n.getHeaders():{}}function tk(n){const e=n.fetchImpl??globalThis.fetch;return{async request({method:t,path:i,query:r,body:l,headers:u}){const h=J8(n.baseUrl,i,r),d=await ek(n.auth),p=await e(h,{method:t,headers:{...l?{"Content-Type":"application/json"}:{},...d,...u},body:l?JSON.stringify(l):void 0}),m=await p.text(),g=(p.headers.get("content-type")||"").includes("application/json"),b=g&&m?JSON.parse(m):m;if(!p.ok){const y=g?b:void 0,_=y?.error;throw new Id(_?.message??`Request failed with status ${p.status}`,{status:p.status,icebergType:_?.type,icebergCode:_?.code,details:y})}return{status:p.status,headers:p.headers,data:b}}}}function Sf(n){return n.join("�")}var nk=class{constructor(n,e=""){this.client=n,this.prefix=e}async listNamespaces(n){const e=n?{parent:Sf(n.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(i=>({namespace:i}))}async createNamespace(n,e){const t={namespace:n.namespace,properties:e?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:t})).data}async dropNamespace(n){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Sf(n.namespace)}`})}async loadNamespaceMetadata(n){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Sf(n.namespace)}`})).data.properties}}async namespaceExists(n){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Sf(n.namespace)}`}),!0}catch(e){if(e instanceof Id&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(n,e){try{return await this.createNamespace(n,e)}catch(t){if(t instanceof Id&&t.status===409)return;throw t}}};function Jl(n){return n.join("�")}var ik=class{constructor(n,e="",t){this.client=n,this.prefix=e,this.accessDelegation=t}async listTables(n){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Jl(n.namespace)}/tables`})).data.identifiers}async createTable(n,e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Jl(n.namespace)}/tables`,body:e,headers:t})).data.metadata}async updateTable(n,e){const t=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Jl(n.namespace)}/tables/${n.name}`,body:e});return{"metadata-location":t.data["metadata-location"],metadata:t.data.metadata}}async dropTable(n,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Jl(n.namespace)}/tables/${n.name}`,query:{purgeRequested:String(e?.purge??!1)}})}async loadTable(n){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Jl(n.namespace)}/tables/${n.name}`,headers:e})).data.metadata}async tableExists(n){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Jl(n.namespace)}/tables/${n.name}`,headers:e}),!0}catch(t){if(t instanceof Id&&t.status===404)return!1;throw t}}async createTableIfNotExists(n,e){try{return await this.createTable(n,e)}catch(t){if(t instanceof Id&&t.status===409)return await this.loadTable({namespace:n.namespace,name:e.name});throw t}}},sk=class{constructor(n){let e="v1";n.catalogName&&(e+=`/${n.catalogName}`);const t=n.baseUrl.endsWith("/")?n.baseUrl:`${n.baseUrl}/`;this.client=tk({baseUrl:t,auth:n.auth,fetchImpl:n.fetch}),this.accessDelegation=n.accessDelegation?.join(","),this.namespaceOps=new nk(this.client,e),this.tableOps=new ik(this.client,e,this.accessDelegation)}async listNamespaces(n){return this.namespaceOps.listNamespaces(n)}async createNamespace(n,e){return this.namespaceOps.createNamespace(n,e)}async dropNamespace(n){await this.namespaceOps.dropNamespace(n)}async loadNamespaceMetadata(n){return this.namespaceOps.loadNamespaceMetadata(n)}async listTables(n){return this.tableOps.listTables(n)}
40async createTable(n,e){return this.tableOps.createTable(n,e)}async updateTable(n,e){return this.tableOps.updateTable(n,e)}async dropTable(n,e){await this.tableOps.dropTable(n,e)}async loadTable(n){return this.tableOps.loadTable(n)}async namespaceExists(n){return this.namespaceOps.namespaceExists(n)}async tableExists(n){return this.tableOps.tableExists(n)}async createNamespaceIfNotExists(n,e){return this.namespaceOps.createNamespaceIfNotExists(n,e)}async createTableIfNotExists(n,e){return this.tableOps.createTableIfNotExists(n,e)}},rm=class extends Error{constructor(n,e="storage",t,i){super(n),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=t,this.statusCode=i}};function am(n){return typeof n=="object"&&n!==null&&"__isStorageError"in n}var Ef=class extends rm{constructor(n,e,t,i="storage"){super(n,i,e,t),this.name=i==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=t}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},c5=class extends rm{constructor(n,e,t="storage"){super(n,t),this.name=t==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};const rk=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),ak=n=>{if(typeof n!="object"||n===null)return!1;const e=Object.getPrototypeOf(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},w1=n=>{if(Array.isArray(n))return n.map(t=>w1(t));if(typeof n=="function"||n!==Object(n))return n;const e={};return Object.entries(n).forEach(([t,i])=>{const r=t.replace(/([-_][a-z])/gi,l=>l.toUpperCase().replace(/[-_]/g,""));e[r]=w1(i)}),e},ok=n=>!n||typeof n!="string"||n.length===0||n.length>100||n.trim()!==n||n.includes("/")||n.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(n);function zd(n){"@babel/helpers - typeof";return zd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zd(n)}function lk(n,e){if(zd(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(zd(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function ck(n){var e=lk(n,"string");return zd(e)=="symbol"?e:e+""}function uk(n,e,t){return(e=ck(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function U3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function Lt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?U3(Object(t),!0).forEach(function(i){uk(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):U3(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}const I3=n=>{var e;return n.msg||n.message||n.error_description||(typeof n.error=="string"?n.error:(e=n.error)===null||e===void 0?void 0:e.message)||JSON.stringify(n)},dk=async(n,e,t,i)=>{if(n&&typeof n=="object"&&"status"in n&&"ok"in n&&typeof n.status=="number"&&!t?.noResolveJson){const r=n,l=r.status||500;if(typeof r.json=="function")r.json().then(u=>{const h=u?.statusCode||u?.code||l+"";e(new Ef(I3(u),l,h,i))}).catch(()=>{if(i==="vectors"){const u=l+"";e(new Ef(r.statusText||`HTTP ${l} error`,l,u,i))}else{const u=l+"";e(new Ef(r.statusText||`HTTP ${l} error`,l,u,i))}});else{const u=l+"";e(new Ef(r.statusText||`HTTP ${l} error`,l,u,i))}}else e(new c5(I3(n),n,i))},hk=(n,e,t,i)=>{const r={method:n,headers:e?.headers||{}};return n==="GET"||n==="HEAD"||!i?Lt(Lt({},r),t):(ak(i)?(r.headers=Lt({"Content-Type":"application/json"},e?.headers),r.body=JSON.stringify(i)):r.body=i,e?.duplex&&(r.duplex=e.duplex),Lt(Lt({},r),t))};async function ed(n,e,t,i,r,l,u){return new Promise((h,d)=>{n(t,hk(e,i,r,l)).then(p=>{if(!p.ok)throw p;if(i?.noResolveJson)return p;if(u==="vectors"){const m=p.headers.get("content-type");if(p.headers.get("content-length")==="0"||p.status===204)return{};if(!m||!m.includes("application/json"))return{}}return p.json()}).then(p=>h(p)).catch(p=>dk(p,d,i,u))})}function u5(n="storage"){return{get:async(e,t,i,r)=>ed(e,"GET",t,i,r,void 0,n),post:async(e,t,i,r,l)=>ed(e,"POST",t,r,l,i,n),put:async(e,t,i,r,l)=>ed(e,"PUT",t,r,l,i,n),head:async(e,t,i,r)=>ed(e,"HEAD",t,Lt(Lt({},i),{},{noResolveJson:!0}),r,void 0,n),remove:async(e,t,i,r,l)=>ed(e,"DELETE",t,r,l,i,n)}}const fk=u5("storage"),{get:$d,post:ar,put:S1,head:pk,remove:dv}=fk,Ns=u5("vectors");var Xc=class{constructor(n,e={},t,i="storage"){this.shouldThrowOnError=!1,this.url=n,this.headers=e,this.fetch=rk(t),this.namespace=i}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(n,e){return this.headers=Lt(Lt({},this.headers),{},{[n]:e}),this}async handleOperation(n){var e=this;try{return{data:await n(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(am(t))return{data:null,error:t};throw t}}},mk=class{constructor(n,e){this.downloadFn=n,this.shouldThrowOnError=e}then(n,e){return this.execute().then(n,e)}async execute(){var n=this;try{return{data:(await n.downloadFn()).body,error:null}}catch(e){if(n.shouldThrowOnError)throw e;if(am(e))return{data:null,error:e};throw e}}};let d5;d5=Symbol.toStringTag;var gk=class{constructor(n,e){this.downloadFn=n,this.shouldThrowOnError=e,this[d5]="BlobDownloadBuilder",this.promise=null}asStream(){return new mk(this.downloadFn,this.shouldThrowOnError)}then(n,e){return this.getPromise().then(n,e)}catch(n){return this.getPromise().catch(n)}finally(n){return this.getPromise().finally(n)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var n=this;try{return{data:await(await n.downloadFn()).blob(),error:null}}catch(e){if(n.shouldThrowOnError)throw e;if(am(e))return{data:null,error:e};throw e}}};const xk={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},z3={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var bk=class extends Xc{constructor(n,e={}
40,t,i){super(n,e,i,"storage"),this.bucketId=t}async uploadOrUpdate(n,e,t,i){var r=this;return r.handleOperation(async()=>{let l;const u=Lt(Lt({},z3),i);let h=Lt(Lt({},r.headers),n==="POST"&&{"x-upsert":String(u.upsert)});const d=u.metadata;typeof Blob<"u"&&t instanceof Blob?(l=new FormData,l.append("cacheControl",u.cacheControl),d&&l.append("metadata",r.encodeMetadata(d)),l.append("",t)):typeof FormData<"u"&&t instanceof FormData?(l=t,l.has("cacheControl")||l.append("cacheControl",u.cacheControl),d&&!l.has("metadata")&&l.append("metadata",r.encodeMetadata(d))):(l=t,h["cache-control"]=`max-age=${u.cacheControl}`,h["content-type"]=u.contentType,d&&(h["x-metadata"]=r.toBase64(r.encodeMetadata(d))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!u.duplex&&(u.duplex="half")),i?.headers&&(h=Lt(Lt({},h),i.headers));const p=r._removeEmptyFolders(e),m=r._getFinalPath(p),g=await(n=="PUT"?S1:ar)(r.fetch,`${r.url}/object/${m}`,l,Lt({headers:h},u?.duplex?{duplex:u.duplex}:{}));return{path:p,id:g.Id,fullPath:g.Key}})}async upload(n,e,t){return this.uploadOrUpdate("POST",n,e,t)}async uploadToSignedUrl(n,e,t,i){var r=this;const l=r._removeEmptyFolders(n),u=r._getFinalPath(l),h=new URL(r.url+`/object/upload/sign/${u}`);return h.searchParams.set("token",e),r.handleOperation(async()=>{let d;const p=Lt({upsert:z3.upsert},i),m=Lt(Lt({},r.headers),{"x-upsert":String(p.upsert)});return typeof Blob<"u"&&t instanceof Blob?(d=new FormData,d.append("cacheControl",p.cacheControl),d.append("",t)):typeof FormData<"u"&&t instanceof FormData?(d=t,d.append("cacheControl",p.cacheControl)):(d=t,m["cache-control"]=`max-age=${p.cacheControl}`,m["content-type"]=p.contentType),{path:l,fullPath:(await S1(r.fetch,h.toString(),d,{headers:m})).Key}})}async createSignedUploadUrl(n,e){var t=this;return t.handleOperation(async()=>{let i=t._getFinalPath(n);const r=Lt({},t.headers);e?.upsert&&(r["x-upsert"]="true");const l=await ar(t.fetch,`${t.url}/object/upload/sign/${i}`,{},{headers:r}),u=new URL(t.url+l.url),h=u.searchParams.get("token");if(!h)throw new rm("No token returned by API");return{signedUrl:u.toString(),path:n,token:h}})}async update(n,e,t){return this.uploadOrUpdate("PUT",n,e,t)}async move(n,e,t){var i=this;return i.handleOperation(async()=>await ar(i.fetch,`${i.url}/object/move`,{bucketId:i.bucketId,sourceKey:n,destinationKey:e,destinationBucket:t?.destinationBucket},{headers:i.headers}))}async copy(n,e,t){var i=this;return i.handleOperation(async()=>({path:(await ar(i.fetch,`${i.url}/object/copy`,{bucketId:i.bucketId,sourceKey:n,destinationKey:e,destinationBucket:t?.destinationBucket},{headers:i.headers})).Key}))}async createSignedUrl(n,e,t){var i=this;return i.handleOperation(async()=>{let r=i._getFinalPath(n),l=await ar(i.fetch,`${i.url}/object/sign/${r}
40`,Lt({expiresIn:e},t?.transform?{transform:t.transform}:{}),{headers:i.headers});const u=t?.download?`&download=${t.download===!0?"":t.download}`:"";return{signedUrl:encodeURI(`${i.url}${l.signedURL}${u}`)}})}async createSignedUrls(n,e,t){var i=this;return i.handleOperation(async()=>{const r=await ar(i.fetch,`${i.url}/object/sign/${i.bucketId}`,{expiresIn:e,paths:n},{headers:i.headers}),l=t?.download?`&download=${t.download===!0?"":t.download}`:"";return r.map(u=>Lt(Lt({},u),{},{signedUrl:u.signedURL?encodeURI(`${i.url}${u.signedURL}${l}`):null}))})}download(n,e,t){const i=typeof e?.transform<"u"?"render/image/authenticated":"object",r=this.transformOptsToQueryString(e?.transform||{}),l=r?`?${r}`:"",u=this._getFinalPath(n),h=()=>$d(this.fetch,`${this.url}/${i}/${u}${l}`,{headers:this.headers,noResolveJson:!0},t);return new gk(h,this.shouldThrowOnError)}async info(n){var e=this;const t=e._getFinalPath(n);return e.handleOperation(async()=>w1(await $d(e.fetch,`${e.url}/object/info/${t}`,{headers:e.headers})))}async exists(n){var e=this;const t=e._getFinalPath(n);try{return await pk(e.fetch,`${e.url}/object/${t}`,{headers:e.headers}),{data:!0,error:null}}catch(i){if(e.shouldThrowOnError)throw i;if(am(i)&&i instanceof c5){const r=i.originalError;if([400,404].includes(r?.status))return{data:!1,error:i}}throw i}}getPublicUrl(n,e){const t=this._getFinalPath(n),i=[],r=e?.download?`download=${e.download===!0?"":e.download}`:"";r!==""&&i.push(r);const l=typeof e?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(e?.transform||{});u!==""&&i.push(u);let h=i.join("&");return h!==""&&(h=`?${h}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${t}${h}`)}}}async remove(n){var e=this;return e.handleOperation(async()=>await dv(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:n},{headers:e.headers}))}async list(n,e,t){var i=this;return i.handleOperation(async()=>{const r=Lt(Lt(Lt({},xk),e),{},{prefix:n||""});return await ar(i.fetch,`${i.url}/object/list/${i.bucketId}`,r,{headers:i.headers},t)})}async listV2(n,e){var t=this;return t.handleOperation(async()=>{const i=Lt({},n);return await ar(t.fetch,`${t.url}/object/list-v2/${t.bucketId}`,i,{headers:t.headers},e)})}encodeMetadata(n){return JSON.stringify(n)}toBase64(n){return typeof Buffer<"u"?Buffer.from(n).toString("base64"):btoa(n)}_getFinalPath(n){return`${this.bucketId}/${n.replace(/^\/+/,"")}`}_removeEmptyFolders(n){return n.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(n){const e=[];return n.width&&e.push(`width=${n.width}`),n.height&&e.push(`height=${n.height}`),n.resize&&e.push(`resize=${n.resize}`),n.format&&e.push(`format=${n.format}`),n.quality&&e.push(`quality=${n.quality}`),e.join("&")}};const vk="2.98.0",Zd={"X-Client-Info":`storage-js/${vk}`};var yk=class extends Xc{constructor(n,e={},t,i){const r=new URL(n);i?.useNewHostname&&/supabase\.(co|in|red)$/.test(r.hostname)&&!r.hostname.includes("storage.supabase.")&&(r.hostname=r.hostname.replace("supabase.","storage.supabase."));const l=r.href.replace(/\/$/,""),u=Lt(Lt({},Zd),e);super(l,u,t,"storage")}async listBuckets(n){var e=this;return e.handleOperation(async()=>{const t=e.listBucketOptionsToQueryString(n);return await $d(e.fetch,`${e.url}/bucket${t}`,{headers:e.headers})})}async getBucket(n){var e=this;return e.handleOperation(async()=>await $d(e.fetch,`${e.url}/bucket/${n}`,{headers:e.headers}))}async createBucket(n,e={public:!1}){var t=this;return t.handleOperation(async()=>await ar(t.fetch,`${t.url}/bucket`,{id:n,name:n,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:t.headers}))}async updateBucket(n,e){var t=this;return t.handleOperation(async()=>await S1(t.fetch,`${t.url}/bucket/${n}`,{id:n,name:n,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:t.headers}))}async emptyBucket(n){var e=this;return e.handleOperation(async()=>await ar(e.fetch,`${e.url}/bucket/${n}/empty`,{},{headers:e.headers}))}async deleteBucket(n){var e=this;return e.handleOperation(async()=>await dv(e.fetch,`${e.url}/bucket/${n}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(n){const e={};return n&&("limit"in n&&(e.limit=String(n.limit)),"offset"in n&&(e.offset=String(n.offset)),n.search&&(e.search=n.search),n.sortColumn&&(e.sortColumn=n.sortColumn),n.sortOrder&&(e.sortOrder=n.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},_k=class extends Xc{constructor(n,e={},t){const i=n.replace(/\/$/,""),r=Lt(Lt({},Zd),e);super(i,r,t,"storage")}async createBucket(n){var e=this;return e.handleOperation(async()=>await ar(e.fetch,`${e.url}/bucket`,{name:n},{headers:e.headers}))}async listBuckets(n){var e=this;return e.handleOperation(async()=>{const t=new URLSearchParams;n?.limit!==void 0&&t.set("limit",n.limit.toString()),n?.offset!==void 0&&t.set("offset",n.offset.toString()),n?.sortColumn&&t.set("sortColumn",n.sortColumn),n?.sortOrder&&t.set("sortOrder",n.sortOrder),n?.search&&t.set("search",n.search);const i=t.toString(),r=i?`${e.url}/bucket?${i}`:`${e.url}/bucket`;return await $d(e.fetch,r,{headers:e.headers})})}async deleteBucket(n){var e=this;return e.handleOperation(async()=>await dv(e.fetch,`${e.url}/bucket/${n}`,{},{headers:e.headers}))}from(n){var e=this;if(!ok(n))throw new rm("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const t=new sk({baseUrl:this.url,catalogName:n,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),i=this.shouldThrowOnError;return new Proxy(t,{get(r,l){const u=r[l];return typeof u!="function"?u:async(...h)=>{try{return{data:await u.apply(r,h),error:null}}catch(d){if(i)throw d;return{data:null,error:d}}}}})}},wk=class extends Xc{constructor(n,e={},t){const i=n.replace(/\/$/,""),r=Lt(Lt({},Zd),{},{"Content-Type":"application/json"},e);super(i,r,t,"vectors")}async createIndex(n){var e=this;return e.handleOperation(async()=>await Ns.post(e.fetch,`${e.url}/CreateIndex`,n,{headers:e.headers})||{})}async getIndex(n,e){var t=this;return t.handleOperation(async()=>await Ns.post(t.fetch,`${t.url}/GetIndex`,{vectorBucketName:n,indexName:e},{headers:t.headers}))}async listIndexes(n){var e=this;return e.handleOperation(async()=>await Ns.post(e.fetch,`${e.url}/ListIndexes`,n,{headers:e.headers}))}async deleteIndex(n,e){var t=this;return t.handleOperation(async()=>await Ns.post(t.fetch,`${t.url}/DeleteIndex`,{vectorBucketName:n,indexName:e},{headers:t.headers})||{})}},Sk=class extends Xc{constructor(n,e={},t){const i=n.replace(/\/$/,""),r=Lt(Lt({},Zd),{},{"Content-Type":"application/json"},e);super(i,r,t,"vectors")}async putVectors(n){var e=this;if(n.vectors.length<1||n.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Ns.post(e.fetch,`${e.url}/PutVectors`,n,{headers:e.headers})||{})}async getVectors(n){var e=this;return e.handleOperation(async()=>await Ns.post(e.fetch,`${e.url}/GetVectors`,n,{headers:e.headers}))}async listVectors(n){var e=this;if(n.segmentCount!==void 0){if(n.segmentCount<1||n.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");
40if(n.segmentIndex!==void 0&&(n.segmentIndex<0||n.segmentIndex>=n.segmentCount))throw new Error(`segmentIndex must be between 0 and ${n.segmentCount-1}`)}return e.handleOperation(async()=>await Ns.post(e.fetch,`${e.url}/ListVectors`,n,{headers:e.headers}))}async queryVectors(n){var e=this;return e.handleOperation(async()=>await Ns.post(e.fetch,`${e.url}/QueryVectors`,n,{headers:e.headers}))}async deleteVectors(n){var e=this;if(n.keys.length<1||n.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Ns.post(e.fetch,`${e.url}/DeleteVectors`,n,{headers:e.headers})||{})}},Ek=class extends Xc{constructor(n,e={},t){const i=n.replace(/\/$/,""),r=Lt(Lt({},Zd),{},{"Content-Type":"application/json"},e);super(i,r,t,"vectors")}async createBucket(n){var e=this;return e.handleOperation(async()=>await Ns.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:n},{headers:e.headers})||{})}async getBucket(n){var e=this;return e.handleOperation(async()=>await Ns.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:n},{headers:e.headers}))}async listBuckets(n={}){var e=this;return e.handleOperation(async()=>await Ns.post(e.fetch,`${e.url}/ListVectorBuckets`,n,{headers:e.headers}))}async deleteBucket(n){var e=this;return e.handleOperation(async()=>await Ns.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:n},{headers:e.headers})||{})}},Ck=class extends Ek{constructor(n,e={}){super(n,e.headers||{},e.fetch)}from(n){return new Nk(this.url,this.headers,n,this.fetch)}async createBucket(n){var e=()=>super.createBucket,t=this;return e().call(t,n)}async getBucket(n){var e=()=>super.getBucket,t=this;return e().call(t,n)}async listBuckets(n={}){var e=()=>super.listBuckets,t=this;return e().call(t,n)}async deleteBucket(n){var e=()=>super.deleteBucket,t=this;return e().call(t,n)}},Nk=class extends wk{constructor(n,e,t,i){super(n,e,i),this.vectorBucketName=t}async createIndex(n){var e=()=>super.createIndex,t=this;return e().call(t,Lt(Lt({},n),{},{vectorBucketName:t.vectorBucketName}))}async listIndexes(n={}){var e=()=>super.listIndexes,t=this;return e().call(t,Lt(Lt({},n),{},{vectorBucketName:t.vectorBucketName}))}async getIndex(n){var e=()=>super.getIndex,t=this;return e().call(t,t.vectorBucketName,n)}async deleteIndex(n){var e=()=>super.deleteIndex,t=this;return e().call(t,t.vectorBucketName,n)}index(n){return new Tk(this.url,this.headers,this.vectorBucketName,n,this.fetch)}},Tk=class extends Sk{constructor(n,e,t,i,r){super(n,e,r),this.vectorBucketName=t,this.indexName=i}async putVectors(n){var e=()=>super.putVectors,t=this;return e().call(t,Lt(Lt({},n),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async getVectors(n){var e=()=>super.getVectors,t=this;return e().call(t,Lt(Lt({},n),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async listVectors(n={}){var e=()=>super.listVectors,t=this;return e().call(t,Lt(Lt({},n),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async queryVectors(n){var e=()=>super.queryVectors,t=this;return e().call(t,Lt(Lt({},n),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async deleteVectors(n){var e=()=>super.deleteVectors,t=this;return e().call(t,Lt(Lt({},n),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}},Mk=class extends yk{constructor(n,e={},t,i){super(n,e,t,i)}from(n){return new bk(this.url,this.headers,n,this.fetch)}get vectors(){return new Ck(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new _k(this.url+"/iceberg",this.headers,this.fetch)}};const h5="2.98.0",_c=30*1e3,E1=3,Qg=E1*_c,Ak="http://localhost:9999",Rk="supabase.auth.token",kk={"X-Client-Info":`gotrue-js/${h5}`},C1="X-Supabase-Api-Version",f5={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},jk=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Lk=600*1e3;class Fd extends Error{constructor(e,t,i){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=i}}function wt(n){return typeof n=="object"&&n!==null&&"__isAuthError"in n}class Pk extends Fd{constructor(e,t,i){super(e,t,i),this.name="AuthApiError",this.status=t,this.co
40de=i}}function Ok(n){return wt(n)&&n.name==="AuthApiError"}class nl extends Fd{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class La extends Fd{constructor(e,t,i,r){super(e,i,r),this.name=t,this.status=i}}class _s extends La{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Jg(n){return wt(n)&&n.name==="AuthSessionMissingError"}class ec extends La{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Cf extends La{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Nf extends La{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function Dk(n){return wt(n)&&n.name==="AuthImplicitGrantRedirectError"}class $3 extends La{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Uk extends La{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class N1 extends La{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function ex(n){return wt(n)&&n.name==="AuthRetryableFetchError"}class F3 extends La{constructor(e,t,i){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=i}}class T1 extends La{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Pp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),B3=` 41\r=`.split(""),Ik=(()=>{const n=new Array(128);for(let e=0;e<n.length;e+=1)n[e]=-1;for(let e=0;e<B3.length;e+=1)n[B3[e].charCodeAt(0)]=-2;for(let e=0;e<Pp.length;e+=1)n[Pp[e].charCodeAt(0)]=e;return n})();function H3(n,e,t){if(n!==null)for(e.queue=e.queue<<8|n,e.queuedBits+=8;e.queuedBits>=6;){const i=e.queue>>e.queuedBits-6&63;t(Pp[i]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const i=e.queue>>e.queuedBits-6&63;t(Pp[i]),e.queuedBits-=6}}function p5(n,e,t){const i=Ik[n];if(i>-1)for(e.queue=e.queue<<6|i,e.queuedBits+=6;e.queuedBits>=8;)t(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(i===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(n)}"`)}}function V3(n){const e=[],t=u=>{e.push(String.fromCodePoint(u))},i={utf8seq:0,codepoint:0},r={queue:0,queuedBits:0},l=u=>{Fk(u,i,t)};for(let u=0;u<n.length;u+=1)p5(n.charCodeAt(u),r,l);return e.join("")}function zk(n,e){if(n<=127){e(n);return}else if(n<=2047){e(192|n>>6),e(128|n&63);return}else if(n<=65535){e(224|n>>12),e(128|n>>6&63),e(128|n&63);return}else if(n<=1114111){e(240|n>>18),e(128|n>>12&63),e(128|n>>6&63),e(128|n&63);return}throw new Error(`Unrecognized Unicode codepoint: ${n.toString(16)}`)}function $k(n,e){for(let t=0;t<n.length;t+=1){let i=n.charCodeAt(t);if(i>55295&&i<=56319){const r=(i-55296)*1024&65535;i=(n.charCodeAt(t+1)-56320&65535|r)+65536,t+=1}zk(i,e)}}function Fk(n,e,t){if(e.utf8seq===0){if(n<=127){t(n);return}for(let i=1;i<6;i+=1)if((n>>7-i&1)===0){e.utf8seq=i;break}if(e.utf8seq===2)e.codepoint=n&31;else if(e.utf8seq===3)e.codepoint=n&15;else if(e.utf8seq===4)e.codepoint=n&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(n<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|n&63,e.utf8seq-=1,e.utf8seq===0&&t(e.codepoint)}}function Tc(n){const e=[],t={queue:0,queuedBits:0},i=r=>{e.push(r)};for(let r=0;r<n.length;r+=1)p5(n.charCodeAt(r),t,i);return new Uint8Array(e)}function Bk(n){const e=[];return $k(n,t=>e.push(t)),new Uint8Array(e)}function rl(n){const e=[],t={queue:0,queuedBits:0},i=r=>{e.push(r)};
41return n.forEach(r=>H3(r,t,i)),H3(null,t,i),e.join("")}function Hk(n){return Math.round(Date.now()/1e3)+n}function Vk(){return Symbol("auth-callback")}const Ai=()=>typeof window<"u"&&typeof document<"u",Vo={tested:!1,writable:!1},m5=()=>{if(!Ai())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Vo.tested)return Vo.writable;const n=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(n,n),globalThis.localStorage.removeItem(n),Vo.tested=!0,Vo.writable=!0}catch{Vo.tested=!0,Vo.writable=!1}return Vo.writable};function Gk(n){const e={},t=new URL(n);if(t.hash&&t.hash[0]==="#")try{new URLSearchParams(t.hash.substring(1)).forEach((r,l)=>{e[l]=r})}catch{}return t.searchParams.forEach((i,r)=>{e[r]=i}),e}const g5=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),qk=n=>typeof n=="object"&&n!==null&&"status"in n&&"ok"in n&&"json"in n&&typeof n.json=="function",wc=async(n,e,t)=>{await n.setItem(e,JSON.stringify(t))},Go=async(n,e)=>{const t=await n.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return t}},Mi=async(n,e)=>{await n.removeItem(e)};class om{constructor(){this.promise=new om.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}om.promiseConstructor=Promise;function Tf(n){const e=n.split(".");if(e.length!==3)throw new T1("Invalid JWT structure");for(let i=0;i<e.length;i++)if(!jk.test(e[i]))throw new T1("JWT not in base64url format");return{header:JSON.parse(V3(e[0])),payload:JSON.parse(V3(e[1])),signature:Tc(e[2]),raw:{header:e[0],payload:e[1]}}}async function Wk(n){return await new Promise(e=>{setTimeout(()=>e(null),n)})}function Xk(n,e){return new Promise((i,r)=>{(async()=>{for(let l=0;l<1/0;l++)try{const u=await n(l);if(!e(l,null,u)){i(u);return}}catch(u){if(!e(l,u)){r(u);return}}})()})}function Yk(n){return("0"+n.toString(16)).substr(-2)}function Kk(){const e=new Uint32Array(56);if(typeof crypto>"u"){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",i=t.length;let r="";for(let l=0;l<56;l++)r+=t.charAt(Math.floor(Math.random()*i));return r}return crypto.getRandomValues(e),Array.from(e,Yk).join("")}async function Zk(n){const t=new TextEncoder().encode(n),i=await crypto.subtle.digest("SHA-256",t),r=new Uint8Array(i);return Array.from(r).map(l=>String.fromCharCode(l)).join("")}async function Qk(n){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),n;const t=await Zk(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function tc(n,e,t=!1){const i=Kk();let r=i;t&&(r+="/PASSWORD_RECOVERY"),await wc(n,`${e}-code-verifier`,r);const l=await Qk(i);return[l,i===l?"plain":"s256"]}const Jk=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function ej(n){const e=n.headers.get(C1);if(!e||!e.match(Jk))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function tj(n){if(!n)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(n<=e)throw new Error("JWT has expired")}function nj(n){switch(n){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const ij=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function nc(n){if(!ij.test(n))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function tx(){const n={};return new Proxy(n,{get:(e,t)=>{if(t==="__isUserNotAvailableProxy")return!0;if(typeof t=="symbol"){const i=t.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function sj(n,e){return new Proxy(n,{get:(t,i,r)=>{if(i==="__isInsecureUserWarningProxy")return!0;
41if(typeof i=="symbol"){const l=i.toString();if(l==="Symbol(Symbol.toPrimitive)"||l==="Symbol(Symbol.toStringTag)"||l==="Symbol(util.inspect.custom)"||l==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(t,i,r)}return!e.value&&typeof i=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(t,i,r)}})}function G3(n){return JSON.parse(JSON.stringify(n))}const Jo=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),rj=[502,503,504];async function q3(n){var e;if(!qk(n))throw new N1(Jo(n),0);if(rj.includes(n.status))throw new N1(Jo(n),n.status);let t;try{t=await n.json()}catch(l){throw new nl(Jo(l),l)}let i;const r=ej(n);if(r&&r.getTime()>=f5["2024-01-01"].timestamp&&typeof t=="object"&&t&&typeof t.code=="string"?i=t.code:typeof t=="object"&&t&&typeof t.error_code=="string"&&(i=t.error_code),i){if(i==="weak_password")throw new F3(Jo(t),n.status,((e=t.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(i==="session_not_found")throw new _s}else if(typeof t=="object"&&t&&typeof t.weak_password=="object"&&t.weak_password&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.reasons.reduce((l,u)=>l&&typeof u=="string",!0))throw new F3(Jo(t),n.status,t.weak_password.reasons);throw new Pk(Jo(t),n.status||500,i)}const aj=(n,e,t,i)=>{const r={method:n,headers:e?.headers||{}};return n==="GET"?r:(r.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e?.headers),r.body=JSON.stringify(i),Object.assign(Object.assign({},r),t))};async function Pt(n,e,t,i){var r;const l=Object.assign({},i?.headers);l[C1]||(l[C1]=f5["2024-01-01"].name),i?.jwt&&(l.Authorization=`Bearer ${i.jwt}`);const u=(r=i?.query)!==null&&r!==void 0?r:{};i?.redirectTo&&(u.redirect_to=i.redirectTo);const h=Object.keys(u).length?"?"+new URLSearchParams(u).toString():"",d=await oj(n,e,t+h,{headers:l,noResolveJson:i?.noResolveJson},{},i?.body);return i?.xform?i?.xform(d):{data:Object.assign({},d),error:null}}async function oj(n,e,t,i,r,l){const u=aj(e,i,r,l);let h;try{h=await n(t,Object.assign({},u))}catch(d){throw console.error(d),new N1(Jo(d),0)}if(h.ok||await q3(h),i?.noResolveJson)return h;try{return await h.json()}catch(d){await q3(d)}}function rr(n){var e;let t=null;uj(n)&&(t=Object.assign({},n),n.expires_at||(t.expires_at=Hk(n.expires_in)));const i=(e=n.user)!==null&&e!==void 0?e:n;return{data:{session:t,user:i},error:null}}function W3(n){const e=rr(n);return!e.error&&n.weak_password&&typeof n.weak_password=="object"&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.message&&typeof n.weak_password.message=="string"&&n.weak_password.reasons.reduce((t,i)=>t&&typeof i=="string",!0)&&(e.data.weak_password=n.weak_password),e}function mo(n){var e;return{data:{user:(e=n.user)!==null&&e!==void 0?e:n},error:null}}function lj(n){return{data:n,error:null}}function cj(n){const{action_link:e,email_otp:t,hashed_token:i,redirect_to:r,verification_type:l}=n,u=sm(n,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),h={action_link:e,email_otp:t,hashed_token:i,redirect_to:r,verification_type:l},d=Object.assign({},u);return{data:{properties:h,user:d},error:null}}function X3(n){return n}function uj(n){return n.access_token&&n.refresh_token&&n.expires_in}const nx=["global","local","others"];class dj{constructor({url:e="",headers:t={},fetch:i}){this.url=e,this.headers=t,this.fetch=g5(i),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}
41async signOut(e,t=nx[0]){if(nx.indexOf(t)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${nx.join(", ")}`);try{return await Pt(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(i){if(wt(i))return{data:null,error:i};throw i}}async inviteUserByEmail(e,t={}){try{return await Pt(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:mo})}catch(i){if(wt(i))return{data:{user:null},error:i};throw i}}async generateLink(e){try{const{options:t}=e,i=sm(e,["options"]),r=Object.assign(Object.assign({},i),t);return"newEmail"in i&&(r.new_email=i?.newEmail,delete r.newEmail),await Pt(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:r,headers:this.headers,xform:cj,redirectTo:t?.redirectTo})}catch(t){if(wt(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(e){try{return await Pt(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:mo})}catch(t){if(wt(t))return{data:{user:null},error:t};throw t}}async listUsers(e){var t,i,r,l,u,h,d;try{const p={nextPage:null,lastPage:0,total:0},m=await Pt(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(i=(t=e?.page)===null||t===void 0?void 0:t.toString())!==null&&i!==void 0?i:"",per_page:(l=(r=e?.perPage)===null||r===void 0?void 0:r.toString())!==null&&l!==void 0?l:""},xform:X3});if(m.error)throw m.error;const g=await m.json(),b=(u=m.headers.get("x-total-count"))!==null&&u!==void 0?u:0,y=(d=(h=m.headers.get("link"))===null||h===void 0?void 0:h.split(","))!==null&&d!==void 0?d:[];return y.length>0&&(y.forEach(_=>{const C=parseInt(_.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(_.split(";")[1].split("=")[1]);p[`${w}Page`]=C}),p.total=parseInt(b)),{data:Object.assign(Object.assign({},g),p),error:null}}catch(p){if(wt(p))return{data:{users:[]},error:p};throw p}}async getUserById(e){nc(e);try{return await Pt(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:mo})}catch(t){if(wt(t))return{data:{user:null},error:t};throw t}}async updateUserById(e,t){nc(e);try{return await Pt(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:mo})}catch(i){if(wt(i))return{data:{user:null},error:i};throw i}}async deleteUser(e,t=!1){nc(e);try{return await Pt(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:mo})}catch(i){if(wt(i))return{data:{user:null},error:i};throw i}}async _listFactors(e){nc(e.userId);try{const{data:t,error:i}=await Pt(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:r=>({data:{factors:r},error:null})});return{data:t,error:i}}catch(t){if(wt(t))return{data:null,error:t};throw t}}async _deleteFactor(e){nc(e.userId),nc(e.id);try{return{data:await Pt(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(t){if(wt(t))return{data:null,error:t};throw t}}async _listOAuthClients(e){var t,i,r,l,u,h,d;try{const p={nextPage:null,lastPage:0,total:0},m=await Pt(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(i=(t=e?.page)===null||t===void 0?void 0:t.toString())!==null&&i!==void 0?i:"",per_page:(l=(r=e?.perPage)===null||r===void 0?void 0:r.toString())!==null&&l!==void 0?l:""},xform:X3});if(m.error)throw m.error;const g=await m.json(),b=(u=m.headers.get("x-total-count"))!==null&&u!==void 0?u:0,y=(d=(h=m.headers.get("link"))===null||h===void 0?void 0:h.split(","))!==null&&d!==void 0?d:[];return y.length>0&&(y.forEach(_=>{const C=parseInt(_.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(_.split(";")[1].split("=")[1]);p[`${w}Page`]=C}),p.total=parseInt(b)),{data:Object.assign(Object.assign({},g),p),error:null}}catch(p){if(wt(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(e){try{return await Pt(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(wt(t))return{data:null,error:t};throw t}}async _getOAuthClient(e){try{return await Pt(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(wt(t))return{data:null,error:t};throw t}}async _updateOAuthClient(e,t){try{return await Pt(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:t,headers:this.headers,xform:i=>({data:i,error:null})})}catch(i){if(wt(i))return{data:null,error:i};throw i}}async _deleteOAuthClient(e){try{return await Pt(this.fetch,"DELET
41E",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if(wt(t))return{data:null,error:t};throw t}}async _regenerateOAuthClientSecret(e){try{return await Pt(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if(wt(t))return{data:null,error:t};throw t}}}function Y3(n={}){return{getItem:e=>n[e]||null,setItem:(e,t)=>{n[e]=t},removeItem:e=>{delete n[e]}}}const fa={debug:!!(globalThis&&m5()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class x5 extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class hj extends x5{}async function fj(n,e,t){fa.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",n,e);const i=new globalThis.AbortController;e>0&&setTimeout(()=>{i.abort(),fa.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",n)},e),await Promise.resolve();try{return await globalThis.navigator.locks.request(n,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:i.signal},async r=>{if(r){fa.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",n,r.name);try{return await t()}finally{fa.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",n,r.name)}}else{if(e===0)throw fa.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",n),new hj(`Acquiring an exclusive Navigator LockManager lock "${n}" immediately failed`);if(fa.debug)try{const l=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(l,null," "))}catch(l){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",l)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await t()}})}catch(r){if(r?.name==="AbortError"&&e>0)return fa.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",n),console.warn(`@supabase/gotrue-js: Lock "${n}" was not released within ${e}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(n,{mode:"exclusive",steal:!0},async l=>{if(l){fa.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",n,l.name);try{return await t()}finally{fa.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",n,l.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await t()}));throw r}}function pj(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function b5(n){if(!/^0x[a-fA-F0-9]{40}$/.test(n))throw new Error(`@supabase/auth-js: Address "${n}" is invalid.`);return n.toLowerCase()}function mj(n){return parseInt(n,16)}function gj(n){const e=new TextEncoder().encode(n);return"0x"+Array.from(e,i=>i.toString(16).padStart(2,"0")).join("")}function xj(n){var e;const{chainId:t,domain:i,expirationTime:r,issuedAt:l=new Date,nonce:u,notBefore:h,requestId:d,resources:p,scheme:m,uri:g,version:b}=n;{if(!Number.isInteger(t))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${t}`);if(!i)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(u&&u.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${u}`);if(!g)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(b!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${b}`);if(!((e=n.statement)===null||e===void 0)&&e.includes(` 42`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`)}const y=b5(n.address),_=m?`${m}://${i}`:i,C=n.statement?`${n.statement} 43`:"",w=`${_} wants you to sign in with your Ethereum account: 44${y} 45 46${C}`;let S=`URI: ${g} 47Version: ${b} 48Chain ID: ${t}${u?` 49Nonce: ${u}`:""} 50Issued At: ${l.toISOString()}`;if(r&&(S+=` 51Expiration Time: ${r.toISOString()}`),h&&(S+=` 52Not Before: ${h.toISOString()}`),d&&(S+=` 53Request ID: ${d}`),p){let T=` 54Resources:`;
54for(const N of p){if(!N||typeof N!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${N}`);T+=` 55- ${N}`}S+=T}return`${w} 56${S}`}class oi extends Error{constructor({message:e,code:t,cause:i,name:r}){var l;super(e,{cause:i}),this.__isWebAuthnError=!0,this.name=(l=r??(i instanceof Error?i.name:void 0))!==null&&l!==void 0?l:"Unknown Error",this.code=t}}class Op extends oi{constructor(e,t){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t,message:e}),this.name="WebAuthnUnknownError",this.originalError=t}}function bj({error:n,options:e}){var t,i,r;const{publicKey:l}=e;if(!l)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(e.signal instanceof AbortSignal)return new oi({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else if(n.name==="ConstraintError"){if(((t=l.authenticatorSelection)===null||t===void 0?void 0:t.requireResidentKey)===!0)return new oi({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:n});if(e.mediation==="conditional"&&((i=l.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new oi({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:n});if(((r=l.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new oi({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:n})}else{if(n.name==="InvalidStateError")return new oi({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:n});if(n.name==="NotAllowedError")return new oi({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="NotSupportedError")return l.pubKeyCredParams.filter(h=>h.type==="public-key").length===0?new oi({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:n}):new oi({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:n});if(n.name==="SecurityError"){const u=window.location.hostname;if(v5(u)){if(l.rp.id!==u)return new oi({message:`The RP ID "${l.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new oi({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="TypeError"){if(l.user.id.byteLength<1||l.user.id.byteLength>64)return new oi({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:n})}else if(n.name==="UnknownError")return new oi({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new oi({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}function vj({error:n,options:e}){const{publicKey:t}=e;if(!t)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(e.signal instanceof AbortSignal)return new oi({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else{if(n.name==="NotAllowedError")return new oi({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="SecurityError"){const i=window.location.hostname;if(v5(i)){if(t.rpId!==i)return new oi({message:`The RP ID "${t.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new oi({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="UnknownError")return new oi({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ER
56ROR",cause:n})}return new oi({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}class yj{createNewAbortSignal(){if(this.controller){const t=new Error("Cancelling existing WebAuthn API call for new one");t.name="AbortError",this.controller.abort(t)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const _j=new yj;function wj(n){if(!n)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(n);const{challenge:e,user:t,excludeCredentials:i}=n,r=sm(n,["challenge","user","excludeCredentials"]),l=Tc(e).buffer,u=Object.assign(Object.assign({},t),{id:Tc(t.id).buffer}),h=Object.assign(Object.assign({},r),{challenge:l,user:u});if(i&&i.length>0){h.excludeCredentials=new Array(i.length);for(let d=0;d<i.length;d++){const p=i[d];h.excludeCredentials[d]=Object.assign(Object.assign({},p),{id:Tc(p.id).buffer,type:p.type||"public-key",transports:p.transports})}}return h}function Sj(n){if(!n)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(n);const{challenge:e,allowCredentials:t}=n,i=sm(n,["challenge","allowCredentials"]),r=Tc(e).buffer,l=Object.assign(Object.assign({},i),{challenge:r});if(t&&t.length>0){l.allowCredentials=new Array(t.length);for(let u=0;u<t.length;u++){const h=t[u];l.allowCredentials[u]=Object.assign(Object.assign({},h),{id:Tc(h.id).buffer,type:h.type||"public-key",transports:h.transports})}}return l}function Ej(n){var e;if("toJSON"in n&&typeof n.toJSON=="function")return n.toJSON();const t=n;return{id:n.id,rawId:n.id,response:{attestationObject:rl(new Uint8Array(n.response.attestationObject)),clientDataJSON:rl(new Uint8Array(n.response.clientDataJSON))},type:"public-key",clientExtensionResults:n.getClientExtensionResults(),authenticatorAttachment:(e=t.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Cj(n){var e;if("toJSON"in n&&typeof n.toJSON=="function")return n.toJSON();const t=n,i=n.getClientExtensionResults(),r=n.response;return{id:n.id,rawId:n.id,response:{authenticatorData:rl(new Uint8Array(r.authenticatorData)),clientDataJSON:rl(new Uint8Array(r.clientDataJSON)),signature:rl(new Uint8Array(r.signature)),userHandle:r.userHandle?rl(new Uint8Array(r.userHandle)):void 0},type:"public-key",clientExtensionResults:i,authenticatorAttachment:(e=t.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function v5(n){return n==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(n)}function K3(){var n,e;return!!(Ai()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((n=navigator?.credentials)===null||n===void 0?void 0:n.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function Nj(n){try{const e=await navigator.credentials.create(n);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Op("Browser returned unexpected credential type",e)}:{data:null,error:new Op("Empty credential response",e)}}catch(e){return{data:null,error:bj({error:e,options:n})}}}async function Tj(n){try{const e=await navigator.credentials.get(n);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Op("Browser returned unexpected credential type",e)}:{data:null,error:new Op("Empty credential response",e)}}catch(e){return{data:null,error:vj({error:e,options:n})}}}const Mj={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Aj={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Dp(...n){const e=r=>r!==null&&typeof r=="object"&&!Array.isArray(r),t=r=>r instanceof ArrayBuffer||ArrayBuffer.isView(r),i={};for(const r of n)if(r)for(const l in r){const u=r[l];if(u!==void 0)if(Array.isArray(u))i[l]=u;else if(t(u))i[l]=u;else if(e(u)){const h=i[l];e(h)?i[l]=Dp(h,u):i[l]=Dp(u)}else i[l]=u}return i}function Rj(n,e){return Dp(Mj,n,e||{})}function kj(n,e){return Dp(Aj,n,e||{})}class jj{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:t,friendlyName:i,signal:r},l){var u;try{const{data:h,error:d}=await this.client.mfa.challenge({factorId:e,webauthn:t});if(!h)return{data:null,error:d};const p=r??_j.createNewAbortSignal();if(h.webauthn.type==="create"){const{user:m}=h.webauthn.credential_options.publicKey;if(!m.name){const g=i;if(g)m.name=`${m.id}:${g}`;else{const y=(await this.client.getUser()).data.user,_=((u=y?.user_metadata)===null||u===void 0?void 0:u.name)||y?.email||y?.id||"User";m.name=`${m.id}:${_}`}}m.displayName||(m.displayName=m.name)}
56switch(h.webauthn.type){case"create":{const m=Rj(h.webauthn.credential_options.publicKey,l?.create),{data:g,error:b}=await Nj({publicKey:m,signal:p});return g?{data:{factorId:e,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:g}},error:null}:{data:null,error:b}}case"request":{const m=kj(h.webauthn.credential_options.publicKey,l?.request),{data:g,error:b}=await Tj(Object.assign(Object.assign({},h.webauthn.credential_options),{publicKey:m,signal:p}));return g?{data:{factorId:e,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:g}},error:null}:{data:null,error:b}}}}catch(h){return wt(h)?{data:null,error:h}:{data:null,error:new nl("Unexpected error in challenge",h)}}}async _verify({challengeId:e,factorId:t,webauthn:i}){return this.client.mfa.verify({factorId:t,challengeId:e,webauthn:i})}async _authenticate({factorId:e,webauthn:{rpId:t=typeof window<"u"?window.location.hostname:void 0,rpOrigins:i=typeof window<"u"?[window.location.origin]:void 0,signal:r}={}},l){if(!t)return{data:null,error:new Fd("rpId is required for WebAuthn authentication")};try{if(!K3())return{data:null,error:new nl("Browser does not support WebAuthn",null)};const{data:u,error:h}=await this.challenge({factorId:e,webauthn:{rpId:t,rpOrigins:i},signal:r},{request:l});if(!u)return{data:null,error:h};const{webauthn:d}=u;return this._verify({factorId:e,challengeId:u.challengeId,webauthn:{type:d.type,rpId:t,rpOrigins:i,credential_response:d.credential_response}})}catch(u){return wt(u)?{data:null,error:u}:{data:null,error:new nl("Unexpected error in authenticate",u)}}}async _register({friendlyName:e,webauthn:{rpId:t=typeof window<"u"?window.location.hostname:void 0,rpOrigins:i=typeof window<"u"?[window.location.origin]:void 0,signal:r}={}},l){if(!t)return{data:null,error:new Fd("rpId is required for WebAuthn registration")};try{if(!K3())return{data:null,error:new nl("Browser does not support WebAuthn",null)};const{data:u,error:h}=await this._enroll({friendlyName:e});if(!u)return await this.client.mfa.listFactors().then(m=>{var g;return(g=m.data)===null||g===void 0?void 0:g.all.find(b=>b.factor_type==="webauthn"&&b.friendly_name===e&&b.status!=="unverified")}).then(m=>m?this.client.mfa.unenroll({factorId:m?.id}):void 0),{data:null,error:h};const{data:d,error:p}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:t,rpOrigins:i},signal:r},{create:l});return d?this._verify({factorId:u.id,challengeId:d.challengeId,webauthn:{rpId:t,rpOrigins:i,type:d.webauthn.type,credential_response:d.webauthn.credential_response}}):{data:null,error:p}}catch(u){return wt(u)?{data:null,error:u}:{data:null,error:new nl("Unexpected error in register",u)}}}}pj();const Lj={url:Ak,storageKey:Rk,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:kk,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1};async function Z3(n,e,t){return await t()}const ic={};class Bd{get jwks(){var e,t;return(t=(e=ic[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&t!==void 0?t:{keys:[]}}set jwks(e){ic[this.storageKey]=Object.assign(Object.assign({},ic[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return(t=(e=ic[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&t!==void 0?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){ic[this.storageKey]=Object.assign(Object.assign({},ic[this.storageKey]),{cachedAt:e})}constructor(e){var t,i,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const l=Object.assign(Object.assign({},Lj),e);if(this.storageKey=l.storageKey,this.instanceID=(t=Bd.nextInstanceID[this.storageKey])!==null&&t!==void 0?t:0,Bd.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!l.debug,typeof l.debug=="function"&&(this.logger=l.debug),this.instanceID>0&&Ai()){const u=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(u),this.logDebugMessages&&console.trace(u)}if(this.persistSession=l.persistSession,this.autoRefreshToken=l.autoRefreshToken,this.admin=new dj({url:l.url,headers:l.headers,fetch:l.fetch}),this.url=l.url,this.headers=l.headers,this.fetch=g5(l.fetch),this.lock=l.lock||Z3,this.detectSessionInUrl=l.detectSessionInUrl,this.flowType=l.flowType,this.hasCustomAuthorizationHeader=l.hasCu
56stomAuthorizationHeader,this.throwOnError=l.throwOnError,this.lockAcquireTimeout=l.lockAcquireTimeout,l.lock?this.lock=l.lock:this.persistSession&&Ai()&&(!((i=globalThis?.navigator)===null||i===void 0)&&i.locks)?this.lock=fj:this.lock=Z3,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new jj(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(l.storage?this.storage=l.storage:m5()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Y3(this.memoryStorage)),l.userStorage&&(this.userStorage=l.userStorage)):(this.memoryStorage={},this.storage=Y3(this.memoryStorage)),Ai()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(u){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",u)}(r=this.broadcastChannel)===null||r===void 0||r.addEventListener("message",async u=>{this._debug("received broadcast notification from other tab or client",u);try{await this._notifyAllSubscribers(u.data.event,u.data.session,!1)}catch(h){this._debug("#broadcastChannel","error",h)}})}l.skipAutoInitialize||this.initialize().catch(u=>{this._debug("#initialize()","error",u)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${h5}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let t={},i="none";if(Ai()&&(t=Gk(window.location.href),this._isImplicitGrantCallback(t)?i="implicit":await this._isPKCECallback(t)&&(i="pkce")),Ai()&&this.detectSessionInUrl&&i!=="none"){const{data:r,error:l}=await this._getSessionFromURL(t,i);if(l){if(this._debug("#_initialize()","error detecting session from URL",l),Dk(l)){const d=(e=l.details)===null||e===void 0?void 0:e.code;if(d==="identity_already_exists"||d==="identity_not_found"||d==="single_identity_not_deletable")return{error:l}}return{error:l}}const{session:u,redirectType:h}=r;return this._debug("#_initialize()","detected session in URL",u,"redirect type",h),await this._saveSession(u),setTimeout(async()=>{h==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",u):await this._notifyAllSubscribers("SIGNED_IN",u)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return wt(t)?this._returnResult({error:t}):this._returnResult({error:new nl("Unexpected error during initialization",t)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,i,r;try{const l=await Pt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(i=(t=e?.options)===null||t===void 0?void 0:t.data)!==null&&i!==void 0?i:{},gotrue_meta_security:{captcha_token:(r=e?.options)===null||r===void 0?void 0:r.captchaToken}},xform:rr}),{data:u,error:h}=l;if(h||!u)return this._returnResult({data:{user:null,session:null},error:h});const d=u.session,p=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",d)),this._returnResult({data:{user:p,session:d},error:null})}catch(l){if(wt(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signUp(e){var t,i,r;try{let l;if("email"in e){const{email:m,password:g,options:b}=e;let y=null,_=null;this.flowType==="pkce"&&([y,_]=await tc(this.storage,this.storageKey)),l=await Pt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:b?.emailRedirectTo,body:{email:m,password:g,data:(t=b?.data)!==null&&t!==void 0?t:{},gotrue_meta_security:{captcha_token:b?.captchaToken},code_challenge:y,code_challenge_method:_},xform:rr})}else if("phone"in e){const{phone:m,password:g,options:b}=e;l=await Pt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:m,password:g,data:(i=b?.data)!==null&&i!==void 0?i:{},channel:(r=b?.channel)!==null&&r!==void 0?r:"sms",gotrue_meta_security:{captcha_token:b?.captchaToken}},xform:rr})}else throw new Cf("You must provide either an email or phone number and a password");const{data:u,error:h}=l;if(h||!u)return await Mi(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:h});const d=u.session,p=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",d)),this._returnResult({data:{user:p,session:d},error:null})}catch(l){if(await Mi(this.storage,`${this.storageKey}-code-verifier`),wt(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signInWithPassword(e){try{let t;if("email"in e){const{email:l,password:u,options:h}=e;t=await Pt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:l,password:u,gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:W3})}else if("phone"in e){const{phone:l,password:u,options:h}=e;t=await Pt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:l,password:u,gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:W3})}else throw new Cf("You must provide either an email or phone number and a password");const{data:i,error:r}=t;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!i||!i.session||!i.user){const l=new ec;return this._returnResult({data:{user:null,session:null},error:l})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:Object.assign({user:i.user,session:i.session},i.weak_password?{weakPassword:i.weak_password}:null),error:r})}catch(t){if(wt(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async signInWithOAuth(e){var t,i,r,l;return await this._handleProviderSignIn(e.provider,{redirectTo:(t=e.options)===null||t===void 0?void 0:t.redirectTo,scopes:(i=e.options)===null||i===void 0?void 0:i.scopes,queryParams:(r=e.options)===null||r===void 0?void 0:r.queryParams,skipBrowserRedirect:(l=e.options)===null||l===void 0?void 0:l.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:t}=e;switch(t){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,i,r,l,u,h,d,p,m,g,b;let y,_;if("message"in e)y=e.message,_=e.signature;else{const{chain:C,wallet:w,statement:S,options:T}=e;let N;if(Ai())if(typeof w=="object")N=w;else{const P=window;if("ethereum"in P&&typeof P.ethereum=="object"&&"request"in P.ethereum&&typeof P.ethereum.request=="function")N=P.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof w!="object"||!T?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");N=w}const j=new URL((t=T?.url)!==null&&t!==void 0?t:window.location.href),O=await N.request({method:"eth_requestAccounts"}).then(P=>P).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!O||O.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const R=b5(O[0]);let z=(i=T?.signInWithEthereum)===null||i===void 0?void 0:i.chainId;if(!z){const P=await N.request({method:"eth_chainId"});z=mj(P)}const M={domain:j.host,address:R,statement:S,uri:j.href,version:"1",chainId:z,nonce:(r=T?.signInWithEthereum)===null||r===void 0?void 0:r.nonce,issuedAt:(u=(l=T?.signInWithEthereum)===null||l===void 0?void 0:l.issuedAt)!==null&&u!==void 0?u:new Date,expirationTime:(h=T?.signInWithEthereum)===null||h===void 0?void 0:h.expirationTime,notBefore:(d=T?.signInWithEthereum)===null||d===void 0?void 0:d.notBefore,requestId:(p=T?.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(m=T?.signInWithEthereum)===null||m===void 0?void 0:m.resources};y=xj(M),_=await N.request({method:"personal_sign",params:[gj(y),R]})}try{const{data:C,error:w}=await Pt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:y,signature:_},!((g=e.options)===null||g===void 0)&&g.captchaToken?{gotrue_meta_security:{captcha_token:(b=e.options)===null||b===void 0?void 0:b.captchaToken}}:null),xform:rr});if(w)throw w;if(!C||!C.session||!C.user){const S=new ec;return this._returnResult({data:{user:null,session:null},error:S})}return C.session&&(await this._saveSession(C.session),await this._notifyAllSubscribers("SIGNED_IN",C.session)),this._returnResult({data:Object.assign({},C),error:w})}catch(C){if(wt(C))return this._returnResult({data:{user:null,session:null},error:C});throw C}}async signInWithSolana(e){var t,i,r,l,u,h,d,p,m,g,b,y;let _,C;if("message"in e)_=e.message,C=e.signature;else{const{chain:w,wallet:S,statement:T,options:N}=e;let j;if(Ai())if(typeof S=="object")j=S;else{const R=window;if("solana"in R&&typeof R.solana=="object"&&("signIn"in R.solana&&typeof R.solana.signIn=="function"||"signMessage"in R.solana&&typeof R.solana.signMessage=="function"))j=R.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof S!="object"||!N?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");j=S}
56const O=new URL((t=N?.url)!==null&&t!==void 0?t:window.location.href);if("signIn"in j&&j.signIn){const R=await j.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},N?.signInWithSolana),{version:"1",domain:O.host,uri:O.href}),T?{statement:T}:null));let z;if(Array.isArray(R)&&R[0]&&typeof R[0]=="object")z=R[0];else if(R&&typeof R=="object"&&"signedMessage"in R&&"signature"in R)z=R;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in z&&"signature"in z&&(typeof z.signedMessage=="string"||z.signedMessage instanceof Uint8Array)&&z.signature instanceof Uint8Array)_=typeof z.signedMessage=="string"?z.signedMessage:new TextDecoder().decode(z.signedMessage),C=z.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in j)||typeof j.signMessage!="function"||!("publicKey"in j)||typeof j!="object"||!j.publicKey||!("toBase58"in j.publicKey)||typeof j.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");_=[`${O.host} wants you to sign in with your Solana account:`,j.publicKey.toBase58(),...T?["",T,""]:[""],"Version: 1",`URI: ${O.href}`,`Issued At: ${(r=(i=N?.signInWithSolana)===null||i===void 0?void 0:i.issuedAt)!==null&&r!==void 0?r:new Date().toISOString()}`,...!((l=N?.signInWithSolana)===null||l===void 0)&&l.notBefore?[`Not Before: ${N.signInWithSolana.notBefore}`]:[],...!((u=N?.signInWithSolana)===null||u===void 0)&&u.expirationTime?[`Expiration Time: ${N.signInWithSolana.expirationTime}`]:[],...!((h=N?.signInWithSolana)===null||h===void 0)&&h.chainId?[`Chain ID: ${N.signInWithSolana.chainId}`]:[],...!((d=N?.signInWithSolana)===null||d===void 0)&&d.nonce?[`Nonce: ${N.signInWithSolana.nonce}`]:[],...!((p=N?.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${N.signInWithSolana.requestId}`]:[],...!((g=(m=N?.signInWithSolana)===null||m===void 0?void 0:m.resources)===null||g===void 0)&&g.length?["Resources",...N.signInWithSolana.resources.map(z=>`- ${z}`)]:[]].join(` 57`);const R=await j.signMessage(new TextEncoder().encode(_),"utf8");if(!R||!(R instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");C=R}}try{const{data:w,error:S}=await Pt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:_,signature:rl(C)},!((b=e.options)===null||b===void 0)&&b.captchaToken?{gotrue_meta_security:{captcha_token:(y=e.options)===null||y===void 0?void 0:y.captchaToken}}:null),xform:rr});if(S)throw S;if(!w||!w.session||!w.user){const T=new ec;return this._returnResult({data:{user:null,session:null},error:T})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:S})}catch(w){if(wt(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async _exchangeCodeForSession(e){const t=await Go(this.storage,`${this.storageKey}-code-verifier`),[i,r]=(t??"").split("/");try{if(!i&&this.flowType==="pkce")throw new Uk;const{data:l,error:u}=await Pt(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:i},xform:rr});if(await Mi(this.storage,`${this.storageKey}-code-verifier`),u)throw u;if(!l||!l.session||!l.user){const h=new ec;return this._returnResult({data:{user:null,session:null,redirectType:null},error:h})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:Object.assign(Object.assign({},l),{redirectType:r??null}),error:u})}catch(l){if(await Mi(this.storage,`${this.storageKey}-code-verifier`),wt(l))return this._returnResult({data:{user:null,session:null,redirectType:null},error:l});throw l}}async signInWithIdToken(e){try{const{options:t,provider:i,token:r,access_token:l,nonce:u}=e,h=await Pt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:i,id_token:r,access_token:l,nonce:u,gotrue_meta_security:{captcha_token:t?.captchaToken}},xform:rr}),{data:d,error:p}=h;if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!d||!d.session||!d.user){const m=new ec;return this._returnResult({data:{user:null,session:null},error:m})}return d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("SIGNED_IN",d.session)),this._returnResult({data:d,error:p})}catch(t){if(wt(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async signInWithOtp(e){var t,i,r,l,u;try{if("email"in e){const{email:h,options:d}=e;let p=null,m=null;this.flowType==="pkce"&&([p,m]=await tc(this.storage,this.storageKey));const{error:g}=await Pt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:h,data:(t=d?.data)!==null&&t!==void 0?t:{},create_user:(i=d?.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:d?.captchaToken},code_challenge:p,code_challenge_method:m},redirectTo:d?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:g})}if("phone"in e){const{phone:h,options:d}=e,{data:p,error:m}=await Pt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:h,data:(r=d?.data)!==null&&r!==void 0?r:{},create_user:(l=d?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:d?.captchaToken},channel:(u=d?.channel)!==null&&u!==void 0?u:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:p?.message_id},error:m})}throw new Cf("You must provide either an email or phone number.")}catch(h){if(await Mi(this.storage,`${this.storageKey}-code-verifier`),wt(h))return this._returnResult({data:{user:null,session:null},error:h});throw h}}async verifyOtp(e){var t,i;try{let r,l;"options"in e&&(r=(t=e.options)===null||t===void 0?void 0:t.redirectTo,l=(i=e.options)===null||i===void 0?void 0:i.captchaToken);const{data:u,error:h}=await Pt(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:l}}),redirectTo:r,xform:rr});if(h)throw h;if(!u)throw new Error("An error occurred on token verification.");const d=u.session,p=u.user;return d?.access_token&&(await this._saveSession(d),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",d)),this._returnResult({data:{user:p,session:d},error:null})}catch(r){if(wt(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithSSO(e){var t,i,r,l,u;try{let h=null,d=null;this.flowType==="pkce"&&([h,d]=await tc(this.storage,this.storageKey));const p=await Pt(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(i=(t=e.options)===null||t===void 0?void 0:t.redirectTo)!==null&&i!==void 0?i:void 0}),!((r=e?.options)===null||r===void 0)&&r.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:h,code_challenge_method:d}),headers:this.headers,xform:lj});return!((l=p.data)===null||l===void 0)&&l.url&&Ai()&&!(!((u=e.options)===null||u===void 0)&&u.skipBrowserRedirect)&&window.location.assign(p.data.url),this._returnResult(p)}catch(h){if(await Mi(this.storage,`${this.storageKey}-code-verifier`),wt(h))return this._returnResult({data:null,error:h});throw h}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:i}=e;if(i)throw i;if(!t)throw new _s;const{error:r}=await Pt(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(e){if(wt(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const t=`${this.url}/resend`;if("email"in e){const{email:i,type:r,options:l}=e,{error:u}=await Pt(this.fetch,"POST",t,{headers:this.headers,body:{email:i,type:r,gotrue_meta_security:{captcha_token:l?.captchaToken}},redirectTo:l?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:u})}else if("phone"in e){const{phone:i,type:r,options:l}=e,{data:u,error:h}=await Pt(this.fetch,"POST",t,{headers:this.headers,body:{phone:i,type:r,gotrue_meta_security:{captcha_token:l?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:u?.message_id},error:h})}throw new Cf("You must provide either an email or phone number and a type")}catch(t){if(wt(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async t=>t))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const i=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await i,await t()))();return this.pendingInLock.push((async()=>{try{await r}catch{}})()),r}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const i=t();for(this.pendingInLock.push((async()=>{try{await i}catch{}})()),await i;this.pendingInLock.length;){const r=[...this.pendingInLock];await Promise.all(r),this.pendingInLock.splice(0,r.length)}return await i}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const t=await Go(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),t!==null&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not val
57id"),await this._removeSession())),!e)return{data:{session:null},error:null};const i=e.expires_at?e.expires_at*1e3-Date.now()<Qg:!1;if(this._debug("#__loadSession()",`session has${i?"":" not"} expired`,"expires_at",e.expires_at),!i){if(this.userStorage){const u=await Go(this.userStorage,this.storageKey+"-user");u?.user?e.user=u.user:e.user=tx()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const u={value:this.suppressGetSessionWarning};e.user=sj(e.user,u),u.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:r,error:l}=await this._callRefreshToken(e.refresh_token);return l?this._returnResult({data:{session:null},error:l}):this._returnResult({data:{session:r},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const t=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await Pt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:mo}):await this._useSession(async t=>{var i,r,l;const{data:u,error:h}=t;if(h)throw h;return!(!((i=u.session)===null||i===void 0)&&i.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new _s}:await Pt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(l=(r=u.session)===null||r===void 0?void 0:r.access_token)!==null&&l!==void 0?l:void 0,xform:mo})})}catch(t){if(wt(t))return Jg(t)&&(await this._removeSession(),await Mi(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:t});throw t}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async i=>{const{data:r,error:l}=i;if(l)throw l;if(!r.session)throw new _s;const u=r.session;let h=null,d=null;this.flowType==="pkce"&&e.email!=null&&([h,d]=await tc(this.storage,this.storageKey));const{data:p,error:m}=await Pt(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:t?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:h,code_challenge_method:d}),jwt:u.access_token,xform:mo});if(m)throw m;return u.user=p.user,await this._saveSession(u),await this._notifyAllSubscribers("USER_UPDATED",u),this._returnResult({data:{user:u.user},error:null})})}catch(i){if(await Mi(this.storage,`${this.storageKey}-code-verifier`),wt(i))return this._returnResult({data:{user:null},error:i});throw i}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new _s;const t=Date.now()/1e3;let i=t,r=!0,l=null;const{payload:u}=Tf(e.access_token);if(u.exp&&(i=u.exp,r=i<=t),r){const{data:h,error:d}=await this._callRefreshToken(e.refresh_token);if(d)return this._returnResult({data:{user:null,session:null},error:d});if(!h)return{data:{user:null,session:null},error:null};l=h}else{const{data:h,error:d}=await this._getUser(e.access_token);if(d)return this._returnResult({data:{user:null,session:null},error:d});l={access_token:e.access_token,refresh_token:e.refresh_token,user:h.user,token_type:"bearer",expires_in:i-t,expires_at:i},await this._saveSession(l),await this._notifyAllSubscribers("SIGNED_IN",l)}return this._returnResult({data:{user:l.user,session:l},error:null})}catch(t){if(wt(t))return this._returnResult({data:{session:null,user:null},error:t});throw t}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var i;if(!e){const{data:u,error:h}=t;if(h)throw h;e=(i=u.session)!==null&&i!==void 0?i:void 0}if(!e?.refresh_token)throw new _s;const{data:r,error:l}=await this._callRefreshToken(e.refresh_token);return l?this._returnResult({data:{user:null,session:null},error:l}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(t){if(wt(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async _getSessionFromURL(e,t){try{if(!Ai())throw new Nf("No browser detected.");
57if(e.error||e.error_description||e.error_code)throw new Nf(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if(this.flowType==="pkce")throw new $3("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Nf("Not a valid implicit grant flow url.");break;default:}if(t==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new $3("No code detected.");const{data:T,error:N}=await this._exchangeCodeForSession(e.code);if(N)throw N;const j=new URL(window.location.href);return j.searchParams.delete("code"),window.history.replaceState(window.history.state,"",j.toString()),{data:{session:T.session,redirectType:null},error:null}}const{provider_token:i,provider_refresh_token:r,access_token:l,refresh_token:u,expires_in:h,expires_at:d,token_type:p}=e;if(!l||!h||!u||!p)throw new Nf("No session defined in URL");const m=Math.round(Date.now()/1e3),g=parseInt(h);let b=m+g;d&&(b=parseInt(d));const y=b-m;y*1e3<=_c&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${y}s, should have been closer to ${g}s`);const _=b-g;m-_>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",_,b,m):m-_<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",_,b,m);const{data:C,error:w}=await this._getUser(l);if(w)throw w;const S={provider_token:i,provider_refresh_token:r,access_token:l,expires_in:g,expires_at:b,refresh_token:u,token_type:p,user:C.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:S,redirectType:e.type},error:null})}catch(i){if(wt(i))return this._returnResult({data:{session:null,redirectType:null},error:i});throw i}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const t=await Go(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var i;const{data:r,error:l}=t;if(l&&!Jg(l))return this._returnResult({error:l});const u=(i=r.session)===null||i===void 0?void 0:i.access_token;if(u){const{error:h}=await this.admin.signOut(u,e);if(h&&!(Ok(h)&&(h.status===404||h.status===401||h.status===403)||Jg(h)))return this._returnResult({error:h})}return e!=="others"&&(await this._removeSession(),await Mi(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const t=Vk(),i={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,i),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)})))(),{data:{subscription:i}}}async _emitInitialSession(e){return await this._useSession(async t=>{var i,r;try{const{data:{session:l},error:u}=t;if(u)throw u;await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",l)),this._debug("INITIAL_SESSION","callback id",e,"session",l)}catch(l){await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",l),console.error(l)}})}async resetPasswordForEmail(e,t={}){let i=null,r=null;this.flowType==="pkce"&&([i,r]=await tc(this.storage,this.storageKey,!0));try{return await Pt(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:i,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(l){if(await Mi(this.storage,`${this.storageKey}-code-verifier`),wt(l))return this._returnResult({data:null,error:l});throw l}}async getUserIdentities(){var e;try{const{data:t,error:i}=await this.getUser();if(i)throw i;return this._returnResult({data:{identities:(e=t.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(t){if(wt(t))return this._returnResult({data:null,error:t});throw t}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{const{data:i,error:r}=await this._useSession(async l=>{var u,h,d,p,m;const{data:g,error:b}=l;if(b)throw b;const y=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(u=e.options)===null||u===void 0?void 0:u.redirectTo,scopes:(h=e.options)===null||h===void 0?void 0:h.scopes,queryParams:(d=e.options)===null||d===void 0?void 0:d.queryParams,skipBrowserRedirect:!0});return await Pt(this.fetch,"GET",y,{headers:this.headers,jwt:(m=(p=g.session)===null||p===void 0?void 0:p.access_token)!==null&&m!==void 0?m:void 0})});if(r)throw r;return Ai()&&!(!((t=e.options)===null||t===void 0)&&t.skipBrowserRedirect)&&window.location.assign(i?.url),this._returnResult({data:{provider:e.provider,url:i?.url},error:null})}catch(i){if(wt(i))return this._returnResult({data:{provider:e.provider,url:null},error:i});throw i}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var i;try{const{error:r,data:{session:l}}=t;if(r)throw r;const{options:u,provider:h,token:d,access_token:p,nonce:m}=e,g=await Pt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(i=l?.access_token)!==null&&i!==void 0?i:void 0,body:{provider:h,id_token:d,access_token:p,nonce:m,link_identity:!0,gotrue_meta_security:{captcha_token:u?.captchaToken}},xform:rr}),{data:b,error:y}=g;return y?this._returnResult({data:{user:null,session:null},error:y}
57):!b||!b.session||!b.user?this._returnResult({data:{user:null,session:null},error:new ec}):(b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("USER_UPDATED",b.session)),this._returnResult({data:b,error:y}))}catch(r){if(await Mi(this.storage,`${this.storageKey}-code-verifier`),wt(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var i,r;const{data:l,error:u}=t;if(u)throw u;return await Pt(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(r=(i=l.session)===null||i===void 0?void 0:i.access_token)!==null&&r!==void 0?r:void 0})})}catch(t){if(wt(t))return this._returnResult({data:null,error:t});throw t}}async _refreshAccessToken(e){const t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{const i=Date.now();return await Xk(async r=>(r>0&&await Wk(200*Math.pow(2,r-1)),this._debug(t,"refreshing attempt",r),await Pt(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:rr})),(r,l)=>{const u=200*Math.pow(2,r);return l&&ex(l)&&Date.now()+u-i<_c})}catch(i){if(this._debug(t,"error",i),wt(i))return this._returnResult({data:{session:null,user:null},error:i});throw i}finally{this._debug(t,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){const i=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",i),Ai()&&!t.skipBrowserRedirect&&window.location.assign(i),{data:{provider:e,url:i},error:null}}async _recoverAndRefresh(){var e,t;const i="#_recoverAndRefresh()";this._debug(i,"begin");try{const r=await Go(this.storage,this.storageKey);if(r&&this.userStorage){let u=await Go(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!u&&(u={user:r.user},await wc(this.userStorage,this.storageKey+"-user",u)),r.user=(e=u?.user)!==null&&e!==void 0?e:tx()}else if(r&&!r.user&&!r.user){const u=await Go(this.storage,this.storageKey+"-user");u&&u?.user?(r.user=u.user,await Mi(this.storage,this.storageKey+"-user"),await wc(this.storage,this.storageKey,r)):r.user=tx()}if(this._debug(i,"session from storage",r),!this._isValidSession(r)){this._debug(i,"session is not valid"),r!==null&&await this._removeSession();return}const l=((t=r.expires_at)!==null&&t!==void 0?t:1/0)*1e3-Date.now()<Qg;if(this._debug(i,`session has${l?"":" not"} expired with margin of ${Qg}s`),l){if(this.autoRefreshToken&&r.refresh_token){const{error:u}=await this._callRefreshToken(r.refresh_token);u&&(console.error(u),ex(u)||(this._debug(i,"refresh failed with a non-retryable error, removing the session",u),await this._removeSession()))}}else if(r.user&&r.user.__isUserNotAvailableProxy===!0)try{const{data:u,error:h}=await this._getUser(r.access_token);!h&&u?.user?(r.user=u.user,await this._saveSession(r),await this._notifyAllSubscribers("SIGNED_IN",r)):this._debug(i,"could not get user data, skipping SIGNED_IN notification")}catch(u){console.error("Error getting user data:",u),this._debug(i,"error getting user data, skipping SIGNED_IN notification",u)}else await this._notifyAllSubscribers("SIGNED_IN",r)}catch(r){this._debug(i,"error",r),console.error(r);return}finally{this._debug(i,"end")}}async _callRefreshToken(e){var t,i;if(!e)throw new _s;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const r=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{this.refreshingDeferred=new om;const{data:l,error:u}=await this._refreshAccessToken(e);if(u)throw u;if(!l.session)throw new _s;await this._saveSession(l.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",l.session);const h={data:l.session,error:null};return this.refreshingDeferred.resolve(h),h}catch(l){if(this._debug(r,"error",l),wt(l)){const u={data:null,error:l};return ex(l)||await this._removeSession(),(t=this.refreshingDeferred)===null||t===void 0||t.resolve(u),u}throw(i=this.refreshingDeferred)===null||i===void 0||i.reject(l),l}finally{this.refreshingDeferred=null,this._debug(r,"end")}}async _notifyAllSubscribers(e,t,i=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,"begin",t,`broadcast = ${i}`);try{this.broadcastChannel&&i&&this.broadcastChannel.postMessage({event:e,session:t});const l=[],u=Array.from(this.stateChangeEmitters.values()).map(async h=>{try{await h.callback(e,t)}catch(d){l.push(d)}});if(await Promise.all(u),l.length>0){for(let h=0;h<l.length;h+=1)console.error(l[h]);throw l[0]}}finally{this._debug(r,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await Mi(this.storage,`${this.storageKey}-code-verifier`);const t=Object.assign({},e),i=t.user&&t.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!i&&t.user&&await wc(this.userStorage,this.storageKey+"-user",{user:t.user});const r=Object.assign({},t);delete r.user;const l=G3(r);await wc(this.storage,this.storageKey,l)}else{const r=G3(t);await wc(this.storage,this.storageKey,r)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Mi(this.storage,this.storageKey),await Mi(this.storage,this.storageKey+"-code-verifier"),await Mi(this.storage,this.storageKey+"-user"),this.userStorage&&await Mi(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Ai()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}
57catch(t){console.error("removing visibilitychange callback failed",t)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),_c);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:i}}=t;if(!i||!i.refresh_token||!i.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const r=Math.floor((i.expires_at*1e3-e)/_c);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts ${_c}ms, refresh threshold is ${E1} ticks`),r<=E1&&await this._callRefreshToken(i.refresh_token)})}catch(t){console.error("Auto refresh tick failed with error. This is likely a transient error.",t)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof x5)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ai()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,i){const r=[`provider=${encodeURIComponent(t)}`];if(i?.redirectTo&&r.push(`redirect_to=${encodeURIComponent(i.redirectTo)}`),i?.scopes&&r.push(`scopes=${encodeURIComponent(i.scopes)}`),this.flowType==="pkce"){const[l,u]=await tc(this.storage,this.storageKey),h=new URLSearchParams({code_challenge:`${encodeURIComponent(l)}`,code_challenge_method:`${encodeURIComponent(u)}`});r.push(h.toString())}if(i?.queryParams){const l=new URLSearchParams(i.queryParams);r.push(l.toString())}return i?.skipBrowserRedirect&&r.push(`skip_http_redirect=${i.skipBrowserRedirect}`),`${e}?${r.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var i;const{data:r,error:l}=t;return l?this._returnResult({data:null,error:l}):await Pt(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(i=r?.session)===null||i===void 0?void 0:i.access_token})})}catch(t){if(wt(t))return this._returnResult({data:null,error:t});throw t}}async _enroll(e){try{return await this._useSession(async t=>{var i,r;const{data:l,error:u}=t;if(u)return this._returnResult({data:null,error:u});const h=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:d,error:p}=await Pt(this.fetch,"POST",`${this.url}/factors`,{body:h,headers:this.headers,jwt:(i=l?.session)===null||i===void 0?void 0:i.access_token});return p?this._returnResult({data:null,error:p}):(e.factorType==="totp"&&d.type==="totp"&&(!((r=d?.totp)===null||r===void 0)&&r.qr_code)&&(d.totp.qr_code=`data:image/svg+xml;utf-8,${d.totp.qr_code}`),this._returnResult({data:d,error:null}))})}catch(t){if(wt(t))return this._returnResult({data:null,error:t});throw t}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var i;const{data:r,error:l}=t;if(l)return this._returnResult({data:null,error:l});const u=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?Ej(e.webauthn.credential_response):Cj(e.webauthn.credential_response)})}:{code:e.code}),{data:h,error:d}=await Pt(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:u,headers:this.headers,jwt:(i=r?.session)===null||i===void 0?void 0:i.access_token});return d?this._returnResult({data:null,error:d}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+h.expires_in},h)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",h),this._returnResult({data:h,error:d}))})}catch(t){if(wt(t))return this._returnResult({data:null,error:t});throw t}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var i;const{data:r,error:l}=t;if(l)return this._returnResult({data:null,error:l});const u=await Pt(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(i=r?.session)===null||i===void 0?void 0:i.access_token});if(u.error)return u;const{data:h}=u;if(h.type!=="webauthn")return{data:h,error:null};switch(h.webauthn.type){case"create":return{data:Object.assign(Object.assign({},h),{webauthn:Object.assign(Object.assign({},h.webauthn),{credential_options:Object.assign(Object.assign({},h.webauthn.credential_options),{publicKey:wj(h.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},h),{webauthn:Object.assign(Object.assign({},h.webauthn),{credential_options:Object.assign(Object.assign({},h.webauthn.credential_options),{publicKey:Sj(h.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(t){if(wt(t))return this._returnResult({data:null,error:t});throw t}})}async _challengeAndVerify(e){const{data:t,error:i}=await this._challenge({factorId:e.factorId});return i?this._returnResult({data:null,error:i}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;const{data:{user:t},error:i}=await this.getUser();if(i)return{data:null,error:i};const r={all:[],phone:[],totp:[],webauthn:[]};for(const l of(e=t?.factors)!==null&&e!==void 0?e:[])r.all.push(l),l.status==="verified"&&r[l.factor_type].push(l);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,i,r,l;if(e)try{const{payload:y}=Tf(e);let _=null;y.aal&&(_=y.aal);let C=_;const{data:{user:w},error:S}=await this.getUser(e);if(S)return this._returnResult({data:null,error:S});((i=(t=w?.factors)===null||t===void 0?void 0:t.filter(j=>j.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(C="aal2");const N=y.amr||[];return{data:{currentLevel:_,nextLevel:C,currentAuthenticationMethods:N},error:null}}catch(y){if(wt(y))return this._returnResult({data:null,error:y});throw y}const{data:{session:u},error:h}
57=await this.getSession();if(h)return this._returnResult({data:null,error:h});if(!u)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:d}=Tf(u.access_token);let p=null;d.aal&&(p=d.aal);let m=p;((l=(r=u.user.factors)===null||r===void 0?void 0:r.filter(y=>y.status==="verified"))!==null&&l!==void 0?l:[]).length>0&&(m="aal2");const b=d.amr||[];return{data:{currentLevel:p,nextLevel:m,currentAuthenticationMethods:b},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{const{data:{session:i},error:r}=t;return r?this._returnResult({data:null,error:r}):i?await Pt(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:i.access_token,xform:l=>({data:l,error:null})}):this._returnResult({data:null,error:new _s})})}catch(t){if(wt(t))return this._returnResult({data:null,error:t});throw t}}async _approveAuthorization(e,t){try{return await this._useSession(async i=>{const{data:{session:r},error:l}=i;if(l)return this._returnResult({data:null,error:l});if(!r)return this._returnResult({data:null,error:new _s});const u=await Pt(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"approve"},xform:h=>({data:h,error:null})});return u.data&&u.data.redirect_url&&Ai()&&!t?.skipBrowserRedirect&&window.location.assign(u.data.redirect_url),u})}catch(i){if(wt(i))return this._returnResult({data:null,error:i});throw i}}async _denyAuthorization(e,t){try{return await this._useSession(async i=>{const{data:{session:r},error:l}=i;if(l)return this._returnResult({data:null,error:l});if(!r)return this._returnResult({data:null,error:new _s});const u=await Pt(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"deny"},xform:h=>({data:h,error:null})});return u.data&&u.data.redirect_url&&Ai()&&!t?.skipBrowserRedirect&&window.location.assign(u.data.redirect_url),u})}catch(i){if(wt(i))return this._returnResult({data:null,error:i});throw i}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:t},error:i}=e;return i?this._returnResult({data:null,error:i}):t?await Pt(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:r=>({data:r,error:null})}):this._returnResult({data:null,error:new _s})})}catch(e){if(wt(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{const{data:{session:i},error:r}=t;return r?this._returnResult({data:null,error:r}):i?(await Pt(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:i.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new _s})})}catch(t){if(wt(t))return this._returnResult({data:null,error:t});throw t}}async fetchJwk(e,t={keys:[]}){let i=t.keys.find(h=>h.kid===e);if(i)return i;const r=Date.now();if(i=this.jwks.keys.find(h=>h.kid===e),i&&this.jwks_cached_at+Lk>r)return i;const{data:l,error:u}=await Pt(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(u)throw u;return!l.keys||l.keys.length===0||(this.jwks=l,this.jwks_cached_at=r,i=l.keys.find(h=>h.kid===e),!i)?null:i}async getClaims(e,t={}){try{let i=e;if(!i){const{data:y,error:_}
57=await this.getSession();if(_||!y.session)return this._returnResult({data:null,error:_});i=y.session.access_token}const{header:r,payload:l,signature:u,raw:{header:h,payload:d}}=Tf(i);t?.allowExpired||tj(l.exp);const p=!r.alg||r.alg.startsWith("HS")||!r.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(r.kid,t?.keys?{keys:t.keys}:t?.jwks);if(!p){const{error:y}=await this.getUser(i);if(y)throw y;return{data:{claims:l,header:r,signature:u},error:null}}const m=nj(r.alg),g=await crypto.subtle.importKey("jwk",p,m,!0,["verify"]);if(!await crypto.subtle.verify(m,g,u,Bk(`${h}.${d}`)))throw new T1("Invalid JWT signature");return{data:{claims:l,header:r,signature:u},error:null}}catch(i){if(wt(i))return this._returnResult({data:null,error:i});throw i}}}Bd.nextInstanceID={};const Pj=Bd,Oj="2.98.0";let md="";typeof Deno<"u"?md="deno":typeof document<"u"?md="web":typeof navigator<"u"&&navigator.product==="ReactNative"?md="react-native":md="node";const Dj={"X-Client-Info":`supabase-js-${md}/${Oj}`},Uj={headers:Dj},Ij={schema:"public"},zj={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},$j={};function Hd(n){"@babel/helpers - typeof";return Hd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hd(n)}function Fj(n,e){if(Hd(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(Hd(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Bj(n){var e=Fj(n,"string");return Hd(e)=="symbol"?e:e+""}function Hj(n,e,t){return(e=Bj(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Q3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function Bn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Q3(Object(t),!0).forEach(function(i){Hj(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Q3(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}const Vj=n=>n?(...e)=>n(...e):(...e)=>fetch(...e),Gj=()=>Headers,qj=(n,e,t)=>{const i=Vj(t),r=Gj();return async(l,u)=>{var h;const d=(h=await e())!==null&&h!==void 0?h:n;let p=new r(u?.headers);return p.has("apikey")||p.set("apikey",n),p.has("Authorization")||p.set("Authorization",`Bearer ${d}`),i(l,Bn(Bn({},u),{},{headers:p}))}};function Wj(n){return n.endsWith("/")?n:n+"/"}function Xj(n,e){var t,i;const{db:r,auth:l,realtime:u,global:h}=n,{db:d,auth:p,realtime:m,global:g}=e,b={db:Bn(Bn({},d),r),auth:Bn(Bn({},p),l),realtime:Bn(Bn({},m),u),storage:{},global:Bn(Bn(Bn({},g),h),{},{headers:Bn(Bn({},(t=g?.headers)!==null&&t!==void 0?t:{}),(i=h?.headers)!==null&&i!==void 0?i:{})}),accessToken:async()=>""};return n.accessToken?b.accessToken=n.accessToken:delete b.accessToken,b}function Yj(n){const e=n?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Wj(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Kj=class extends Pj{constructor(n){super(n)}},Zj=class{constructor(n,e,t){var i,r;this.supabaseUrl=n,this.supabaseKey=e;const l=Yj(n);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",l),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",l),this.storageUrl=new URL("storage/v1",l),this.functionsUrl=new URL("functions/v1",l);const u=`sb-${l.hostname.split(".")[0]}-auth-token`,h={db:Ij,realtime:$j,auth:Bn(Bn({},zj),{},{storageKey:u}),global:Uj},d=Xj(t??{},h);if(this.storageKey=(i=d.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(r=d.global.headers)!==null&&r!==void 0?r:{},d.accessToken)this.accessToken=d.accessToken,this.auth=new Proxy({},{get:(m,g)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(g)} is not possible`)}});else{var p;this.auth=this._initSupabaseAuthClient((p=d.auth)!==null&&p!==void 0?p:{},this.headers,d.global.fetch)}this.fetch=qj(e,this._getAccessToken.bind(this),d.global.fetch),this.realtime=this._initRealtimeClient(Bn({headers:this.headers,accessToken:this._getAccessToken.bind(this)},d.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(m=>this.realtime.setAuth(m)).catch(m=>console.warn("Failed to set initial Realtime auth token:",m)),this.rest=new O8(new
57URL("rest/v1",l).href,{headers:this.headers,schema:d.db.schema,fetch:this.fetch,timeout:d.db.timeout,urlLengthLimit:d.db.urlLengthLimit}),this.storage=new Mk(this.storageUrl.href,this.headers,this.fetch,t?.storage),d.accessToken||this._listenForAuthEvents()}get functions(){return new T8(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(n){return this.rest.from(n)}schema(n){return this.rest.schema(n)}rpc(n,e={},t={head:!1,get:!1,count:void 0}){return this.rest.rpc(n,e,t)}channel(n,e={config:{}}){return this.realtime.channel(n,e)}getChannels(){return this.realtime.getChannels()}removeChannel(n){return this.realtime.removeChannel(n)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var n=this,e,t;if(n.accessToken)return await n.accessToken();const{data:i}=await n.auth.getSession();return(e=(t=i.session)===null||t===void 0?void 0:t.access_token)!==null&&e!==void 0?e:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:n,persistSession:e,detectSessionInUrl:t,storage:i,userStorage:r,storageKey:l,flowType:u,lock:h,debug:d,throwOnError:p},m,g){const b={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Kj({url:this.authUrl.href,headers:Bn(Bn({},b),m),storageKey:l,autoRefreshToken:n,persistSession:e,detectSessionInUrl:t,storage:i,userStorage:r,flowType:u,lock:h,debug:d,throwOnError:p,fetch:g,hasCustomAuthorizationHeader:Object.keys(this.headers).some(y=>y.toLowerCase()==="authorization")})}_initRealtimeClient(n){return new Q8(this.realtimeUrl.href,Bn(Bn({},n),{},{params:Bn(Bn({},{apikey:this.supabaseKey}),n?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,e)=>{this._handleTokenChanged(n,"CLIENT",e?.access_token)})}_handleTokenChanged(n,e,t){(n==="TOKEN_REFRESHED"||n==="SIGNED_IN")&&this.changedAccessToken!==t?(this.changedAccessToken=t,this.realtime.setAuth(t)):n==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Qj=(n,e,t)=>new Zj(n,e,t);function Jj(){if(typeof window<"u")return!1;const n=globalThis.process;if(!n)return!1;const e=n.version;if(e==null)return!1;const t=e.match(/^v(\d+)\./);return t?parseInt(t[1],10)<=18:!1}Jj()&&console.warn("â ï¸ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const e7="https://efkgbooomqvflwgtkwua.supabase.co",t7="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImVma2dib29vbXF2Zmx3Z3Rrd3VhIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzI1NzIxMjksImV4cCI6MjA4ODE0ODEyOX0.B53nPjbVv9qbeQTRfAYldfY8_G7jSBlpjB2sFGxRGZw",Fe=Qj(e7,t7),n7="https://api.dicebear.com/9.x/micah/svg";function i7(n){const e=String(n).trim()||"pyroplay-user";return`${n7}?seed=${encodeURIComponent(e)}`}function Yc(n){const e=String(n.avatarUrl||"").trim();if(e)return e;const t=String(n.username||"").trim()||String(n.displayName||"").trim()||String(n.userId||"").trim()||String(n.fallbackSeed||"").trim()||"pyroplay-user";return i7(t)}const y5=(n,e)=>{const t=n.replace(/\/+$/,"");return t.endsWith("/api")?`${t}${e.replace(/^\/api/,"")}`:`${t}${e}`},_5=async(n,e,t)=>{const i=await fetch(y5(n,`/api/stats?query=${encodeURIComponent(e)}`),{signal:t});if(!i.ok)throw new Error("Failed to fetch media stats");const r=await i.json(),l=Number(r?.totalVisitors??r?.totals?.visitors??0);return Number.isFinite(l)?l:0},s7=async(n,e)=>{const t=await fetch(y5(n,"/api/stats/active"),{signal:e});if(!t.ok)throw new Error("Failed to fetch active visitors");const i=await t.json(),r=Number(i?.visitors??0);return Number.isFinite(r)?r:0},Up=n=>new Intl.NumberFormat("en-US",{notation:n>=1e3?"compact":"standard",maximumFractionDigits:n>=1e3?1:0}).format(n),M1="watchpump:app-preferences-updated",w5="Missing app_preferences on public.profiles. Run watchpump-server/supabase/app_preferences.sql in Supabase SQL editor.",A1=[{id:"home",label:"Home",description:"Landing page with featured drops and recommendations."},{id:"tv",label:"TV Shows",description:"Series browsing and direct episode playback.",mobileLabel:"TV"},{id:"movies",label:"Movies",description:"Movie discovery, unlocks, and playback."},{id:"sports",label:"Sports",description:"Live sports and match center shortcuts."},{id:"anime",label:"Anime",description:"Anime catalog and episode navigation."}],_a=A1.map(n=>n.id),Ea={primaryNavItemIds:[..._a]};function r7(n){return _a.includes(n)}function S5(n){const t=(n instanceof Error?n.message:typeof n=="string"?n:"").toLowerCase();return t.includes("app_preferences")&&t.includes("column")}
57function Ip(n){if(!Array.isArray(n))return[];const e=new Set;for(const t of n)r7(t)&&!e.has(t)&&e.add(t);return _a.filter(t=>e.has(t))}function E5(n){const e=n&&typeof n=="object"?n:null,t=Ip(e?.primaryNavItemIds??e?.primaryNavItems);return{primaryNavItemIds:t.length>0?t:[..._a]}}function C5(n,e){return n.primaryNavItemIds.includes(e)}function a7(n){typeof window>"u"||window.dispatchEvent(new CustomEvent(M1,{detail:n}))}async function N5(n){if(!Fe||!n)return Ea;const{data:e,error:t}=await Fe.from("profiles").select("app_preferences").eq("id",n).maybeSingle();if(t){if(S5(t))return console.warn(w5),Ea;throw t}return E5((e||null)?.app_preferences)}async function o7(n,e){if(!Fe||!n)return Ea;const t=Ip(e.primaryNavItemIds);if(t.length===0)throw new Error("Select at least one navigation item.");const i={primaryNavItemIds:t},{error:r}=await Fe.from("profiles").upsert({id:n,app_preferences:i},{onConflict:"id"});if(r)throw S5(r)?new Error(w5):r;return a7(i),i}const l7="/download/android",c7="/install/windows",T5="/PyroPlay.apk";function u7(){if(typeof navigator>"u")return"other";const n=navigator,e=typeof n.userAgentData?.platform=="string"?n.userAgentData.platform.toLowerCase():"",t=navigator.userAgent.toLowerCase();return e.includes("android")||t.includes("android")?"android":e.includes("windows")||t.includes("windows")?"windows":"other"}function d7(){if(typeof window>"u"||typeof navigator>"u"||typeof document>"u")return!1;const n=navigator,e=window,i=["standalone","fullscreen","minimal-ui","window-controls-overlay"].some(h=>window.matchMedia(`(display-mode: ${h})`).matches),r=n.standalone===!0,l=document.referrer.includes("android-app://"),u=!!e.Capacitor?.isNativePlatform?.();return i||r||l||u}function h7(){if(typeof document>"u")return;const n=document.createElement("a");n.href=T5,n.download="PyroPlay.apk",n.rel="noopener",document.body.appendChild(n),n.click(),document.body.removeChild(n)}const f7="https://watch-server-production-c01b.up.railway.app/api",p7=[{label:"TV Shows",to:"/tv",preferenceId:"tv"},{label:"Movies",to:"/movies",preferenceId:"movies"},{label:"Family",to:"/family"},{label:"Sports",to:"/sports",preferenceId:"sports"},{label:"Anime",to:"/anime",preferenceId:"anime"},{label:"Leaderboard",to:"/leaderboard"},{label:"Quests",to:"/quests"}];function m7({appPreferences:n,isScrolled:e,onSearchClick:t}){const[i,r]=E.useState(!1),[l,u]=E.useState(null),[h,d]=E.useState(""),[p,m]=E.useState(null),[g,b]=E.useState("other"),[y,_]=E.useState(!1),C=E.useRef(null),w=ml(),S=js(),T=p7.filter(G=>!G.preferenceId||C5(n,G.preferenceId)),N=()=>{r(!1)},j=()=>{r(G=>!G)},O=l?.user_metadata?.username||l?.email?.split("@")[0]||"Guest",R=Yc({avatarUrl:h,username:O,userId:l?.id||"",fallbackSeed:"guest"}),z=async G=>{if(!Fe)return;const{data:U,error:Y}=await Fe.from("profiles").select("avatar_url").eq("id",G).maybeSingle();if(Y){console.warn("Failed to load profile image for navbar:",Y.message||Y);return}d(U?.avatar_url||"")},M=async()=>{Fe&&(await Fe.auth.signOut(),r(!1))},P=()=>{const G=`${S.pathname}${S.search}`;w(`/login?next=${encodeURIComponent(G)}`),r(!1)};return E.useEffect(()=>{b(u7()),_(d7())},[]),E.useEffect(()=>{const G=new AbortController,U=async()=>{try{const W=await s7(f7,G.signal);m(W)}catch(W){if(G.signal.aborted)return;console.warn("Failed to load active visitors for navbar:",W),m(null)}};U();const Y=window.setInterval(()=>{U()},3e4);return()=>{G.abort(),window.clearInterval(Y)}},[]),E.useEffect(()=>{if(!Fe)return;let G=!0;Fe.auth.getUser().then(({data:Y})=>{G&&(u(Y.user??null),Y.user?.id&&z(Y.user.id))});const{data:{subscription:U}}=Fe.auth.onAuthStateChange((Y,W)=>{u(W?.user??null),W?.user?.id?z(W.user.id):d("")});return()=>{G=!1,U.unsubscribe()}},[]),E.useEffect(()=>{const G=U=>{const W=U.detail?.avatarUrl;typeof W=="string"&&d(W)};return window.addEventListener("profile:updated",G),()=>{window.removeEventListener("profile:updated",G)}},[]),E.useEffect(()=>{if(!i)return;const G=U=>{C.current&&!C.current.contains(U.target)&&r(!1)};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[i]),o.jsx("nav",{className:`fixed w-full z-50 transition-all duration-300 ${e?"bg-zinc-950/95 backdrop-blur-md shadow-lg py-2":"bg-linear-to-b from-zinc-950 via-zinc-950/75 to-transparent py-3"}`,children:o.jsxs("div",{className:"flex items-center justify-between px-4 md:px-12",children:[o.jsxs("div",{className:"flex items-center gap-8",children:[o.jsx("div",{className:"flex flex-col items-start relative",children:o.jsxs(Ut,{to:"/",onClick:N,children:[o.jsx("h1",{className:"text-[#E25E0C] text-3xl font-black tracking-tighter cursor-pointer hidden",children:"PYROPLAY"}),S.pathname.includes("anime")?o.jsx("img",{src:"/animeplay.png",alt:"PyroPlay Japanese Logo",className:"h-12 md:h-16"}):o.jsx("img",{src:"/pyroplay.png",alt:"PyroPlay Logo",className:"h-12 md:h-16"}),p!==null&&o.jsxs("div",{className:"absolute -bottom-0.5 scale-90 -right-2 mt-1 inline-flex items-center gap-1.5 rounded-full border border-emerald-400/25 bg-emerald-400/10 px-2.5 py-1 text-[10px] font-semibold text-emerald-200 md:hidden",children:[o.jsx(T3,{className:"h-3 w-3"}),o.jsx("span",{children:Up(p)})]})]})}),o.jsx("ul",{className:"hidden md:flex gap-5 text-sm font-medium text-zinc-300",children:T.map(G=>o.jsx("li",{className:"cursor-pointer hover:text-zinc-400 transition",children:o.jsx(Ut,{to:G.to,children:G.label})},G.to))})]}),o.jsxs("div",{className:"flex items-center gap-3 md:gap-6 text-zinc-300",children:[p!==null&&o.jsxs("div",{className:"hidden lg:inline-flex items-center gap-2 rounded-full border border-emerald-400/25 bg-emerald-400/10 px-3 py-1 text-xs font-semibold text-emerald-200",children:[o.jsx(T3,{className:"h-3.5 w-3.5"}),o.jsx("span",{className:"text-green-200",children:Up(p)})]}),!S.pathname.includes("anime")&&!S.pathname.includes("sports")&&o.jsxs("button",{type:"button",onClick:t,className:"inline-flex items-center gap-2 text-sm font-medium hover:text-white transition",children:[o.jsx(_d,{className:"w-5 h-5"}),o.jsx("span",{className:"hidden md:inline",children:"Search"})]}),!S.pathname.includes("anime")&&!S.pathname.includes("sports")&&o.jsx("button",{type:"button",onClick:t,className:"inline-flex items-center justify-center rounded-full p-2 hover:bg-zinc-800/80 transition","aria-label":"AI Search",title:"AI Search",children:o.jsx(pr,{className:"w-5 h-5"})}),!l&&o.jsx("button",{type:"button",onClick:P,className:"hidden rounded-md bg-[#E25E0C] px-3 py-2 text-sm font-semibold text-white hover:bg-[#f76c15] transition md:inline-flex",children:"Login / Register"}),o.jsxs("div",{ref:C,className:"relative",children:[o.jsxs("button",{type:"button",onClick:j,className:"inline-flex items-center gap-2 rounded-full px-1 py-1 text-zinc-200 hover:bg-zinc-800/70 transition","aria-expanded":i,"aria-haspopup":"menu",children:[o.jsx("div",{className:"w-8 h-8 rounded bg-transparent overflow-hidden flex items-center justify-center text-sm font-bold text-white",children:l?o.jsx("img",{src:R,alt:"Profile",className:"w-full h-full object-cover"}):o.jsx("img",{src:"/alon.jpg",alt:"Profile",className:"w-full h-full object-cover"})}),o.jsx(K6,{className:`w-4 h-4 transition duration-300 ${i?"rotate-180":""}`})]}),i&&o.jsx("div",{className:"absolute right-0 top-12 z-20 w-72 rounded-lg border border-white/10 bg-zinc-900/95 px-3 py-3 text-zinc-100 shadow-xl backdrop-blur-md",children:l?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-xs text-zinc-400",children:"Signed in as"}),o.jsx("p",{className:"mt-1 truncate text-sm font-semibold text-white",children:O}),o.jsx("p",{className:"mt-0.5 truncate text-xs text-zinc-400",children:l.email}),o.jsxs("div",{className:"mt-3 space-y-2 border-y border-white/10 py-3",children:[o.jsx(Ut,{to:"/account/stats",onClick:()=>r(!1),className:"block rounded-md px-2 py-1.5 text-sm text-zinc-200 hover:bg-zinc-800/80 hover:text-white transition",children:"Account"}),o.jsx(Ut,{to:"/account/preferences",onClick:()=>r(!1),className:"block rounded-md px-2 py-1.5 text-sm text-zinc-200 hover:bg-zinc-800/80 hover:text-white transition",children:"Preferences"}),o.jsx(Ut,{to:"/account/watch-later",onClick:()=>r(!1),className:"block rounded-md px-2 py-1.5 text-sm text-zinc-200 hover:bg-zinc-800/80 hover:text-white transition",children:"Watch Later"}),o.jsx(Ut,{to:"/account/history",onClick:()=>r(!1),className:"block rounded-md px-2 py-1.5 text-sm text-zinc-200 hover:bg-zinc-800/80 hover:text-white transition",children:"History"}),o.jsx(Ut,{to:"/leaderboard",onClick:()=>r(!1),className:"block rounded-md px-2 py-1.5 text-sm text-zinc-200 hover:bg-zinc-800/80 hover:text-white transition",children:"Leaderboard"}),o.jsx(Ut,{to:"/quests",onClick:()=>r(!1),className:"block rounded-md px-2 py-1.5 text-sm text-orange-200 hover:bg-zinc-800/80 hover:text-orange-100 transition",children:"Daily & Season Quests"}),o.jsx(Ut,{to:"/unlocked",onClick:()=>r(!1),className:"block rounded-md px-2 py-1.5 text-sm text-zinc-200 hover:bg-zinc-800/80 hover:text-white transition",children:"Unlocked"}),!y&&g==="android"&&o.jsxs(Ut,{to:l7,onClick:()=>r(!1),className:"flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-emerald-200 hover:bg-zinc-800/80 hover:text-emerald-100 transition",children:[o.jsx(m1,{className:"h-4 w-4"}),"Download Android App"]}),!y&&g==="windows"&&o.jsxs(Ut,{to:c7,onClick:()=>r(!1),className:"flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-cyan-200 hover:bg-zinc-800/80 hover:text-cyan-100 transition",children:[o.jsx(Lp,{className:"h-4 w-4"}),"Install from Microsoft Store"]})]}),o.jsx("button",{type:"button",onClick:M,className:"mt-3 w-full rounded-md bg-zinc-800 px-3 py-2 text-sm font-semibold text-white hover:bg-zinc-700 transition",children:"Sign out"})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm font-semibold text-white",children:"Welcome to PyroPlay"}),o.jsx("p",{className:"mt-1 text-xs text-zinc-300",children:"Log in to sync your watch profile across devices."}),o.jsx("button",{type:"button",onClick:P,className:"mt-3 w-full rounded-md bg-[#E25E0C] px-3 py-2 text-sm font-semibold text-white hover:bg-[#f76c15] transition",children:"Log in / Register"})]})})]})]})]})})}function g7(n,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=n:r.appendChild(document.createTextNode(n))}}var x7=`.index-module_canvas__H2w7d { 58 position: absolute; 59 top: 0; 60 right: 0; 61 bottom: 0; 62 left: 0; 63 width: 100%; 64 height: 100%; 65 pointer-events: none; 66}`,b7={canvas:"index-module_canvas__H2w7d"};g7(x7);var Ss=function(n,e){return Math.random()*(e-n)+n},v7=function(n){var e=parseInt(n.slice(1,3),16),t=parseInt(n.slice(3,5),16),i=parseInt(n.slice(5,7),16);return{r:e,g:t,b:i}},y7=(function(){function n(e,t,i,r,l,u,h,d,p){i===void 0&&(i=0),l===void 0&&(l=["circle","square"]),u===void 0&&(u=12),h===void 0&&(h=30),d===void 0&&(d=1),p===void 0&&(p=.004),this.x=e*window.innerWidth,this.y=t*window.innerHeight,this.width=u,this.height=u,this.theta=Math.PI/180*Ss(i-h,i+h),this.radius=Ss(20*d,70*d),this.vx=this.radius*Math.cos(this.theta),this.vy=this.radius*Math.sin(this.theta),this.xFriction=.9,this.yFriction=.87,this.gravity=Ss(.5,.6),this.opacity=1,this.opacityDelta=p,this.rotate=Ss(0,360),this.widthDelta=Ss(0,360),this.heightDelta=Ss(0,360),this.rotateDelta=Ss(-1,
661),this.colors=r,this.color=v7(this.colors[Math.floor(Ss(0,this.colors.length))]),this.shapes=l,this.shape=this.shapes[Math.floor(Ss(0,this.shapes.length))],this.swingOffset=Ss(0,Math.PI*2),this.swingSpeed=Math.random()*.05+.01,this.swingAmplitude=Ss(.1,.2)}return n.prototype.update=function(){this.vx*=this.xFriction,this.vy*=this.yFriction,this.vy+=this.gravity,this.vx+=Math.sin(this.swingOffset)*this.swingAmplitude,this.x+=this.vx,this.y+=this.vy,this.opacity-=this.opacityDelta,this.widthDelta+=2,this.heightDelta+=2,this.rotate+=this.rotateDelta,this.swingOffset+=this.swingSpeed},n.prototype.drawSquare=function(e){e.fillRect(this.x,this.y,this.width*Math.cos(Math.PI/180*this.widthDelta),this.height*Math.sin(Math.PI/180*this.heightDelta))},n.prototype.drawCircle=function(e){e.beginPath(),e.ellipse(this.x,this.y,Math.abs(this.width*Math.cos(Math.PI/180*this.widthDelta))/2,Math.abs(this.height*Math.sin(Math.PI/180*this.heightDelta))/2,0,0,2*Math.PI),e.fill(),e.closePath()},n.prototype.draw=function(e){var t=this.width*1.3,i=this.height*1.3;e.translate(this.x+t,this.y+i),e.rotate(Math.PI/100*this.rotate),e.translate(-(this.x+t),-(this.y+i)),e.fillStyle="rgba(".concat(this.color.r,", ").concat(this.color.g,", ").concat(this.color.b,", ").concat(this.opacity,")"),this.shape==="square"&&this.drawSquare(e),this.shape==="circle"&&this.drawCircle(e),e.resetTransform()},n})(),_7=60,J3=1e3/_7;function w7(n){var e=n.mode,t=e===void 0?"boom":e,i=n.particleCount,r=i===void 0?30:i,l=n.shapeSize,u=l===void 0?12:l,h=n.colors,d=h===void 0?["#ff577f","#ff884b","#ffd384","#fff9b0"]:h,p=n.className,m=n.style,g=n.mode==="boom"||n.mode===void 0?n:{effectInterval:1,effectCount:1/0},b=g.x,y=b===void 0?.5:b,_=g.y,C=_===void 0?.5:_,w=g.deg,S=w===void 0?270:w,T=g.spreadDeg,N=T===void 0?30:T,j=g.effectInterval,O=j===void 0?3e3:j,R=g.effectCount,z=R===void 0?1:R,M=g.launchSpeed,P=M===void 0?1:M,G=g.opacityDeltaMultiplier,U=G===void 0?1:G,Y=(n.mode==="fall"?n:{}).fadeOutHeight,W=Y===void 0?.8:Y,J=E.useRef(null),F=E.useRef(),$=E.useRef([]),V=E.useRef(0),se=E.useRef(0),ue=E.useCallback(function(){var H=J.current,Z=H?.getContext("2d");if(!(!H||!Z)){F.current=Z;var Ee=window.innerWidth,je=window.innerHeight;H.width=Ee,H.height=je}},[]),Ce=E.useCallback(function(){for(var H=t==="fall",Z=H?r/30:r,Ee=H?Ss(0,1):y,je=H?Ss(-.1,-.3):C,le=H?270:S,Se=H?0:N,de=H?0:P,Me=H?3.4/W/window.innerHeight:.004*Math.max(.1,U),Le=0;Le<Z;Le+=1)$.current.push(new y7(Ee,je,le,d,["circle","square"],u,Se,de,Me))},[t,y,C,S,d,u,N,P,r,W,U]),D=E.useCallback(function(){if(F.current){var H,Z,Ee=Date.now(),je,le=Date.now()-O,Se=function(){var de=J.current;if(F.current&&de&&(V.current=requestAnimationFrame(Se),H=Date.now(),Z=H-Ee,je=H-le,!(Z<J3))){F.current.clearRect(0,0,de.width,de.height),je>O&&se.current<z&&(Ce(),le=H-je%O,se.current+=1);for(var Me=$.current,Le=Me.length-1;Le>=0;Le-=1){var pe=Me[Le];
66pe.update(),pe.draw(F.current);var Be=de?.height||0;(pe.opacity<=0||pe.y>Be)&&Me.splice(Me.indexOf(pe),1)}Ee=H-Z%J3,se.current>=z&&Me.length===0&&cancelAnimationFrame(V.current)}};V.current=requestAnimationFrame(Se)}},[O,z,Ce]);return E.useEffect(function(){return ue(),D(),function(){V.current&&cancelAnimationFrame(V.current)}},[ue,D]),E.useEffect(function(){se.current=0},[z]),li.createElement("canvas",{className:[b7.canvas,p].filter(Boolean).join(" "),ref:J,style:m})}const S7="https://watch-server-production-c01b.up.railway.app/api",E7=80;function hv(n){const[e,t]=n.split("-");return e!=="movie"&&e!=="tv"&&e!=="anime"||!t?null:{type:e,id:t}}async function Eo(){if(!Fe)return null;const{data:n}=await Fe.auth.getUser();return n.user?.id??null}async function C7(n){const e=hv(n);if(!e)return{};try{const t=e.type==="tv"?"tv":e.type==="anime"?"anime":"movies",i=await fetch(`${S7}/${t}/${e.id}`);if(!i.ok)return{};const r=await i.json(),l=r.title||r.name||r.original_title||n,u=r.poster_path||r.backdrop_path,h=r.backdrop_path||r.poster_path,d=u?`https://image.tmdb.org/t/p/w500${u}`:void 0,p=h?`https://image.tmdb.org/t/p/w780${h}`:void 0,m=d||p,g=(r.release_date||r.first_air_date||"").slice(0,4)||void 0;return{id:e.id,type:e.type,title:l,image:m,posterImage:d,backdropImage:p,year:g,watchParam:n}}catch{return{}}}async function N7(){if(!Fe)return[];const n=await Eo();if(!n)return[];const{data:e,error:t}=await Fe.from("watch_later").select("movie_id, created_at").eq("user_id",n).order("created_at",{ascending:!1});return t||!e?[]:(await Promise.all(e.map(async r=>{const l=String(r.movie_id||""),u=hv(l),h=await C7(l),d=u?`${u.type==="tv"?"TV":u.type==="anime"?"Anime":"Movie"} #${u.id}`:"Saved title";return{id:u?.id||l,type:u?.type||"movie",title:h.title||d,image:h.image,posterImage:h.posterImage,backdropImage:h.backdropImage,year:h.year,watchParam:l,addedAt:r.created_at||new Date().toISOString()}}))).filter(r=>!!r.watchParam)}async function T7(){if(!Fe)return[];const n=await Eo();if(!n)return[];const{data:e,error:t}=await Fe.from("movie_progrees").select("movie_id, created_at, data").eq("user_id",n).order("created_at",{ascending:!1}).limit(E7);return t||!e?[]:e.map(i=>{const r=String(i.movie_id||""),l=hv(r),u=i.data||{}
66,h=u.type||l?.type||"movie",d=l?.id||r;return{id:d,type:h,title:u.title||`${h==="tv"?"TV":h==="anime"?"Anime":"Movie"} #${d}`,image:u.image,posterImage:u.image,backdropImage:u.image,year:u.year,watchParam:u.watchParam||r,addedAt:i.created_at||new Date().toISOString()}}).filter(i=>!!i.watchParam)}async function M7(n){if(!Fe)throw new Error("AUTH_UNAVAILABLE");const e=await Eo();if(!e)throw new Error("AUTH_REQUIRED");const{data:t,error:i}=await Fe.from("watch_later").select("id").eq("user_id",e).eq("movie_id",n.watchParam).limit(1);if(i)throw i;if(t&&t.length>0)return;const{error:r}=await Fe.from("watch_later").insert({user_id:e,movie_id:n.watchParam});if(r)throw r}async function eS(n){if(!Fe)return;const e=await Eo();if(!e)return;const t={title:n.title,image:n.image,year:n.year,type:n.type,watchParam:n.watchParam},{data:i,error:r}=await Fe.from("movie_progrees").select("id").eq("user_id",e).eq("movie_id",n.watchParam).order("created_at",{ascending:!1}).limit(1);if(!r){if(i&&i.length>0){const{error:l}=await Fe.from("movie_progrees").update({data:t,created_at:new Date().toISOString()}).eq("id",i[0].id);return void 0}await Fe.from("movie_progrees").insert({user_id:e,movie_id:n.watchParam,data:t})}}async function A7(n){if(!Fe)return;const e=await Eo();e&&await Fe.from("watch_later").delete().eq("user_id",e).eq("movie_id",n)}async function R7(n){if(!Fe)return;const e=await Eo();e&&await Fe.from("movie_progrees").delete().eq("user_id",e).eq("movie_id",n)}async function k7(){if(!Fe)return;const n=await Eo();n&&await Fe.from("watch_later").delete().eq("user_id",n)}async function j7(){if(!Fe)return;const n=await Eo();n&&await Fe.from("movie_progrees").delete().eq("user_id",n)}const ix="https://watch-server-production-c01b.up.railway.app/api",tS=ix.endsWith("/api")?ix:`${ix}/api`;function L7(n){const e=Math.max(0,Math.floor(Number(n)||0));if(e===0)return"No watch time recorded yet";const t=Math.floor(e/3600),i=Math.floor(e%3600/60);return t>0?`${t}h ${i}m watched`:`${Math.max(1,i)}m watched`}function P7(n){const e=new Date(n).getTime();if(!Number.isFinite(e))return"Recently";const t=Math.max(0,Math.floor((Date.now()-e)/1e3));return t<60?"Just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:t<604800?`${Math.floor(t/86400)}d ago`:`${Math.floor(t/604800)}w ago`}function O7(n){const e=String(n||"").trim();return e?e.charAt(0).toUpperCase():"U"}function nS({stars:n,interactive:e=!1,onSelect:t}){return o.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:[0,1,2,3,4,5].map(i=>{const r=i>0&&i<=n;return o.jsx("button",{type:"button",onClick:()=>t?.(i),disabled:!e,className:`inline-flex items-center gap-1 rounded-full border px-2.5 py-1 text-xs font-semibold transition ${e?"cursor-pointer":"cursor-default"} ${i===n?"border-orange-400/60 bg-orange-500/15 text-orange-100":"border-white/10 bg-black/25 text-zinc-300"}`,children:i===0?o.jsx("span",{children:"0"}):o.jsx(dl,{className:`h-3.5 w-3.5 ${r?"fill-orange-400 text-orange-400":"text-zinc-500"}`})},i)})})}function D7({watchParam:n,contentType:e}){const[t,i]=E.useState([]),[r,l]=E.useState(!1),[u,h]=E.useState(null),[d,p]=E.useState(null),[m,g]=E.useState(""),[b,y]=E.useState(0),[_,C]=E.useState(!1),[w,S]=E.useState(!1),T=async()=>{if(!n){i([]);return}l(!0),h(null);try{const O=await fetch(`${tS}/reviews/${encodeURIComponent(n)}`),R=await O.json().catch(()=>({}));if(!O.ok)throw new Error(R.error||"Failed to load reviews");i(Array.isArray(R.reviews)?R.reviews:[])}catch(O){h(O instanceof Error?O.message:"Failed to load reviews"),i([])}finally{l(!1)}};E.useEffect(()=>{Fe?.auth.getSession().then(({data:R})=>{S(!!R.session?.access_token)});const{data:O}=Fe?.auth.onAuthStateChange((R,z)=>{S(!!z?.access_token)})||{data:{subscription:null}};return()=>{O?.subscription?.unsubscribe()}},[]),E.useEffect(()=>{g(""),y(0),p(null),T()},[n]);const N=E.useMemo(()=>{if(t.length===0)return{total:0,average:0};const O=t.length,R=Number((t.reduce((z,M)=>z+Number(M.stars||0),0)/O).toFixed(1));return{total:O,average:R}},[t]),j=async()=>{if(!(!n||!e)){C(!0),h(null),p(null);try{const{data:{session:O}}=await Fe.auth.getSession(),R=O?.access_token;if(!R)throw new Error("Please log in first to leave a review.");const z=await fetch(`${tS}/reviews/${encodeURIComponent(n)}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${R}`},body:JSON.stringify({stars:b,comment:m,contentType:e})}),M=await z.json().catch(()=>({}));if(!z.ok)throw new Error(M.error||"Failed to save review");p(M.message||"Review saved."),await T()}catch(O){h(O instanceof Error?O.message:"Failed to save review")}finally{C(!1)}}};return o.jsx("section",{className:"p-4 md:p-8 pt-0",children:o.jsxs("div",{className:"rounded-2xl border border-white/10 bg-zinc-950/60 p-4 md:p-5",children:[o.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2 text-white",children:[o.jsx(GR,{className:"h-5 w-5 text-orange-400"}),o.jsx("h3",{className:"text-xl md:text-2xl font-bold",children:"Reviews"})]}),o.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Users can rate this title from 0 to 5 stars and share what they thought."})]}),o.jsxs("div",{className:"flex gap-3",children:[o.jsxs("div",{className:"rounded-xl border border-white/10 bg-black/25 px-4 py-3 text-center",children:[o.jsx("p",{className:"text-[11px] uppercase tracking-[0.18em] text-zinc-500",children:"Average"}),o.jsxs("p",{className:"mt-1 text-lg font-semibold text-white",children:[N.average.toFixed(1),"/5"]})]}),o.jsxs("div",{className:"rounded-xl border border-white/10 bg-black/25 px-4 py-3 text-center",children:[o.jsx("p",{className:"text-[11px] uppercase tracking-[0.18em] text-zinc-500",children:"Reviews"}),o.jsx("p",{className:"mt-1 text-lg font-semibold text-white",children:N.total})]})]})]}),o.jsxs("div",{className:"mt-5 rounded-2xl border border-white/10 bg-black/25 p-4",children:[o.jsx("h4",{className:"text-sm font-semibold text-white",children:"Leave a review"}),o.jsx("p",{className:"mt-1 text-xs text-zinc-400",children:"Your review will show your saved watch time for this title."}),o.jsxs("div",{className:"mt-3 space-y-3",children:[o.jsx(nS,{stars:b,interactive:!0,onSelect:y}),o.jsx("textarea",{value:m,onChange:O=>g(O.target.value.slice(0,2e3)),rows:4,placeholder:w?"Write your review here...":"Log in to leave a review...",disabled:!w||_,className:"w-full rounded-xl border border-white/10 bg-zinc-900/80 px-3 py-2 text-sm text-white outline-none transition focus:border-orange-400/50 disabled:opacity-60"}),o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[o.jsxs("span",{className:"text-xs text-zinc-500",children:[m.length,"/2000"]}),o.jsx("button",{type:"button",onClick:()=>{j()},disabled:!w||_||!m.trim(),className:"rounded-full bg-orange-500 px-4 py-2 text-sm font-semibold text-black transition hover:bg-orange-400 disabled:cursor-not-allowed disabled:opacity-50",children:_?"Saving...":"Post review"})]})]}),!w&&o.jsx("p",{className:"mt-3 text-xs text-amber-300",children:"Log in to leave your own review."}),d&&o.jsx("p",{className:"mt-3 text-xs text-emerald-300",children:d}),u&&o.jsx("p",{className:"mt-3 text-xs text-red-400",children:u})]}),o.jsx("div",{className:"mt-5 space-y-3",children:r?o.jsx("div",{className:"rounded-xl border border-white/10 bg-black/20 px-4 py-6 text-sm text-zinc-300",children:"Loading reviews..."}):t.length===0?o.jsx("div",{className:"rounded-xl border border-dashed border-white/10 bg-black/20 px-4 py-6 text-sm text-zinc-400",children:"No reviews yet. Be the first to leave one."}):t.map(O=>o.jsx("article",{className:"rounded-xl border border-white/10 bg-black/20 p-4",children:o.jsxs("div",{className:"flex items-start gap-3",children:[O.avatar_url?o.jsx("img",{src:O.avatar_url,alt:O.display_name||"Reviewer",className:"h-10 w-10 rounded-full object-cover"}):o.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-orange-500/20 text-sm font-bold text-orange-200",children:O7(O.display_name)}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-semibold text-white",children:O.display_name||O.username||"Viewer"}),o.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-xs text-zinc-400",children:[o.jsx("span",{children:P7(O.updated_at||O.created_at)}),o.jsx("span",{children:"â¢"}),o.jsx("span",{children:L7(O.watched_seconds)})]})]}),o.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-orange-200",children:[o.jsx(nS,{stars:Number(O.stars||0)}),o.jsxs("span",{children:[Number(O.stars||0),"/5"]})]})]}),o.jsx("p",{className:"mt-3 whitespace-pre-wrap text-sm leading-relaxed text-zinc-200",children:O.comment})]})]})},O.id))})]})})}
66const sx="https://watch-server-production-c01b.up.railway.app/api",sc="$PYRO",U7="PyroPlay",I7=.5,iS="watchpump:last-row-context",rx=!1;function z7({onPlay:n,onUnlockSeen:e,isPlayerOpen:t=!1}){const[i,r]=Ki(),l=E.useRef(null),u=E.useRef(null),h=i.get("watch"),d=E.useMemo(()=>{if(!h)return null;const[ae,Ve]=h.split("-");return!ae||!Ve||ae!=="movie"&&ae!=="tv"?null:{type:ae,id:Ve}},[h]),p=d?.type,m=d?.id,g=d?`${d.type}-${d.id}`:null,b=Number.parseInt(i.get("season")||"",10),y=Number.parseInt(i.get("episode")||"",10),_=Number.isFinite(b)&&b>0?b:null,C=Number.isFinite(y)&&y>0?y:null,w=i.get("free")==="1",[S,T]=E.useState(null),[N,j]=E.useState(!1),[O,R]=E.useState([]),[z,M]=E.useState(!1),[P,G]=E.useState(null),[U,Y]=E.useState(!1),[W,J]=E.useState(null),[F,$]=E.useState(!1),[V,se]=E.useState(null),[ue,Ce]=E.useState(!1),[D,H]=E.useState(!1),[Z,Ee]=E.useState(!1),[je,le]=E.useState(!1),[Se,de]=E.useState(!1),[Me,Le]=E.useState(!1),[pe,Be]=E.useState(!1),[We,dt]=E.useState(!1),[Ct,ut]=E.useState(null),[kt,K]=E.useState(!1),[Nt,Tt]=E.useState(null),[Mt,nt]=E.useState(!1),[I,k]=E.useState(null),[Q,fe]=E.useState(!1),[be,xe]=E.useState(null),[Xe,$e]=E.useState(!0),[it,ht]=E.useState(!0),[X,oe]=E.useState(!1),[ke,Ae]=E.useState(null),De=E.useRef(!1),st=E.useRef(!1),te=E.useRef(!1);E.useEffect(()=>{De.current=!1},[g]),E.useEffect(()=>{if(!m||!p){T(null);return}(async()=>{j(!0);try{const Ve=`${sx}/${p==="movie"?"movies":"tv"}/${m}?append=credits,images&similar=true`,ct=await fetch(Ve);if(!ct.ok)throw new Error("Failed to fetch details");const Dt=await ct.json();if(T(Dt),p==="tv"&&Dt.seasons?.length){const At=Dt.seasons.find(an=>an.season_number>0)?.season_number||1,mn=Dt.seasons.filter(an=>an.season_number>0).map(an=>an.season_number),ot=_&&mn.includes(_)?_:At;G(ot)}}catch(Ve){console.error("Error fetching movie details:",Ve),T(null)}finally{j(!1)}})()},[m,p,_]),E.useEffect(()=>{if(!g){Ae(null);return}const ae=new AbortController;return(async()=>{try{Ae(null);const ct=await _5(sx,g,ae.signal);Ae(ct)}catch(ct){if(ae.signal.aborted)return;console.error("Error fetching media visitor count:",ct),Ae(null)}})(),()=>ae.abort()},[g]),E.useEffect(()=>{if(!m||p!=="tv"||!P)return;(async()=>{M(!0);try{const Ve=await fetch(`${sx}/tv/${m}/season/${P}`);if(!Ve.ok)throw new Error("Failed to fetch episodes");const ct=await Ve.json();R(ct.episodes||[])}catch(Ve){console.error("Error fetching episodes:",Ve),R([])}finally{M(!1)}})()},[m,p,P]),E.useEffect(()=>{{J(null),$(!1),se(null);return}},[m,p,S?.title,S?.name,S?.original_title]),E.useEffect(()=>{if(!p)return;const ae=!!W?.is_paid,Ve=te.current;if(ae&&!Ve&&(de(!0),setTimeout(()=>de(!1),6e3),le(!0),Le(!0),setTimeout(()=>Le(!1),4e3)),te.current=ae,!!ae&&p==="movie"){if(st.current)return;const ct=Number(m);if(!Number.isFinite(ct))return;st.current=!0,e?.(ct)}},[W?.is_paid,e,m,p]),E.useEffect(()=>{},[m,p]),E.useEffect(()=>{st.current=!1,te.current=!!W?.is_paid,de(!1),le(!1),Le(!1),K(!1),Tt(null),nt(!1),k(null),fe(!1)},[m]),E.useEffect(()=>{if(!g||!Fe){dt(!1),ut(null);return}const ae=Fe;let Ve=!0;return(async()=>{try{const{data:{session:Dt}}=await ae.auth.getSession();if(!Ve)return;if(!Dt?.access_token){dt(!1),ut(null);return}dt(!0),ut(null)}catch{if(!Ve)return;dt(!1),ut(null)}})(),()=>{Ve=!1}},[g]),E.useEffect(()=>{if(!Fe||!m||!p)return;const ae=Fe;let Ve=!0;return(async()=>{const Dt=`${p}-${m}`,{data:{user:At}}=await ae.auth.getUser();if(!Ve)return;if(!At){nt(!1),fe(!1);return}const[{data:mn},{data:ot}]=await Promise.all([ae.from("watch_later").select("id").eq("user_id",At.id).eq("movie_id",Dt).limit(1),ae.from("movie_progrees").select("id").eq("user_id",At.id).eq("movie_id",Dt).limit(1)]);Ve&&(nt(!!(mn&&mn.length>0)),fe(!!(ot&&ot.length>0)))})(),()=>{Ve=!1}},[m,p]);const Ie=()=>{U||u.current||(Y(!0),u.current=setTimeout(()=>{const ae=new URLSearchParams(i);ae.delete("watch"),ae.delete("season"),ae.delete("episode"),r(ae),u.current=null},180))};E.useEffect(()=>{g&&(u.current&&(clearTimeout(u.current),u.current=null),Y(!1))},[g]),E.useEffect(()=>()=>{u.current&&(clearTimeout(u.current),u.current=null)},[]),E.useEffect(()=>{if(g)return document.body.style.overflow="hidden",()=>{document.body.style.overflow="unset"}},[g]),E.useEffect(()=>{const ae=window.matchMedia("(max-width: 768px)"),Ve=()=>{Be(ae.matches)};return Ve(),ae.addEventListener("change",Ve),()=>ae.removeEventListener("change",Ve)},[]),E.useEffect(()=>{if(!g||!S)return;const ae=S.title||S.name||S.original_title||"Watching";document.title=`${ae} | ${U7}`},[g,S]),E.useEffect(()=>{if(!g){xe(null);return}try{const ae=sessionStorage.getItem(iS);if(!ae){xe(null);return}const Ve=JSON.parse(ae);if(!Array.isArray(Ve?.items)||Ve.items.length===0){xe(null);return}if(!Ve.items.includes(g)){xe(null);return}xe(Ve)}catch{xe(null)}},[g]),E.useEffect(()=>{$e(!0),ht(!0),oe(!1)},[S?.trailer_url]),E.useEffect(()=>{if(t||!g||!S?.trailer_url)return;const ae=l.current;ae?.contentWindow&&ae.contentWindow.postMessage(JSON.stringify({event:"command",func:"playVideo",args:[]}),"*"),ht(!0)},[t,g,S?.trailer_url]);const Pe=be&&g?be.items.findIndex(ae=>ae===g):-1,Ze=Pe>0,ze=Pe>=0&&be?Pe<be.items.length-1:!1,ge=ae=>{if(!be||Pe<0)return;const Ve=ae==="prev"?Pe-1:Pe+1,ct=be.items[Ve];if(!ct)return;const Dt=new URLSearchParams(i);Dt.set("watch",ct),r(Dt);
66try{sessionStorage.setItem(iS,JSON.stringify({...be,currentWatch:ct,updatedAt:Date.now()}))}catch{}};if(E.useEffect(()=>{i.has("server")},[g,i,r,N,F,S,w,p,W]),E.useEffect(()=>{!N&&!F&&S&&(De.current||i.has("server")&&(De.current=!0,et()))},[N,F,S,W,w,p,i,g]),!g||!p||!m)return null;if(N||!S)return o.jsx("div",{className:"fixed inset-0 z-[110] flex items-center justify-center bg-black/80 animate-fade-in",children:o.jsx("div",{className:"w-12 h-12 border-4 border-[#E25E0C] border-t-transparent rounded-full animate-spin"})});function Ye({options:ae,value:Ve,onChange:ct}){const[Dt,At]=E.useState(!1),mn=E.useRef(null);E.useEffect(()=>{function an(It){mn.current&&!mn.current.contains(It.target)&&At(!1)}return Dt?document.addEventListener("mousedown",an):document.removeEventListener("mousedown",an),()=>document.removeEventListener("mousedown",an)},[Dt]);const ot=ae.find(an=>an.value===Ve);return o.jsxs("div",{ref:mn,className:"relative w-full sm:w-56",children:[o.jsxs("button",{type:"button",className:"bg-zinc-800 text-white border border-zinc-700 rounded px-4 py-2 outline-none focus:border-white transition w-full flex justify-between items-center",onClick:()=>At(an=>!an),children:[o.jsx("span",{className:"text-sm",children:ot?.label}),o.jsx("svg",{className:`w-4 h-4 ml-2 transition-transform ${Dt?"rotate-180":""}`,fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),Dt&&o.jsx("div",{className:"absolute left-0 mt-1 w-full bg-zinc-800 border border-zinc-700 rounded shadow-lg z-20 max-h-60 overflow-y-auto",children:ae.map(an=>o.jsx("div",{className:`px-4 py-2 cursor-pointer hover:bg-zinc-700 ${an.value===Ve?"bg-zinc-700 text-white":"text-zinc-200"}`,onClick:()=>{ct(an.value),At(!1)},children:an.label},an.value))})]})}const pt=ae=>ae?`https://image.tmdb.org/t/p/original${ae}`:"https://via.placeholder.com/1920x1080?text=No+Image",Wt=ae=>ae?`https://image.tmdb.org/t/p/w500${ae}`:"https://via.placeholder.com/500x281?text=No+Image",ce=(S.release_date||S.first_air_date||"").substring(0,4),Ge=S.runtime||S.episode_run_time&&S.episode_run_time[0]||0,vt=Math.floor(Ge/60),rn=Ge%60,On=vt>0?`${vt}h ${rn}m`:`${rn}m`,Dn=W?.required_tokens??(p==="tv"?1e4:5e3),Qn=Number((Dn*I7).toFixed(6)),bi=W?.token_balance??0,qn=Math.max(0,Dn-bi),cs=Math.min(100,Math.round(bi/Dn*100)),Jn=rx,xn=W?.wallet_address?`https://api.qrserver.com/v1/create-qr-code/?size=220x220&data=${encodeURIComponent(W.wallet_address)}`:null,Si=pe&&rx,Fi=typeof Ct=="number"&&Ct>=Qn,Li=W?.unlocked_by||null,vi=Li&&(Li.user_id||Li.username||Li.display_name||Li.avatar_url)?Li:null,Ks=vi?.username?`@${vi.username}`:vi?.display_name||"A Pyro user",we=Yc({avatarUrl:vi?.avatar_url,username:vi?.username,displayName:vi?.display_name,userId:vi?.user_id,fallbackSeed:"unlocker"}),He=S.seasons?.filter(ae=>ae.season_number>0).length||0,rt=S.seasons?.filter(ae=>ae.season_number>0).reduce((ae,Ve)=>ae+Ve.episode_count,0)||0,Ke=S.images?.logos?.find(ae=>ae.iso_639_1==="en")||S.images?.logos?.[0],lt=Ke?`https://image.tmdb.org/t/p/original${Ke.file_path}`:null,L=S.trailer_url?S.trailer_url:null,q=ke!==null?Up(ke):null,ne=()=>{const ae=l.current;ae?.contentWindow&&(ae.contentWindow.postMessage(JSON.stringify({event:"command",func:"unMute",args:[]}),"*"),$e(!1))},re=()=>{const ae=l.current;ae?.contentWindow&&ae.contentWindow.postMessage(JSON.stringify({event:"command",func:"pauseVideo",args:[]}),"*"),ht(!1)},me=()=>{const ae=l.current;ae?.contentWindow&&(ae.contentWindow.postMessage(JSON.stringify({event:"command",func:"playVideo",args:[]}),"*"),ht(!0))},Je=()=>{if(it){re();return}me()},qe=()=>{const ae=String(vi?.user_id||"").trim();if(!ae)return;const Ve=new URLSearchParams(i);Ve.set("profile",ae),r(Ve)},Qe=ae=>{const Ve=String(ae||"").trim();if(!Ve)return;re(),u.current&&(clearTimeout(u.current),u.current=null);const ct=new URLSearchParams(i);ct.delete("watch"),ct.delete("season"),ct.delete("episode"),ct.delete("server"),ct.set("search","true"),ct.set("mode","normal"),ct.set("q",`person:${Ve}`),r(ct)},et=ae=>{if(!m||!p)return;re();const Ve=i.get("server");let ct;if(Ve){const At=Ve.toLowerCase().replace(/\s+/g,"");At==="server1"?ct="vidfast":At==="server2"?ct="videasy":At==="noads1"?ct="noads":At==="noads2"&&(ct="noads2")}const Dt={type:p,id:m,title:S.title||S.name||S.original_title,isFree:w,provider:ct};if(p==="tv"){const At=ae?.season||_||P||1,mn=ae?.episode||C||1;
66n({...Dt,season:At,episode:mn,image:pt(S.backdrop_path)})}else n({...Dt,image:pt(S.backdrop_path)})},mt=async()=>{},Ot=async()=>{if(W?.wallet_address)try{navigator?.clipboard?.writeText&&await navigator.clipboard.writeText(W.wallet_address),H(!0),setTimeout(()=>H(!1),1200)}catch(ae){console.error("Unable to copy wallet address:",ae),H(!1)}},$t=async()=>{if(!m||!p||!S)return;k(null);const ae=S.title||S.name||S.original_title||"Untitled",Ve=(S.release_date||S.first_air_date||"").slice(0,4),ct=S.backdrop_path?`https://image.tmdb.org/t/p/w780${S.backdrop_path}`:void 0;try{await M7({id:String(m),type:p,title:ae,image:ct,watchParam:`${p}-${m}`,year:Ve||void 0}),nt(!0)}catch(Dt){const At=Dt instanceof Error?Dt.message:"Unable to save to Watch Later right now.";k(At==="AUTH_REQUIRED"||At==="AUTH_UNAVAILABLE"?"Please log in first to save Watch Later.":"Unable to save to Watch Later right now.")}};return W?.wallet_address,`${cs}`,We&&(o.Fragment,typeof Ct=="number"&&`${Ct}${sc}`,!Fi&&typeof Ct=="number"&&Math.max(0,Number((Qn-Ct).toFixed(6)))),o.jsxs("div",{className:`fixed inset-0 z-[110] flex justify-center overflow-y-auto bg-black/70 backdrop-blur-sm p-2 sm:p-4 md:p-8 ${U?"animate-fade-out":"animate-fade-in"}`,onClick:Ie,children:[Me&&o.jsx("div",{className:"pointer-events-none absolute inset-0 z-[1] overflow-hidden",children:o.jsx(w
667,{mode:"boom",shapeSize:13,particleCount:280,deg:270,y:.7,spreadDeg:69,launchSpeed:2.2,colors:["#f87171","#34d399","#60a5fa","#fbbf24","#a78bfa"]})}),o.jsxs("div",{className:`relative z-[2] w-full max-w-4xl bg-zinc-900 rounded-xl overflow-hidden shadow-2xl mt-6 md:mt-10 mb-auto ${U?"animate-slide-down":"animate-slide-up"}`,onClick:ae=>ae.stopPropagation(),children:[o.jsx("button",{onClick:Ie,className:"absolute top-3 z-50 right-3 md:top-4 md:right-4 z-10 p-1.5 md:p-2 bg-zinc-900/50 hover:bg-zinc-900 rounded-full text-white transition",children:o.jsx(Ar,{className:"w-5 h-5 md:w-6 md:h-6"})}),o.jsxs("div",{className:"relative w-full aspect-[4/3] sm:aspect-video",children:[Ze&&o.jsx("button",{type:"button",onClick:ae=>{ae.stopPropagation(),ge("prev")},className:"absolute left-0 top-1/2 z-30 inline-flex -translate-y-1/2 rounded-r-lg border border-l-0 border-white/25 bg-black/55 px-2 py-3 text-white transition hover:bg-black/80 cursor-pointer pointer-events-auto","aria-label":"Previous title",title:"Previous title",children:o.jsx(nm,{className:"h-5 w-5"})}),ze&&o.jsx("button",{type:"button",onClick:ae=>{ae.stopPropagation(),ge("next")},className:"absolute right-0 top-1/2 z-30 inline-flex -translate-y-1/2 rounded-l-lg border border-r-0 border-white/25 bg-black/55 px-2 py-3 text-white transition hover:bg-black/80 cursor-pointer pointer-events-auto","aria-label":"Next title",title:"Next title",children:o.jsx(im,{className:"h-5 w-5"})}),o.jsxs("div",{className:"w-full h-full relative",children:[o.jsx("img",{src:pt(S.backdrop_path),alt:S.title||S.name||S.original_title,className:`w-full h-full object-cover transition-opacity duration-300 ${L&&X?"opacity-0":"opacity-100"}`}),L&&o.jsxs(o.Fragment,{children:[o.jsx("iframe",{ref:l,width:"100%",height:"100%",src:`${L}?autoplay=1&mute=1&enablejsapi=1&fs=0&playsinline=1&controls=0&rel=0&modestbranding=1`,title:S.title,onLoad:()=>oe(!0),className:`pointer-events-none absolute inset-0 w-full h-full object-cover transition-opacity duration-300 ${X?"opacity-100":"opacity-0"}`,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",referrerPolicy:"strict-origin-when-cross-origin",allowFullScreen:!0}),o.jsx("button",{type:"button",onClick:Je,className:`absolute inset-0 z-10 h-full w-full bg-transparent pointer-events-auto ${X?"cursor-pointer":"cursor-default"}`,"aria-label":it?"Pause trailer":"Play trailer"}),X&&Xe&&o.jsx("button",{type:"button",onClick:ne,className:"absolute left-1/2 bottom-1/2 z-20 -translate-x-1/2 -translate-y-1/2 rounded-full border border-white/25 bg-black/65 px-4 py-2 text-sm font-semibold text-white transition hover:bg-black/85",children:"Unmute Trailer"})]})]}),o.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-zinc-900 via-zinc-900/20 to-transparent"}),o.jsx("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-end",children:o.jsxs("div",{className:"pointer-events-auto w-full flex flex-col lg:flex-row lg:items-end lg:justify-between gap-3 md:gap-4 lg:gap-8 p-4 md:p-8",children:[o.jsxs("div",{className:"flex-1 min-w-0 max-w-3xl flex flex-col gap-4",children:[lt?o.jsx("img",{src:lt,alt:S.title||S.name||S.original_title,className:"relative z-10 w-auto max-w-[220px] sm:max-w-[280px] md:max-w-[420px] max-h-[90px] sm:max-h-[120px] md:max-h-[160px] object-contain drop-shadow-lg"}):o.jsx("h2",{className:"text-2xl sm:text-3xl md:text-6xl font-bold text-white drop-shadow-lg leading-tight",children:S.title||S.name||S.original_title}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 md:gap-3 w-full max-w-xl z-50",children:[o.jsxs("button",{className:"flex items-center gap-2 px-5 md:px-8 py-2 rounded font-bold text-sm md:text-base transition bg-white text-black hover:bg-zinc-200 cursor-pointer",onClick:()=>et(),disabled:Jn,children:[o.jsx(Ts,{className:"w-5 h-5 md:w-6 md:h-6 fill-black"}),"Play"]}),o.jsxs("button",{type:"button",onClick:()=>{$t()},disabled:Mt,className:"flex cursor-pointer items-center gap-2 rounded border border-white/25 bg-black/45 px-4 py-2 text-sm font-semibold text-white hover:bg-black/60 hover:border-white/50 transition disabled:cursor-not-allowed",children:[Mt?o.jsx(zr,{className:"h-4 w-4"}):o.jsx(Od,{className:"h-4 w-4"}),Mt?"Saved":"Watch Later"]}),I&&o.jsx("p",{className:"text-xs text-amber-300",children:I}),Q&&o.jsxs("p",{className:"inline-flex items-center gap-1 text-xs text-emerald-300",children:[o.jsx(lv,{className:"h-3.5 w-3.5"}),"You have watch progress for this title."]}),q!==null&&o.jsxs("p",{className:"inline-flex items-center gap-1.5 rounded-full border border-white/15 bg-black/45 px-3 py-1.5 text-xs text-zinc-100",title:"Views in the last 24 hours",children:[o.jsx(t5,{className:"h-3.5 w-3.5 text-zinc-300"}),q," views",o.jsx("span",{className:"text-zinc-400",children:"Last 24h"})]}),W?.is_paid&&vi&&o.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-emerald-400/30 bg-emerald-500/10 px-3 py-1.5 text-xs text-emerald-200",children:[o.jsx("img",{src:we,alt:"",className:"h-5 w-5 rounded-full object-cover"}),o.jsx("button",{type:"button",onClick:qe,className:"text-left",children:o.jsxs("span",{children:["Unlocked by ",o.jsx("span",{className:"font-semibold text-emerald-100 underline decoration-emerald-300/50 underline-offset-2",children:Ks})]})})]})]})]}),rx]})})]}),Si,o.jsxs("div",{className:"p-4 md:p-8 grid grid-cols-1 md:grid-cols-3 gap-6 md:gap-8",children:[o.jsxs("div",{className:"md:col-span-2 space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-2 md:gap-3 text-xs md:text-sm font-semibold text-zinc-300 flex-wrap",children:[o.jsx("span",{children:ce}),p==="tv"?o.jsxs("span",{children:[He," ",He===1?"Season":"Seasons"," (",rt," Episodes)"]}
66):o.jsx("span",{children:On}),o.jsx("span",{className:"border border-zinc-600 px-1 rounded text-xs",children:"HD"})]}),o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"border border-zinc-600 px-1 rounded text-xs text-white",children:"16+"}),o.jsx("span",{className:"text-zinc-400",children:"violence, language"})]}),o.jsx("p",{className:"text-base md:text-lg text-zinc-200 leading-relaxed",children:S.overview})]}),o.jsxs("div",{className:"space-y-4 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-zinc-500",children:"Cast: "}),o.jsxs("span",{className:"text-zinc-300",children:[S.credits?.cast?.slice(0,3).map((ae,Ve,ct)=>o.jsxs("span",{children:[o.jsx("button",{type:"button",onClick:()=>Qe(ae.name),className:"cursor-pointer underline decoration-zinc-500 underline-offset-2 transition hover:text-white hover:decoration-white",children:ae.name}),Ve<ct.length-1?", ":""]},ae.id||`${ae.name}-${Ve}`)),S.credits?.cast&&S.credits.cast.length>3&&o.jsx("span",{className:"italic",children:", more"})]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-zinc-500",children:"Genres: "}),o.jsx("span",{className:"text-zinc-300",children:S.genres?.map(ae=>ae.name).join(", ")})]})]})]}),o.jsx(D7,{watchParam:g,contentType:p}),p==="tv"&&S.seasons&&S.seasons.length>0&&o.jsxs("div",{className:"p-4 md:p-8 pt-0",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3 mb-6 flex-wrap",children:[o.jsx("h3",{className:"text-xl md:text-2xl font-bold text-white",children:"Episodes"}),o.jsx(Ye,{options:S.seasons.filter(ae=>ae.season_number>0).map(ae=>({value:ae.season_number,label:`${ae.name} (${ae.episode_count} Episodes)`})),value:P||1,onChange:G})]}),z?o.jsx("div",{className:"flex justify-center py-8",children:o.jsx("div",{className:"w-8 h-8 border-4 border-[#E25E0C] border-t-transparent rounded-full animate-spin"})}):o.jsx("div",{className:"space-y-4",children:O.map(ae=>o.jsxs("div",{className:"flex flex-col md:flex-row gap-4 p-4 rounded-lg hover:bg-zinc-800/50 transition cursor-pointer group",onClick:()=>et({season:P||1,episode:ae.episode_number}),children:[o.jsx("div",{className:"text-2xl font-bold text-zinc-500 w-8 flex-shrink-0 flex items-center justify-center",children:ae.episode_number}),o.jsxs("div",{className:"relative w-full md:w-40 aspect-video flex-shrink-0 rounded overflow-hidden bg-zinc-800",children:[o.jsx("img",{src:Wt(ae.still_path),alt:ae.name,className:"w-full h-full object-cover"}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 bg-black/40 transition duration-300",children:o.jsx(Ts,{className:"w-8 h-8 text-white fill-white drop-shadow-lg"})})]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsx("h4",{className:"font-bold text-white text-base truncate pr-4",children:ae.name}),ae.runtime&&o.jsxs("span",{className:"text-zinc-400 text-sm flex-shrink-0",children:[ae.runtime,"m"]})]}),o.jsx("p",{className:"text-zinc-400 text-sm line-clamp-3",children:ae.overview||"No description available."})]})]},ae.id))})]}),S.similar?.results&&S.similar.results.length>0&&o.jsxs("div",{className:"p-4 md:p-8 pt-0 mt-6",children:[o.jsx("h3",{className:"text-xl md:text-2xl font-bold text-white mb-6",children:"More Like This"}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:S.similar.results.slice(0,9).map(ae=>{const Ve=(ae.release_date||ae.first_air_date||"").substring(0,4);return o.jsxs("div",{className:"bg-zinc-800/80 rounded-lg overflow-hidden cursor-pointer group transition duration-300 hover:bg-zinc-700/80",onClick:()=>{const ct=new URLSearchParams(i);ct.set("watch",`${p==="tv"?"tv":"movie"}-${ae.id}`),r(ct)},children:[o.jsxs("div",{className:"relative aspect-video bg-zinc-900 border-b border-zinc-700/50",children:[o.jsx("img",{src:Wt(ae.backdrop_path||ae.poster_path),alt:ae.title||ae.name||ae.original_title,className:"w-full h-full object-cover"}),o.jsx("div",{className:"absolute top-2 right-2 px-2 py-1 bg-black/70 backdrop-blur-sm rounded text-white text-xs font-bold drop-shadow-md",children:Ve}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 bg-black/40 transition duration-300",children:o.jsx("div",{className:"w-12 h-12 border-2 border-white rounded-full flex items-center justify-center bg-black/50 hover:bg-white hover:text-black transition zoom-in",children:o.jsx(Ts,{className:"w-5 h-5 ml-1 fill-current"})})})]}),o.jsxs("div",{className:"p-4 flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-start justify-between mb-2",children:[o.jsxs("div",{className:"flex flex-col gap-1.5 w-full pr-2",children:[o.jsx("h4",{className:"font-bold text-white text-base truncate w-full",children:ae.title||ae.name||ae.original_title}),o.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[o.jsx("span",{className:"border border-zinc-500 px-1 py-0.5 text-zinc-300 rounded font-medium",children:ae.adult?"18+":"14+"}),o.jsx("span",{className:"text-zinc-400",children:p==="tv"?"Series":"Movie"})]})]}),o.jsx("button",{className:"p-1.5 border-2 border-zinc-500/70 rounded-full text-white hover:border-white hover:bg-white/10 transition-colors flex-shrink-0",onClick:ct=>{ct.stopPropagation()},children:o.jsx(Od,{className:"w-4 h-4"})})]}),o.jsx("p",{className:"text-zinc-300 text-sm line-clamp-4 mt-2 leading-relaxed h-[80px]",children:ae.overview||"No overview available for this title."})]})]},ae.id)})})]})]})]})}
66const sS="https://watch-server-production-c01b.up.railway.app/api",$7="PyroPlay",Mf=n=>n.title?.english||n.title?.romaji||n.title?.native||n.title?.userPreferred||`Anime #${n.id}`,F7=n=>n.title?.english||n.title?.romaji||n.title?.native||n.title?.userPreferred||`Anime #${n.id}`,rS=n=>n.bannerImage||n.coverImage?.extraLarge||n.coverImage?.large||n.coverImage?.medium||"",Af=n=>n.format==="MOVIE"||typeof n.episodes=="number"&&n.episodes<=1,B7=n=>{if(!n)return"No description available.";const e=n.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();return e||"No description available."};function H7({onPlay:n}){const[e,t]=Ki(),i=E.useRef(null),r=E.useRef(null),l=E.useRef(!1),u=e.get("watch"),h=E.useMemo(()=>{const de=e.get("episode"),Me=Number.parseInt(de||"",10);return Number.isFinite(Me)&&Me>0?Me:null},[e]),d=E.useMemo(()=>{if(!u)return null;const[de,Me]=u.split("-");if(de!=="anime"||!Me)return null;const Le=Number(Me);return Number.isFinite(Le)?Le:null},[u]),[p,m]=E.useState(null),[g,b]=E.useState(!1),[y,_]=E.useState(!1),[C,w]=E.useState(!1),[S,T]=E.useState(!1),[N,j]=E.useState("1"),[O,R]=E.useState([]),[z,M]=E.useState(null);E.useEffect(()=>{if(!d){m(null),R([]);return}(async()=>{b(!0);try{const Me=await fetch(`${sS}/anime/${d}`);if(!Me.ok)throw new Error("Failed to fetch anime details");const Le=await Me.json();m(Le.anime),R(Array.isArray(Le.episodes)?Le.episodes:[]),T(!0)}catch(Me){console.error("Failed to load anime details:",Me),m(null),R([])}finally{b(!1)}})()},[d]),E.useEffect(()=>{if(!u||!d){M(null);return}const de=new AbortController;return(async()=>{try{M(null);const Le=await _5(sS,u,de.signal);M(Le)}catch(Le){if(de.signal.aborted)return;console.error("Failed to load anime visitor count:",Le),M(null)}})(),()=>de.abort()},[u,d]),E.useEffect(()=>{if(d)return document.body.style.overflow="hidden",()=>{document.body.style.overflow="unset"}},[d]),E.useEffect(()=>{!d||!p||(document.title=`${Mf(p)} | ${$7}`)},[d,p]),E.useEffect(()=>{w(!1)},[d]),E.useEffect(()=>{j(String(h||1))},[d,h]),E.useEffect(()=>{h||(l.current=!1)},[h]);const P=()=>{y||i.current||(_(!0),i.current=setTimeout(()=>{const de=new URLSearchParams(e);de.delete("watch"),de.delete("season"),de.delete("episode"),t(de),i.current=null},180))};E.useEffect(()=>{d&&(i.current&&(clearTimeout(i.current),i.current=null),_(!1))},[d]),E.useEffect(()=>()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]);const G=p?.episodes&&p.episodes>0?p.episodes:void 0,U=Number.parseInt(N,10),Y=Number.isFinite(U)&&U>0?U:1,W=G?Math.min(Y,G):Y,J=new Map(O.map(de=>[de.number,de.title])),F=G?Array.from({length:G},(de,Me)=>{const Le=Me+1;return{number:Le,title:J.get(Le)||`Episode ${Le}`}}):[{number:W,title:J.get(W)||`Episode ${W}`}],$=J.get(W)||`Episode ${W}`,V=()=>{const de=r.current?.value||N,Me=Number.parseInt(de,10),Le=Number.isFinite(Me)&&Me>0?Me:1;return G?Math.min(Le,G):Le},se=de=>{if(!p||!d)return;const Me=Z?1:V();l.current=!0;const Le=new URLSearchParams(e);Le.delete("season"),Le.set("episode",String(Me)),t(Le,{replace:!0}),n({type:"anime",id:d,title:D,image:H,provider:"videasy",animeIsMovie:Z,episode:Me,maxEpisodes:Z?1:G,animeEpisodes:Z?void 0:O,dub:de})},ue=E.useMemo(()=>{if(!p)return[];const de=new Map;de.set(p.id,{id:p.id,label:Mf(p),sortOrder:0});for(const Me of p.relations||[]){const Le=Me.media;if(!Le||Le.type!=="ANIME")continue;const pe=String(Me.relationType||"").toUpperCase();pe!=="PREQUEL"&&pe!=="SEQUEL"||de.set(Le.id,{id:Le.id,label:F7(Le),sortOrder:pe==="PREQUEL"?-1:1})}return Array.from(de.values()).sort((Me,Le)=>Me.sortOrder!==Le.sortOrder?Me.sortOrder-Le.sortOrder:Me.label.localeCompare(Le.label))},[p]),Ce=de=>{if(!d||de===d)return;const Me=new URLSearchParams(e);Me.set("watch",`anime-${de}`),Me.delete("episode"),Me.delete("season"),Me.delete("server"),t(Me,{replace:!0})};if(E.useEffect(()=>{!d||!p||!h||l.current||(l.current=!0,n({type:"anime",id:d,title:Mf(p),image:rS(p),provider:"videasy",animeIsMovie:Af(p),episode:W,maxEpisodes:Af(p)?1:G,animeEpisodes:Af(p)?void 0:O,dub:!1}))},[d,p,h,W,G,O,n]),!d)return null;const D=p?Mf(p):S?`Anime #${d}`:"Loading anime details...",H=p?rS(p):"",Z=p?Af(p):!1,Ee=g?"Loading anime details...":B7(p?.description),je=!g&&Ee.length>180,le=g&&!p,Se=z!==null?Up(z):null;return o.jsxs("div",{className:`fixed inset-0 z-110 flex justify-center overflow-y-auto bg-black/40 backdrop-blur-md p-2 sm:p-4 md:p-8 ${y?"animate-fade-out"
66:"animate-fade-in"}`,role:"dialog","aria-modal":"true","aria-label":D,onClick:P,children:[o.jsxs("div",{className:"pointer-events-none absolute inset-0 z-1 overflow-hidden",children:[H?o.jsx("img",{src:H,alt:"",className:"h-full w-full object-cover opacity-25 blur-xl scale-110"}):null,o.jsx("div",{className:"absolute inset-0 bg-linear-to-t from-zinc-950 via-zinc-950/70 to-black/85"}),o.jsx("div",{className:"absolute inset-0 [background:radial-gradient(circle_at_22%_8%,rgba(226,94,12,.28),transparent_30%),radial-gradient(circle_at_78%_0%,rgba(255,255,255,.06),transparent_20%)]"})]}),o.jsxs("div",{className:`relative z-2 w-full max-w-5xl bg-zinc-900/95 rounded-2xl overflow-hidden border border-white/10 shadow-[0_35px_120px_-45px_rgba(0,0,0,0.9)] mt-6 md:mt-10 mb-auto ${y?"animate-slide-down":"animate-slide-up"}`,onClick:de=>de.stopPropagation(),children:[o.jsx("button",{type:"button",onClick:P,className:"absolute top-3 right-3 md:top-4 md:right-4 z-20 p-2.5 bg-zinc-900/75 hover:bg-zinc-900 rounded-full border border-white/15 text-white transition","aria-label":"Close details",children:o.jsx(Ar,{className:"w-5 h-5"})}),o.jsxs("div",{className:"relative h-64 sm:h-80 md:h-[26rem] bg-zinc-800",children:[H?o.jsx("img",{src:H,alt:D,className:"h-full w-full object-cover"}):null,o.jsx("div",{className:"absolute inset-0 bg-linear-to-t from-zinc-900 via-zinc-900/25 to-transparent"}),o.jsx("div",{className:"absolute inset-0 bg-linear-to-r from-zinc-950/70 via-transparent to-zinc-950/35"}),o.jsxs("div",{className:"absolute inset-x-0 bottom-0 p-4 md:p-6",children:[o.jsx("p",{className:"inline-flex items-center rounded-full border border-[#E25E0C]/35 bg-black/35 px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-[#E25E0C] font-black",children:"Anime Details"}),o.jsx("h2",{className:"mt-3 text-2xl md:text-5xl font-black text-white leading-tight max-w-4xl",children:D}),o.jsxs("div",{className:"mt-4 flex flex-wrap gap-2 text-xs md:text-sm text-zinc-100",children:[o.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md border border-white/20 bg-black/35",children:[o.jsx(wo,{className:"w-3.5 h-3.5"})," ",p?.format||"ANIME"]}),o.jsx("span",{className:"px-2.5 py-1 rounded-md border border-white/20 bg-black/35",children:p?.seasonYear||"Unknown year"}),o.jsxs("span",{className:"px-2.5 py-1 rounded-md border border-white/20 bg-black/35",children:["Episodes: ",p?.episodes||"?"]}),o.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md border border-white/20 bg-black/35",children:[o.jsx(dl,{className:"w-3.5 h-3.5 text-[#E25E0C] fill-[#E25E0C]"})," ",p?.averageScore?`${p.averageScore}/100`:"N/A"]}),Se!==null?o.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md border border-white/20 bg-black/35",title:"Views in the last 24 hours",children:[o.jsx(t5,{className:"w-3.5 h-3.5"})," ",Se," views",o.jsx("span",{className:"text-zinc-400",children:"Last 24h"})]}):null,p?.status?o.jsx("span",{className:"px-2.5 py-1 rounded-md border border-white/20 bg-black/35",children:p.status}):null]})]}),le?o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-zinc-950/45 backdrop-blur-[1px]",children:o.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-white/20 bg-black/45 px-4 py-2 text-sm font-semibold text-zinc-100",children:[o.jsx("span",{className:"h-3 w-3 animate-spin rounded-full border-2 border-zinc-300/50 border-t-[#E25E0C]"}),"Loading details..."]})}):null]}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1.15fr_0.85fr] gap-5 p-4 md:p-6 bg-zinc-950/70",children:[o.jsxs("div",{className:"rounded-xl border border-white/10 bg-zinc-900/75 p-4 md:p-5",children:[o.jsx("h3",{className:"text-sm font-black uppercase tracking-wide text-zinc-200 mb-3",children:"Synopsis"}),o.jsx("p",{className:`text-zinc-300 leading-relaxed text-sm md:text-base ${C?"":"line-clamp-3"}`,children:Ee}),je?o.jsx("button",{type:"button",onClick:()=>w(de=>!de),className:"mt-2 inline-flex text-xs font-semibold text-[#E25E0C] hover:text-[#f76c15] transition",children:C?"Show less":"Read more"}):null,p?.genres?.length?o.jsx("div",{className:"mt-5 flex flex-wrap gap-2",children:p.genres.slice(0,10).map(de=>o.jsx("span",{className:"rounded-full bg-zinc-800 border border-white/10 px-3 py-1 text-xs text-zinc-200",children:de},de))}):null]}),o.jsxs("div",{className:"rounded-xl border border-white/10 bg-zinc-900/75 p-4 md:p-5",children:[o.jsx("h3",{className:"text-sm font-black uppercase tracking-wide text-zinc-200 mb-3",children:"Start Watching"}),ue.length>1?o.jsxs("div",{className:"mb-3 rounded-lg border border-white/10 bg-zinc-950/60 p-2.5",children:[o.jsx("label",{htmlFor:"anime-season-select",className:"mb-1.5 block text-[11px] font-bold uppercase tracking-wide text-zinc-300",children:"Season"}),o.jsx("select",{id:"anime-season-select",value:String(d),onChange:de=>Ce(Number.parseInt(de.target.value,10)),disabled:!p,className:"h-10 w-full rounded-md border border-white/20 bg-zinc-900 px-3 text-sm font-semibold text-white outline-none transition focus:border-[#
66E25E0C] disabled:cursor-not-allowed disabled:opacity-50","aria-label":"Choose season",children:ue.map(de=>o.jsx("option",{value:de.id,children:de.label},de.id))})]}):null,Z?null:o.jsxs("div",{className:"mb-3 rounded-lg border border-white/10 bg-zinc-950/60 p-2.5",children:[o.jsx("label",{htmlFor:"anime-episode-select",className:"mb-1.5 block text-[11px] font-bold uppercase tracking-wide text-zinc-300",children:"Episode"}),o.jsx("select",{id:"anime-episode-select",ref:r,value:String(W),onChange:de=>j(de.target.value),disabled:!p,className:"h-10 w-full rounded-md border border-white/20 bg-zinc-900 px-3 text-sm font-semibold text-white outline-none transition focus:border-[#E25E0C] disabled:cursor-not-allowed disabled:opacity-50","aria-label":"Choose episode",children:F.map(de=>o.jsx("option",{value:de.number,children:`Episode ${de.number}: ${de.title}`},de.number))}),o.jsx("p",{className:"mt-1.5 text-[11px] text-zinc-300/90 line-clamp-1",children:$})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("button",{type:"button",onClick:()=>se(!1),disabled:!p,className:"inline-flex items-center justify-center gap-2 bg-[#E25E0C] hover:bg-[#f76c15] text-white px-4 py-2.5 rounded-md font-black uppercase tracking-wide transition disabled:opacity-50 disabled:cursor-not-allowed",children:[o.jsx(Ts,{className:"w-4 h-4 fill-white"})," Watch Original (Sub)"]}),Z?null:o.jsxs("button",{type:"button",onClick:()=>se(!0),disabled:!p,className:"inline-flex items-center justify-center gap-2 bg-zinc-800 hover:bg-zinc-700 text-white px-4 py-2.5 rounded-md font-bold transition border border-white/20 disabled:opacity-50 disabled:cursor-not-allowed",children:[o.jsx(Ts,{className:"w-4 h-4 fill-white"})," Watch English"]})]})]})]})]})]})}const M5=()=>{const[n,e]=E.useState(!1),[t,i]=E.useState(!0);return E.useEffect(()=>{const r=()=>{const h=window.matchMedia("(max-width: 768px)"),d=navigator.userAgent.toLowerCase(),m=["android","webos","iphone","ipad","ipod","blackberry","windows phone","mobile"].some(b=>d.includes(b)),g=h.matches||m&&window.innerWidth<=768;e(g),i(!1)};r();const l=window.matchMedia("(max-width: 768px)"),u=()=>r();return l.addEventListener?l.addEventListener("change",u):l.addListener(u),window.addEventListener("resize",r),()=>{l.removeEventListener?l.removeEventListener("change",u):l.removeListener(u),window.removeEventListener("resize",r)}},[]),{isMobile:n,isLoading:t}},lm="https://watch-server-production-c01b.up.railway.app/api",V7="watchpump:xp:leaderboard:v1:",G7=600*1e3,R1=new Map,k1="watchpump:watch-progress-updated";function A5(n,e){return`${V7}v2:${e}:${n}`}function q7(n,e){const t=A5(n,e),i=R1.get(t);if(i)return i;if(typeof window>"u")return null;try{const r=window.localStorage.getItem(t);if(!r)return null;const l=JSON.parse(r);return!l||typeof l.cachedAt!="number"||!l.payload?null:(R1.set(t,l),l)}catch{return null}}function W7(n,e,t){const i={payload:t,cachedAt:Date.now()},r=A5(n,e);if(R1.set(r,i),!(typeof window>"u"))try{window.localStorage.setItem(r,JSON.stringify(i))}catch{}}function X7(n,e){const t=Math.max(0,Math.floor(Number(e)||0));return t<=0?!1:Date.now()-n.cachedAt<=t}function j1(n=25,e=G7,t="all"){const i=Math.max(1,Math.min(50,Math.floor(Number(n)||25))),r=q7(i,t);return!r||!X7(r,e)?null:r.payload}async function Y7(){if(!Fe)return null;const{data:{session:n}}=await Fe.auth.getSession();return n?.access_token||null}async function K7(n){const e=await Y7();if(!e)throw new Error("AUTH_REQUIRED_FOR_XP_TRACKING");const t=await fetch(`${lm}/users/watch/heartbeat`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify(n),keepalive:!0});if(!t.ok){const r=await t.text().catch(()=>"");throw new Error(r||t.statusText||"Failed to record watch progress")}const i=await t.json();return typeof window<"u"&&(i.acceptedSeconds>0||i.newlyCompleted)&&window.dispatchEvent(new CustomEvent(k1,{detail:i})),i}async function Z7(n=25,e){const t=Math.max(1,Math.min(50,Math.floor(Number(n)||25))),i=e?.maxAgeMs,r=!!e?.forceRefresh,l=e?.period||"all";if(!r){const d=j1(t,i,l);
66if(d)return d}const u=await fetch(`${lm}/users/xp/leaderboard?limit=${t}&period=${l}`,{method:"GET"});if(!u.ok){const d=await u.text().catch(()=>"");throw new Error(d||u.statusText||"Failed to load XP leaderboard")}const h=await u.json();return W7(t,l,h),h}async function Q7(){const n=await fetch(`${lm}/movie-prize-winners`,{method:"GET"});if(!n.ok){const t=await n.text().catch(()=>"");throw new Error(t||n.statusText||"Failed to load SOL prize winners")}return(await n.json()).winners||[]}async function fv(n){const e=encodeURIComponent(String(n||"").trim());if(!e)throw new Error("Missing user id.");const t=await fetch(`${lm}/users/xp/profile/${e}`,{method:"GET"});if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||t.statusText||"Failed to load user profile")}return await t.json()}const J7="PyroPlay",ax="https://watch-server-production-c01b.up.railway.app/api",eL="watchpump:player-provider",tL=["https://vidfast.pro","https://vidfast.in","https://vidfast.io","https://vidfast.me","https://vidfast.net","https://vidfast.pm","https://vidfast.xyz"],nL="https://player.videasy.net",iL="https://vidzen.fun",sL="https://vidcore.net",rL=15e3;function aL(n){try{return new URL(n).origin}catch{return null}}function oL(n,e,t,i){if(e==="videasy"){const l="E25E0C";if(n.type==="tv"){const u=n.season||1,h=n.episode||1,d=new URLSearchParams({color:l,nextEpisode:"true",autoplayNextEpisode:"true",episodeSelector:"true",overlay:"true"});return`https://player.videasy.net/tv/${n.id}/${u}/${h}?${d.toString()}`}if(n.type==="anime"){const u=new URLSearchParams({color:l,overlay:"true"});return i&&u.set("dub","true"),n.animeIsMovie?`https://player.videasy.net/anime/${n.id}?${u.toString()}`:`https://player.videasy.net/anime/${n.id}/${t}?${u.toString()}`}return`https://player.videasy.net/movie/${n.id}?${new URLSearchParams({color:l,overlay:"true"}).toString()}`}if(e==="noads"){const l=new URLSearchParams({autoplay:"false"});if(n.type==="tv"){const u=n.season||1,h=n.episode||1;return`https://vidzen.fun/tv/${n.id}/${u}/${h}?${l.toString()}`}return`https://vidzen.fun/movie/${n.id}?${l.toString()}`}if(e==="noads2"){const l=new URLSearchParams({autoPlay:"true",server:"bravo",theme:"E25E0C"});if(n.type==="tv"){const u=n.season||1,h=n.episode||1;return`https://vidcore.net/tv/${n.id}/${u}/${h}?${l.toString()}`}return`https://vidcore.net/movie/${n.id}?${l.toString()}`}const r=new URLSearchParams({autoPlay:"true",server:"vfast",theme:"E25E0C"});if(n.type==="tv"){const l=n.season||1,u=n.episode||1;return`https://vidfast.pro/tv/${n.id}/${l}/${u}?${r.toString()}`}return`https://vidfast.pro/movie/${n.id}?${r.toString()}`}function lL({config:n,onClose:e}){const t=E.useRef(null),i=E.useRef(null),r=E.useRef(""),l=E.useRef(""),u=E.useRef(!1),[h,d]=E.useState(!1),[p,m]=E.useState(!0),[g,b]=E.useState(!0),{isMobile:y,isLoading:_}=M5(),[C,w]=E.useState(null),[S,T]=E.useState(1),[N,j]=E.useState(1),[O,R]=E.useState([]),[z,M]=E.useState(!1),[P,G]=E.useState([]),[U,Y]=E.useState([]),[W,J]=E.useState(!1),[F,$]=E.useState(1),[V,se]=E.useState(1),[ue,Ce]=E.useState(1),[D,H]=E.useState(1),[Z,Ee]=E.useState(!1),[je,le]=E.useState(!1),[Se,de]=E.useState(!1),[Me,Le]=Ki(),[pe,Be]=E.useState(!0),[We,dt]=E.useState(1),[Ct,ut]=E.useState(!0),kt=E.useRef(null),K=E.useRef(null),Nt=E.useRef(null),Tt=E.useRef(null),Mt=E.useRef(0),nt=E.useRef(0),I=E.useRef(0),k=E.useRef(""),Q=E.useRef(0),fe=E.useRef(!1),be=E.useRef(!1),xe=E.useRef(0),Xe=E.useRef(!1),$e=E.useRef(null),it=E.useRef(null),ht=n?.type==="tv",X=n?.type==="anime",oe=n?.type==="anime"&&n.maxEpisodes&&n.maxEpisodes>0?n.maxEpisodes:void 0,ke=E.useMemo(()=>O.length>0?O:oe?Array.from({length:oe},(we,He)=>({number:He+1,title:`Episode ${He+1}`})):[],[O,oe]),Ae=we=>{const He=Number.isFinite(we)&&Number(we)>0?Number(we):1;return oe?Math.min(He,oe):He},De=E.useMemo(()=>n?n.type==="tv"?{...n,season:F||n.season||1,episode:V||n.episode||1}:n.type==="anime"?{...n,episode:S,dub:z}:n:null,[n,F,V,S,z]),st=E.useMemo(()=>!De||!C?"":oL(De,C,S,z),[De,C,S,z]);E.useEffect(()=>{if(!n){l.current="",R([]),G([]),Y([]);return}const we=[n.type,String(n.id),String(n.season||0),String(n.episode||0),n.animeIsMovie?"1":"0"].join(":");if(l.current===we)return;l.current=we,w(n.provider||(n.type==="anime"?"videasy":null)),de(!1),Be(!0);const He=Ae(n.episode);if(T(He),j(He),M(!!n.dub),R(Array.isArray(n.animeEpisodes)?n.animeEpisodes:[]),n.type==="tv"){const rt=n.season&&n.season>0?n.season:1,Ke=n.episode&&n.episode>0?n.episode:1;$(rt),se(Ke),Ce(rt),H(Ke);return}G([]),Y([])},[n]),E.useEffect(()=>{if(!n||n.type!=="anime"||n.animeIsMovie){R([]);return}if(Array.isArray(n.animeEpisodes)&&n.animeEpisodes.length>0){R(n.animeEpisodes);return}let we=!0;return(async()=>{try{const rt=await fetch(`${ax}/anime/${n.id}`);if(!rt.ok)throw new Error("Failed to load anime episodes");const Ke=await rt.json();if(!we)return;
66R(Array.isArray(Ke.episodes)?Ke.episodes:[])}catch(rt){if(!we)return;console.warn("Failed to load anime episodes:",rt),R([])}})(),()=>{we=!1}},[n]),E.useEffect(()=>{!X||!oe||(T(we=>Ae(we)),j(we=>Ae(we)))},[X,oe]),E.useEffect(()=>{if(!n||n.type!=="tv"){G([]);return}let we=!0;return(async()=>{try{const rt=await fetch(`${ax}/tv/${n.id}`);if(!rt.ok)throw new Error("Failed to load TV details");const Ke=await rt.json();if(!we)return;const lt=Array.isArray(Ke.seasons)?Ke.seasons.filter(re=>re.season_number>0):[];if(G(lt),lt.length===0){Y([]);return}const L=new Set(lt.map(re=>re.season_number)),q=n.season&&L.has(n.season)?n.season:ue,ne=L.has(q)?q:lt[0].season_number;Ce(ne),$(re=>L.has(re)?re:ne)}catch(rt){if(!we)return;console.warn("Failed to load TV seasons:",rt),G([]),Y([])}})(),()=>{we=!1}},[n]),E.useEffect(()=>{if(!n||n.type!=="tv"||!ue){Y([]),J(!1);return}let we=!0;return(async()=>{J(!0);try{const rt=await fetch(`${ax}/tv/${n.id}/season/${ue}`);if(!rt.ok)throw new Error("Failed to load TV episodes");const Ke=await rt.json();if(!we)return;const lt=Array.isArray(Ke.episodes)?Ke.episodes:[];if(Y(lt),lt.length===0){H(1),se(ne=>ue===F?ne:1);return}const L=new Set(lt.map(ne=>ne.episode_number)),q=L.has(D)?D:lt[0].episode_number;H(q),ue===F&&!L.has(V)&&se(q)}catch(rt){if(!we)return;console.warn("Failed to load TV episodes:",rt),Y([])}finally{if(!we)return;J(!1)}})(),()=>{we=!1}},[n,ue]),E.useEffect(()=>{if(C==="noads"){ut(!1);return}ut(!0)},[C]);const te=n&&C?n.type==="anime"||C==="videasy":!1,Ie=C==="vidfast"||C==="videasy",Pe=C==="noads";E.useEffect(()=>{if(!C){le(!1);return}if(!(C==="vidfast"||C==="videasy")){le(!1);return}le(!0);const He=setTimeout(()=>{le(!1)},2e3);return()=>clearTimeout(He)},[C]);const Ze=()=>{const we=document,He=screen.orientation;try{u.current&&He.unlock&&He.unlock()}catch{}u.current=!1;try{document.fullscreenElement?document.exitFullscreen():we.webkitExitFullscreen?we.webkitExitFullscreen():we.msExitFullscreen&&we.msExitFullscreen()}catch{}},ze=async()=>{if(!y)return;const we=t.current,He=screen.orientation;try{we&&!document.fullscreenElement&&(we.requestFullscreen?await we.requestFullscreen():we.webkitRequestFullscreen?await we.webkitRequestFullscreen():we.msRequestFullscreen&&await we.msRequestFullscreen())}catch{}try{He.lock&&(await He.lock("landscape"),u.current=!0)}catch{}},ge=()=>{if(Me.has("server")){const we=new URLSearchParams(Me);we.delete("server"),Le(we,{replace:!0})}e()},Ye=we=>{let He=we;X&&(He="videasy"),w(He),de(!1),ze();let rt="";if(He==="vidfast"?rt="server1":He==="videasy"?rt="server2":He==="noads"?rt="noads1":He==="noads2"&&(rt="noads2"),rt){const Ke=new URLSearchParams(Me);Ke.set("server",rt),Le(Ke,{replace:!0})}},pt=()=>{if(!n||n.type!=="tv"||!C)return;const we=ue||F||n.season||1,He=D||V||n.episode||1;$(we),se(He);const rt=new URLSearchParams(Me);rt.set("season",String(we)),rt.set("episode",String(He)),Le(rt,{replace:!0}),de(!1)},Wt=()=>{if(!n||n.type!=="anime"||n.animeIsMovie||!C)return;const we=Ae(N||S||n.episode||1);T(we),j(we);const He=new URLSearchParams(Me);He.delete("season"),He.set("episode",String(we)),Le(He,{replace:!0}),de(!1)},ce=we=>{if(!De||!C||!k.current||fe.current)return;const He=Math.max(0,Math.min(30,Math.floor(I.current))),rt=Math.max(0,Math.floor(nt.current)),Ke=Q.current===0;if(!we&&He<10||!Ke&&He<=0)return;const lt=Q.current;fe.current=!0,K7({sessionId:k.current,sequence:lt,contentType:De.type,contentId:String(De.id),watchParam:`${De.type}-${De.id}`,provider:C,trackingMode:Pe?"fallback":"event",engagedSeconds:He,playbackState:He>0||be.current||Pe?"playing":"paused",positionSeconds:Math.max(0,Math.floor(Mt.current)),durationSeconds:rt||void 0,season:De.type==="tv"?Number(De.season||0):void 0,episode:De.type==="tv"||De.type==="anime"?Number(De.episode||0):void 0}).then(L=>{const q=L.duplicate?He:Math.max(0,Number(L.acceptedSeconds||0));I.current=Math.max(0,I.current-q),Q.current=lt+1}).catch(L=>{console.warn("Failed to track watch XP:",L?.message||L)}).finally(()=>{fe.current=!1})},Ge=we=>{if(!we)return null;if(typeof we=="string")try{const He=JSON.parse(we);return He&&typeof He=="object"?He:null}catch{return null}return typeof we=="object"?we:null},vt=we=>{if(typeof we=="number"&&Number.isFinite(we)&&we>0)return Math.floor(we);if(typeof we=="string"){const He=we.trim();if(!He)return null;const rt=Number.parseInt(He,10);if(Number.isFinite(rt)&&rt>0)return rt}return null},rn=we=>{if(typeof we!="string")return null;const He=we.trim();if(!He)return null;const rt=He.match(/\/tv\/[^/]+\/(\d+)\/(\d+)(?:[/?#]|$)/i);if(rt)return{season:Number.parseInt(rt[1],10),episode:Number.parseInt(rt[2],10)};const Ke=He.match(/\/anime\/[^/]+\/(\d+)(?:[/?#]|$)/i);if(Ke)return{episode:Number.parseInt(Ke[1],10)};try{const lt=new URL(He,window.location.origin),L=vt(lt.searchParams.get("season")),q=vt(lt.searchParams.get("episode"));if(L||q)return{season:L||void 0,episode:q||void 0}}catch{return null}return null},On=(...we)=>{const He=["season","seasonNumber","season_number","currentSeason","selectedSeason"],rt=["episode","episodeNumber","episode_number","currentEpisode","selectedEpisode"],Ke=["url","href","src","location","pathname","currentUrl","current_url","iframeUrl","iframe_url"];for(const lt of we){if(!lt)continue;for(const ne of Ke){const re=rn(lt[ne]);if(re?.season||re?.episode)return re}const L=He.map(ne=>vt(lt[ne])).find(ne=>ne!==null),q=rt.map(ne=>vt(lt[ne])).find(ne=>ne!==null);if(L||q)return{season:L||void 0,episode:q||void 0}}return null},Dn=we=>{if(n&&n.type==="tv"){const He=we.season||F||n.season||1,rt=we.episode||V||n.episode||1,Ke=vt(Me.get("season"))||F,lt=vt(Me.get("episode"))||V,L=ue!==F||D!==V;if(He===Ke&&rt===lt)return;$(He),se(rt),L||(Ce(He),H(rt));const q=new URLSearchParams(Me);q.set("season",String(He)),q.set("episode",String(rt)),Le(q,{replace:!0});return}},Qn=()=>{const we=new Set;
66C==="vidfast"&&tL.forEach(rt=>we.add(rt)),C==="videasy"&&we.add(nL),C==="noads"&&we.add(iL),C==="noads2"&&we.add(sL);const He=aL(st);return He&&we.add(He),Array.from(we)},bi=we=>{if(!n||!C)return;const He=Qn();if(!(i.current?.contentWindow?we.source===i.current.contentWindow:!1)&&!He.includes(we.origin))return;C==="noads"&&console.log("[MoviePlayerModal:noads] message",{origin:we.origin,data:we.data});const Ke=Ge(we.data);if(!Ke)return;let lt="",L=0,q=0,ne=null;if(C==="vidfast"||C==="noads2"){if(String(Ke.type||"")!=="PLAYER_EVENT")return;const qe=Ke.data&&typeof Ke.data=="object"?Ke.data:null;if(!qe)return;ne=qe,lt=String(qe.event||"").trim().toLowerCase().replace("triggered",""),L=Number(qe.currentTime||0),q=Number(qe.duration||0)}if(C==="noads"){const qe=Ke.data&&typeof Ke.data=="object"?Ke.data:null,Qe=typeof Ke.data=="string"?Ge(Ke.data):null,et=qe||Qe;ne=et;const mt=et?.event||et?.type||Ke.event||Ke.type||"";lt=String(mt).trim().toLowerCase().replace("triggered","").replace("player_event","").trim(),L=Number(et?.currentTime||et?.time||Ke.currentTime||0),q=Number(et?.duration||Ke.duration||0),!lt&&L>0&&(lt="timeupdate"),console.log("[MoviePlayerModal:noads] parsed-event",{eventName:lt,currentTime:L,duration:q,payload:Ke})}if(C==="videasy")if(String(Ke.type||"").trim().toLowerCase()==="player_event"){const qe=Ke.data&&typeof Ke.data=="object"?Ke.data:null,Qe=typeof Ke.data=="string"?Ge(Ke.data):null,et=qe||Qe;if(!et)return;ne=et,lt=String(et.event||"").trim().toLowerCase().replace("triggered",""),L=Number(et.currentTime||0),q=Number(et.duration||0)}else{const qe=Ke.data&&typeof Ke.data=="object"?Ke.data:null,Qe=typeof Ke.data=="string"?Ge(Ke.data):null,et=qe||Qe;ne=et,lt=String(Ke.event||Ke.type||et?.event||"timeupdate").trim().toLowerCase().replace("triggered",""),L=Number(Ke.currentTime||et?.currentTime||0),q=Number(Ke.duration||et?.duration||0)}(!Number.isFinite(L)||L<0)&&(L=0);const re=Ge(Ke.payload)||Ge(Ke.detail),me=On(Ke,ne,re);(me?.season||me?.episode)&&Dn(me);const Je=document.visibilityState==="visible"&&document.hasFocus();if(!(Pe&&(!Je||!Xe.current))){if(Number.isFinite(q)&&q>0&&(nt.current=Math.max(nt.current,Math.floor(q))),lt==="timeupdate"||lt==="playerstatus"||lt==="play"||lt==="seeked"){Mt.current=Math.max(Mt.current,Math.floor(L)),(lt==="play"||lt==="timeupdate")&&(be.current=!0),lt==="playerstatus"&&typeof ne?.playing=="boolean"&&(be.current=ne.playing);return}if(lt==="ended"){const qe=Math.max(L,q);Number.isFinite(qe)&&qe>0&&(Mt.current=Math.max(Mt.current,Math.floor(qe))),be.current=!1,ce(!0);return}lt==="pause"&&(be.current=!1,ce(!0))}},qn=()=>{K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{Be(!1)},2500)},cs=()=>{y||(Be(!0),qn())},Jn=()=>{Nt.current&&(clearTimeout(Nt.current),Nt.current=null)},xn=()=>{Tt.current&&(clearTimeout(Tt.current),Tt.current=null)},Nn=()=>{xn(),Se&&(Tt.current=setTimeout(()=>{de(!1),Tt.current=null},5e3))},Si=()=>{dt(1),Jn(),!Se&&(Nt.current=setTimeout(()=>{dt(.6)},3e3))};E.useEffect(()=>{if(!Se){xn();return}return Nn(),()=>{xn()}},[Se]);const Fi=we=>{i.current&&i.current.src!==we&&(i.current.src=we)},Li=async()=>{if(!n||Z)return;Ee(!0);const we=st||"about:blank";let He=!1;try{i.current&&(i.current.src="about:blank");const rt=window;if(rt.documentPictureInPicture?.requestWindow){const Ke=await rt.documentPictureInPicture.requestWindow({width:480,height:270});Ke.document.documentElement.style.height="100%",Ke.document.documentElement.style.width="100%",Ke.document.body.style.margin="0",Ke.document.body.style.height="100%",Ke.document.body.style.width="100%",Ke.document.body.style.overflow="hidden",Ke.document.body.style.background="#000";const lt=Ke.document.createElement("iframe");lt.src=we,lt.allow="encrypted-media; picture-in-picture; fullscreen",lt.allowFullscreen=!0,lt.style.display="block",lt.style.position="fixed",lt.style.inset="0",lt.style.width="100%",lt.style.height="100%",lt.style.minHeight="100vh",lt.style.border="0",Ke.document.body.appendChild(lt);const L=()=>{Fi(we)};Ke.addEventListener("pagehide",L,{once:!0}),Ke.addEventListener("beforeunload",L,{once:!0}),He=!0;return}console.warn("Document Picture in Picture is not supported in this browser.")}finally{!He&&i.current&&(i.current.src=we),Ee(!1)}};E.useEffect(()=>{C&&window.localStorage.setItem(eL,C)},[C]),E.useEffect(()=>{if(y||!n){K.current&&clearTimeout(K.current),Be(!0);return}return Be(!0),qn(),()=>{K.current&&clearTimeout(K.current)}},[n,y]),E.useEffect(()=>{if(!n){dt(1),Jn();return}return Si(),()=>{Jn()}},[n,Se]),E.useEffect(()=>{if(n)return()=>{Ze()}},[n]),E.useEffect(()=>{if(n){b(!0);const we=setTimeout(()=>d(!0),10),He=setTimeout(()=>b(!1),2e3);return()=>{clearTimeout(we),clearTimeout(He)}}else d(!1),b(!0)},[n]);const vi=()=>{m(!0),cs(),Si(),kt.current&&clearTimeout(kt.current),kt.current=setTimeout(()=>{m(!1)},5e3)},Ks=()=>{m(!0),cs(),Si()};return E.useEffect(()=>{if(!n)return;const we=document.body.style.overflow,He=document.documentElement.style.overflow;return document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden",kt.current=setTimeout(()=>{m(!1)},5e3),()=>{document.body.style.overflow=we,document.documentElement.style.overflow=He,kt.current&&clearTimeout(kt.current)}},[n,e]),E.useEffect(()=>{if(!De||!C){Mt.current=0,nt.current=0,I.current=0,k.current="",Q.current=0,be.current=!1,Xe.current=!1,it.current&&(clearInterval(it.current),it.current=null),$e.current&&(clearTimeout($e.current),$e.current=null);return}Mt.current=0,nt.current=0,I.current=0,k.current=typeof crypto?.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(16)}-0000-4000-8000-${Math.random().toString(16).slice(2).padEnd(12,"0").slice(0,12)}`,Q.current=0,fe.current=!1,be.current=!1,xe.current=Date.now(),Xe.current=C!=="noads";const we=()=>{$e.current&&(clearTimeout($e.current),$e.current=null)},He=()=>{!(document.visibilityState==="visible"&&document.hasFocus())||Xe.current||$e.current||($e.current=setTimeout(()=>{Xe.current=!0,$e.current=null},rL))},rt=()=>{if(!(document.visibilityState==="visible"&&document.hasFocus())){ce(!0),C==="noads"&&(Xe.current=!1,we());return}C==="noads"&&He()},Ke=()=>{ce(!0)};return C==="noads"&&He(),ce(!0),it.current=setInterval(()=>{const lt=Date.now(),L=Math.max(0,Math.min(2,(lt-xe.current)/1e3));xe.current=lt,document.visibilityState==="visible"&&document.hasFocus()&&Xe.current&&(C==="noads"||be.current)&&(I.current+=L),ce(!1)}
66,1e3),window.addEventListener("message",bi),window.addEventListener("pagehide",Ke),window.addEventListener("beforeunload",Ke),document.addEventListener("visibilitychange",rt),window.addEventListener("focus",rt),window.addEventListener("blur",rt),()=>{ce(!0),we(),Xe.current=!1,be.current=!1,it.current&&(clearInterval(it.current),it.current=null),window.removeEventListener("message",bi),window.removeEventListener("pagehide",Ke),window.removeEventListener("beforeunload",Ke),document.removeEventListener("visibilitychange",rt),window.removeEventListener("focus",rt),window.removeEventListener("blur",rt)}},[De,C,Pe]),E.useEffect(()=>{if(!n)return;r.current=document.title;const we=n.title?`Playing ${n.title}`:"Playing";return document.title=`${we} | ${J7}`,()=>{r.current&&(document.title=r.current)}},[n]),n?_?o.jsx("div",{className:"fixed inset-0 z-250 flex items-center justify-center bg-black text-white",children:"Detecting device..."}):o.jsx("div",{ref:t,className:`fixed inset-0 z-250 bg-black transition-opacity duration-500 ease-in-out ${h?"opacity-100":"opacity-0"}`,onMouseMove:vi,onClick:Ks,onTouchStart:Ks,children:o.jsx("div",{className:"relative w-full h-full flex flex-col",children:o.jsxs("div",{className:"flex-1 w-full h-full bg-black relative",children:[o.jsx("iframe",{ref:i,src:C?st:"about:blank",className:`w-full h-full relative z-0 transition-opacity duration-1000 ${g?"opacity-0":"opacity-100"}`,frameBorder:"0",allowFullScreen:!0,allow:"encrypted-media; picture-in-picture; fullscreen",title:n.title||"Movie player",style:{pointerEvents:"auto"},onLoad:()=>b(!1)}),n.image&&g&&o.jsxs("div",{className:`absolute z-50 overflow-hidden pointer-events-none transition-all duration-700 ease-[cubic-bezier(0.25,1,0.5,1)] ${h?"inset-0 rounded-none":"top-20 left-1/2 -translate-x-1/2 w-[calc(100%-1rem)] md:w-[calc(100%-4rem)] max-w-4xl aspect-video rounded-xl md:rounded-t-xl"}`,children:[o.jsx("img",{src:n.image,alt:"",className:"w-full h-full object-cover"}),o.jsx("div",{className:`absolute inset-0 bg-black/20 transition-opacity duration-700 ${h?"opacity-0":"opacity-100"}`})]}),n.image&&!C&&o.jsxs("div",{className:"absolute inset-0 z-10 pointer-events-none overflow-hidden",children:[o.jsx("img",{src:n.image,alt:"",className:"h-full w-full scale-105 object-cover blur-xl"}),o.jsx("div",{className:"absolute inset-0 bg-black/45"})]}),o.jsx("div",{className:`absolute ${y?"hidden":"bottom-8 left-1/2 -translate-x-1/2"} z-20 transition-all duration-500 transform ${p||y?"opacity-100 translate-y-0":"opacity-0 translate-y-4 pointer-events-none"}`,onMouseEnter:()=>{kt.current&&clearTimeout(kt.current),m(!0)},children:o.jsxs("button",{onClick:ge,className:`flex items-center gap-2 bg-black/60 hover:bg-black/80 text-white ${y?"px-4 py-2.5 text-sm":"px-6 py-3"} rounded-full backdrop-blur-md transition-all duration-300 border border-white/10 hover:border-white/30 group shadow-lg hover:shadow-xl hover:scale-105`,children:[o.jsx(X6,{className:"w-5 h-5 group-hover:-translate-x-1 transition-transform"}),o.jsx("span",{className:"font-medium",children:y?"Back":"Back to Browse"})]})}),!y&&!X&&o.jsx("div",{className:`absolute left-1/2 top-4 z-50 -translate-x-1/2 transition-all duration-300 ${pe?"opacity-100 translate-y-0":"pointer-events-none opacity-0 -translate-y-2"}`,onMouseEnter:()=>{kt.current&&clearTimeout(kt.current),m(!0),Be(!0),K.current&&clearTimeout(K.current)},onMouseLeave:()=>{qn()},children:o.jsxs("div",{className:"rounded-full border border-white/20 bg-black/55 px-2 py-1 backdrop-blur-md flex items-center gap-1",children:[o.jsx("button",{type:"button",onClick:()=>Ye("vidfast"),className:`px-3 py-1.5 text-xs font-semibold rounded-full transition ${C==="vidfast"?"bg-white text-black":"text-zinc-200 hover:text-white"}`,children:"Server 1"}),o.jsx("button",{type:"button",onClick:()=>Ye("videasy"),className:`px-3 py-1.5 text-xs font-semibold rounded-full transition ${C==="videasy"?"bg-[#E25E0C] text-white":"text-zinc-200 hover:text-white"}`,children:"Server 2"}),o.jsx("button",{type:"button",onClick:()=>Ye("noads2"),className:`px-3 py-1.5 text-xs font-semibold rounded-full transition ${C==="noads2"?"bg-cyan-400 text-black":"text-zinc-200 hover:text-white"}`,children:"No Ads"}),o.jsx("button",{type:"button",onClick:()=>Ye("noads"),className:`px-3 py-1.5 text-xs font-semibold rounded-full transition ${C==="noads"?"bg-emerald-500 text-black":"text-zinc-200 hover:text-white"}`,children:"No Ads2"}),C&&te&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-1 h-5 w-px bg-white/20"}),o.jsx("button",{type:"button",onClick:Li,disabled:Z,className:`px-3 py-1.5 text-xs font-semibold rounded-full transition ${Z?"bg-white/20 text-zinc-300 cursor-not-allowed":"text-zinc-200 hover:text-white hover:bg-white/10"}`,children:Z?"Opening...":"Picture in Picture"})]}),C&&n.type==="anime"&&!n.animeIsMovie&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-1 h-5 w-px bg-white/20"}),o.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-zinc-200 pl-1 pr-2 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:z,onChange:we=>M(we.target.checked)}),"Dub"]})]})]})}),!C&&!X&&o.jsx("div",{className:"absolute inset-0 z-30 flex items-center justify-center bg-black/35 px-4 text-center backdrop-blur-sm",children:o.jsxs("div",{className:"w-full max-w-3xl rounded-2xl border border-white/15 bg-zinc-950/88 px-6 py-5 text-zinc-100 shadow-2xl",children:[o.jsx("p",{className:"text-xs font-black uppercase tracking-[0.14em] text-[#f5c5a0]",children:"Pick A Server"}),o.jsx("h3",{className:"mt-1 text-xl font-black text-white md:text-2xl",children:"Choose a server to start playback"}),o.jsx("p",{className:"mt-2 text-sm text-zinc-300",children:"Once selected, we will open fullscreen and rotate to landscape on mobile."}),o.jsxs("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-4",children:[o.jsxs("button",{type:"button",onClick:()=>Ye("vidfast"),className:"group rounded-xl border border-white/20 bg-white/8 p-4 text-left text-white shadow-[0_8px_24px_rgba(0,0,0,0.28)] transition-all duration-300 hover:-translate-y-1 hover:border-white/60 hover:bg-white/95 hover:shadow-[0_14px_34px_rgba(255,255,255,0.22)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/70",children:[o.jsx("p",{className:"text-sm font-black tracking-wide group-hover:text-zinc-950",children:"Server 1"}),o.jsx("p",{className:"mt-1 text-xs text-zinc-300 transition-colors group-hover:text-zinc-700",children:"Fast startup and broad movie/TV catalog."}),o.jsx("p",{className:"mt-2 text-[11px] font-semibold uppercase tracking-wide text-amber-200/90 transition-colors group-hover:text-amber-700",children:"Contains ads"})]}),o.jsxs("button",{type:"button",onClick:()=>
66Ye("videasy"),className:"group rounded-xl border border-[#E25E0C]/50 bg-[#E25E0C]/20 p-4 text-left text-[#ffd7bc] shadow-[0_10px_26px_rgba(226,94,12,0.22)] transition-all duration-300 hover:-translate-y-1 hover:border-[#ffb98f] hover:bg-[#E25E0C]/95 hover:shadow-[0_16px_34px_rgba(226,94,12,0.45)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#ffb98f]/80",children:[o.jsx("p",{className:"text-sm font-black tracking-wide text-[#ffe3cf] group-hover:text-white",children:"Server 2"}),o.jsx("p",{className:"mt-1 text-xs text-[#ffe8d7] transition-colors group-hover:text-white/90",children:"Best for anime and high-quality streams."}),o.jsx("p",{className:"mt-2 text-[11px] font-semibold uppercase tracking-wide text-amber-100 transition-colors group-hover:text-amber-50",children:"Contains ads"})]}),o.jsxs("button",{type:"button",onClick:()=>Ye("noads2"),className:"group rounded-xl border border-cyan-300/40 bg-cyan-500/15 p-4 text-left text-cyan-100 shadow-[0_10px_26px_rgba(34,211,238,0.18)] transition-all duration-300 hover:-translate-y-1 hover:border-cyan-100/80 hover:bg-cyan-400/95 hover:shadow-[0_16px_34px_rgba(34,211,238,0.4)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-100/80",children:[o.jsx("p",{className:"text-sm font-black tracking-wide group-hover:text-cyan-950",children:"No Ads 2"}),o.jsx("p",{className:"mt-1 text-xs text-cyan-50 transition-colors group-hover:text-cyan-900",children:"Fast and no ads."}),o.jsx("p",{className:"mt-2 text-[11px] font-semibold uppercase tracking-wide text-cyan-200 transition-colors group-hover:text-cyan-800",children:"No ads"})]}),o.jsxs("button",{type:"button",onClick:()=>Ye("noads"),className:"group rounded-xl border border-emerald-400/40 bg-emerald-500/15 p-4 text-left text-emerald-100 shadow-[0_10px_26px_rgba(16,185,129,0.18)] transition-all duration-300 hover:-translate-y-1 hover:border-emerald-200/80 hover:bg-emerald-400/95 hover:shadow-[0_16px_34px_rgba(16,185,129,0.4)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-200/80",children:[o.jsx("p",{className:"text-sm font-black tracking-wide group-hover:text-emerald-950",children:"No Ads"}),o.jsxs("div",{className:"mt-2 flex items-center gap-1.5","aria-label":"Supported languages",children:[o.jsx("img",{src:"https://flagcdn.com/w40/us.png",alt:"English",className:"h-4 w-6 rounded-sm object-cover",loading:"lazy"}),o.jsx("img",{src:"https://flagcdn.com/w40/fr.png",alt:"French",className:"h-4 w-6 rounded-sm object-cover",loading:"lazy"}),o.jsx("img",{src:"https://flagcdn.com/w40/in.png",alt:"Hindi",className:"h-4 w-6 rounded-sm object-cover",loading:"lazy"}),o.jsx("img",{src:"https://flagcdn.com/w40/br.png",alt:"Portuguese",className:"h-4 w-6 rounded-sm object-cover",loading:"lazy"}),o.jsx("img",{src:"https://flagcdn.com/w40/ru.png",alt:"Russian",className:"h-4 w-6 rounded-sm object-cover",loading:"lazy"})]}),o.jsx("p",{className:"mt-2 text-[11px] font-semibold uppercase tracking-wide text-emerald-200 transition-colors group-hover:text-emerald-800",children:"No ads ⢠Multilanguage"})]})]})]})}),C&&Ie&&o.jsx("div",{className:`absolute left-1/2 top-20 z-20 -translate-x-1/2 rounded-full border border-amber-400/30 bg-black/70 px-3 py-1.5 text-xs font-semibold text-amber-100 backdrop-blur transition-all duration-300 ${je?"opacity-100 translate-y-0":"opacity-0 -translate-y-3 pointer-events-none"}`,children:"Using an ads server? Try Brave Browser to block ads."}),C==="noads"&&!Ct&&o.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center bg-black/70 px-4 text-center backdrop-blur-sm",children:o.jsxs("div",{className:"w-full max-w-xl rounded-2xl border border-white/20 bg-zinc-950/95 p-6 text-white shadow-2xl",children:[o.jsx("p",{className:"text-xs font-black uppercase tracking-[0.14em] text-emerald-300",children:"No Ads Setup Required"}),o.jsx("h3",{className:"mt-2 text-lg font-black md:text-xl",children:"Choose your language before playback starts"}),o.jsxs("p",{className:"mt-3 flex items-center justify-center gap-2 text-sm text-zinc-200",children:[o.jsx(i8,{className:"h-4 w-4 text-emerald-300","aria-hidden":"true"}),o.jsx("span",{children:"Click the gear icon in the bottom-left corner of the player and select a language."})]}),o.jsx("p",{className:"mt-2 text-sm text-zinc-200",children:"If you do not select a language, the player may keep loading."}),o.jsx("button",{type:"button",onClick:()=>ut(!0),className:"mt-5 rounded-lg bg-emerald-400 px-4 py-2.5 text-sm font-black text-black transition hover:bg-emerald-300",children:"I Understand"})]})}),o.jsx("div",{className:"absolute top-25 right-4 z-20 transition-all duration-500 transform pointer-events-none",children:o.jsxs("div",{className:"pointer-events-auto relative transition-opacity duration-300",style:{opacity:We},children:[o.jsx("button",{type:"button",onClick:()=>{dt(1),Jn(),de(we=>{const He=!we;return He||xn(),He})},className:"rounded-full border border-white/20 bg-black/55 p-1.5 backdrop-blur-md","aria-label":"Open player menu",children:o.jsx("img",{src:"/pyroplay.png",alt:"PyroPlay Logo",className:`${y?"h-7":"h-8 md:h-10"} opacity-90`})}),Se&&o.jsxs("div",{className:"absolute right-0 mt-2 w-[min(88vw,320px)] rounded-2xl border border-white/15 bg-zinc-950/95 p-3 text-white shadow-2xl backdrop-blur-md",onMouseMove:Nn,onTouchStart:Nn,onClick:Nn,children:[o.jsx("p",{className:"px-1 text-[11px] font-black uppercase tracking-[0.14em] text-zinc-300",children:"Player Menu"}),X?o.jsx("p",{className:"mt-2 rounded-lg bg-[#E25E0C]/20 px-3 py-2 text-xs text-[#ffd7bc]",children:"Anime playback uses Server 2 automatically."}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mt-2 grid grid-cols-4 gap-1.5",children:[o.jsx("button",{type:"button",onClick:()=>Ye("vidfast"),className:`rounded-lg px-2 py-2 text-xs font-semibold transition ${C==="vidfast"?"bg-white text-black":"bg-white/10 text-zinc-200"}`,children:"Server 1"}),o.jsx("button",{type:"button",onClick:()=>Ye("videasy"),className:`rounded-lg px-2 py-2 text-xs font-semibold transition ${C==="videasy"?"bg-[#E25E0C] text-white":"bg-white/10 text-zinc-200"}`,children:"Server 2"}),o.jsx("button",{type:"button",onClick:()=>Ye("noads"),className:`rounded-lg px-2 py-2 text-xs font-semibold transition ${C==="noads"?"bg-emerald-500 text-black":"bg-white/10 text-zinc-200"}`,children:"No Ads"}),o.jsx("button",{type:"button",onClick:()=>Ye("noads2"),className:`rounded-lg px-2 py-2 text-xs font-semibold transition ${C==="noads2"?"bg-cyan-400 text-black":"bg-white/10 text-zinc-200"}`,children:"No Ads 2"})]}),C==="noads2"&&o.jsxs("div",{className:"mt-2 rounded-lg bg-emerald-500/10 px-2.5 py-2",children:[o.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-emerald-200",children:"No Ads Server: Faster + Multilanguage"}),o.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5","aria-label":"No Ads language support",children:[o.jsx("img",{src:"https://flagcdn.com/w40/us.png",alt:"English",className:"h-4 w-6 rounded-sm object-cover",loading:"lazy"}),o.jsx("img",{src:"https://flagcdn.com/w40/fr.png",alt:"French",className:"h-4 w-6 rounded-sm object-cover",loading:"lazy"}),o.jsx("img",{src:"https://flagcdn.com/w40/in.png",alt:"Hindi",className:"h-4 w-6 rounded-sm object-cover",loading:"lazy"}),o.jsx("img",{src:"https://flagcdn.com/w40/br.png",alt:"Portuguese",className:"h-4 w-6 rounded-sm object-cover",loading:"lazy"}),o.jsx("img",{src:"https://flagcdn.com/w40/ru.png",alt:"Russian",className:"h-4 w-6 rounded-sm object-cover",loading:"lazy"})]})]})]}),ht&&P.length>0&&o.jsxs("div",{className:"mt-2 rounded-xl border border-white/10 bg-white/5 p-3",children:[o.jsx("p",{className:"text-[11px] font-black uppercase tracking-[0.14em] text-zinc-300",children:"Episode Picker"}),o.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-2",children:[o.jsxs("label",{className:"flex flex-col gap-1 text-[11px] font-semibold text-zinc-300",children:[o.jsx("span",{children:"Season"}),o.jsx("select",{value:ue,onChange:we=>{const He=Number(we.target.value);Ce(Number.isFinite(He)&&He>0?He:1),H(1)},className:"rounded-lg border border-white/10 bg-black/45 px-2.5 py-2 text-sm text-white outline-none",children:P.map(we=>o.jsx("option",{value:we.season_number,children:we.name||`Season ${we.season_number}`},we.id||we.season_number))})]}),o.jsxs("label",{className:"flex flex-col gap-1 text-[11px] font-semibold text-zinc-300",children:[o.jsx("span",{children:"Episode"}),o.jsx("select",{value:D,onChange:we=>{const He=Number(we.target.value);H(Number.isFinite(He)&&He>0?He:1)},disabled:W||U.length===0,className:"rounded-lg border border-white/10 bg-black/45 px-2.5 py-2 text-sm text-white outline-none disabled:cursor-not-allowed disabled:opacity-50",children:U.length>0?U.map(we=>o.jsx("option",{value:we.episode_number,children:`Episode ${we.episode_number}${we.name?` - ${we.name}`:""}`},we.id||we.episode_number)):o.jsx("option",{value:D,children:W?"Loading episodes...":"No episodes"})})]})]}),o.jsx("button",{type:"button",onClick:pt,disabled:!C||W||U.length===0,className:"mt-2 w-full rounded-lg bg-[#E25E0C] px-3 py-2 text-sm font-semibold text-white transition hover:bg-[#c84f08] disabled:cursor-not-allowed disabled:opacity-50",children:W?"Loading...":`Play S${ue} E${D}`})]}),C&&n.type==="anime"&&!n.animeIsMovie&&o.jsxs("div",{className:"mt-2 rounded-xl border border-white/10 bg-white/5 p-3",children:[o.jsx("p",{className:"text-[11px] font-black uppercase tracking-[0.14em] text-zinc-300",children:"Episode Picker"}),o.jsxs("div",{className:"mt-2 space-y-2",children:[o.jsxs("label",{className:"flex flex-col gap-1 text-[11px] font-semibold text-zinc-300",children:[o.jsx("span",{children:"Episode"}),ke.length>0?o.jsx("select",{value:N,onChange:we=>{const He=Number(we.target.value);j(Ae(He))},className:"rounded-lg border border-white/10 bg-black/45 px-2.5 py-2 text-sm text-white outline-none",children:ke.map(we=>o.jsx("option",{value:we.number,children:`Episode ${we.number}${we.title&&we.title!==`Episode ${we.number}`?` - ${we.title}`:""}`},we.number))}):o.jsx("input",{type:"number",min:1,value:N,onChange:we=>{const He=Number(we.target.value);j(Ae(He))},className:"rounded-lg border border-white/10 bg-black/45 px-2.5 py-2 text-sm text-white outline-none"})]}),o.jsxs("label",{className:"flex items-center gap-2 rounded-lg bg-white/5 px-3 py-2 text-xs text-zinc-200",children:[o.jsx("input",{type:"checkbox",checked:z,onChange:we=>M(we.target.checked)}),"Dub Audio"]})]}),o.jsx("button",{type:"button",onClick:Wt,className:"mt-2 w-full rounded-lg bg-[#E25E0C] px-3 py-2 text-sm font-semibold text-white transition hover:bg-[#c84f08]",children:`Play Episode ${Ae(N)}`})]}),C&&te&&o.jsx("button",{type:"button",onClick:Li,disabled:Z,className:`mt-2 w-full rounded-lg px-3 py-2 text-xs font-semibold transition ${Z?"bg-white/20 text-zinc-300 cursor-not-allowed":"bg-white/10 text-zinc-100"}`,children:Z?"Opening...":"Picture in Picture"}),o.jsx("button",{type:"button",onClick:ge,className:"mt-2 w-full rounded-lg border border-white/15 bg-black/60 px-3 py-2 text-sm font-semibold text-white",children:"Back To Browse"})]})]})})]})})}):null}
66const aS="https://watch-server-production-c01b.up.railway.app/api",Rf={people:[],movies:[],series:[]},oS=n=>n.media_type==="person",lS=n=>n.media_type==="tv"||n.first_air_date!==void 0||n.name!==void 0,kf=n=>!!(n.poster_path||n.backdrop_path),cS=n=>!!n.profile_path,cL=n=>{if(n.sections)return{people:Array.isArray(n.sections.people)?n.sections.people.filter(cS):[],movies:Array.isArray(n.sections.movies)?n.sections.movies.filter(kf):[],series:Array.isArray(n.sections.series)?n.sections.series.filter(kf):[]};const e=Array.isArray(n.results)?n.results:[],t=e.filter(oS).filter(cS),i=e.filter(r=>!oS(r));return{people:t,movies:i.filter(r=>!lS(r)&&kf(r)),series:i.filter(r=>lS(r)&&kf(r))}},uS=[{id:28,name:"Action"},{id:12,name:"Adventure"},{id:16,name:"Animation"},{id:35,name:"Comedy"},{id:80,name:"Crime"},{id:99,name:"Documentary"},{id:18,name:"Drama"},{id:10751,name:"Family"},{id:14,name:"Fantasy"},{id:36,name:"History"},{id:27,name:"Horror"},{id:10402,name:"Music"},{id:9648,name:"Mystery"},{id:10749,name:"Romance"},{id:878,name:"Sci-Fi"},{id:10770,name:"TV Movie"},{id:53,name:"Thriller"},{id:10752,name:"War"},{id:37,name:"Western"}];function uL({isOpen:n,onClose:e}){const[t,i]=Ki(),r=t.get("q")||"",l=t.get("mode")||"normal",[u,h]=E.useState(Rf),[d,p]=E.useState(!1),[m,g]=E.useState(""),[b,y]=E.useState(r),[_,C]=E.useState(null),w=E.useRef(null),[S,T]=E.useState(!1),[N,j]=E.useState(!1),[O,R]=E.useState(!1),[z,M]=E.useState(()=>{const X=t.get("content_types");return X?X.split(","):["movies","series"]}),[P,G]=E.useState(()=>{const X=t.get("genres");return X?X.split(",").map(Number):[]}),[U,Y]=E.useState(()=>{try{const X=t.get("people");return X?JSON.parse(X):[]}catch{return[]}}),[W,J]=E.useState(""),[F,$]=E.useState([]),[V,se]=E.useState(()=>t.get("release_from")||"1990"),[ue,Ce]=E.useState(()=>t.get("release_to")||"2026"),[D,H]=E.useState(()=>{const X=t.get("runtime_min");return X?parseInt(X,10):0}),[Z,Ee]=E.useState(()=>{const X=t.get("runtime_max");return X?parseInt(X,10):240}),[je,le]=E.useState([]),[Se,de]=E.useState([]),Le=(()=>{const X=u.movies.filter(Ae=>{if((Ae.genre_ids||[]).includes(99)){if(!z.includes("documentary"))return!1}else if(!z.includes("movies"))return!1;if(P.length>0){const te=Ae.genre_ids||[];if(!P.some(Ie=>te.includes(Ie)))return!1}const st=parseInt((Ae.release_date||"").substring(0,4));return!(st&&(V&&st<parseInt(V)||ue&&st>parseInt(ue)))}),oe=u.series.filter(Ae=>{if((Ae.genre_ids||[]).includes(99)){if(!z.includes("documentary"))return!1}else if(!z.includes("series"))return!1;if(P.length>0){const te=Ae.genre_ids||[];if(!P.some(Ie=>te.includes(Ie)))return!1}const st=parseInt((Ae.first_air_date||"").substring(0,4));return!(st&&(V&&st<parseInt(V)||ue&&st>parseInt(ue)))}),ke=u.people.filter(Ae=>U.length>0?U.some(De=>
66Ae.name.toLowerCase().includes(De.name.toLowerCase())):!0);return{movies:X,series:oe,people:ke}})(),pe=Le.people.length+Le.movies.length+Le.series.length,We=(()=>{let X=0;return(z.length!==2||!z.includes("movies")||!z.includes("series"))&&X++,P.length>0&&X++,U.length>0&&X++,(V!=="1990"||ue!=="2026")&&X++,(D!==0||Z!==240)&&X++,X})();E.useEffect(()=>{n&&(le(JSON.parse(localStorage.getItem("watchpump_recent")||"[]")),de(JSON.parse(localStorage.getItem("watchpump_saved")||"[]")))},[n]),E.useEffect(()=>{const oe=setTimeout(async()=>{if(W.trim().length<2){$([]);return}try{const st=((await(await fetch(`${aS}/search/multi?query=${encodeURIComponent(W)}`)).json()).results||[]).filter(te=>te.media_type==="person").slice(0,5);$(st)}catch(ke){console.error("Failed to fetch people suggestions:",ke)}},300);return()=>clearTimeout(oe)},[W]),E.useEffect(()=>{if(n){const X=t.get("q")||"";y(X);const oe=t.get("content_types")?t.get("content_types").split(","):["movies","series"];M(oe);const ke=t.get("genres")?t.get("genres").split(",").map(Number):[];G(ke);try{const Ie=t.get("people");Y(Ie?JSON.parse(Ie):[])}catch{Y([])}const Ae=t.get("release_from")||"1990";se(Ae);const De=t.get("release_to")||"2026";Ce(De);const st=t.get("runtime_min")?parseInt(t.get("runtime_min")):0;H(st);const te=t.get("runtime_max")?parseInt(t.get("runtime_max")):240;Ee(te)}},[t,n]);const dt=(X=b)=>{const oe=new URLSearchParams;oe.set("search","true"),X.trim()&&oe.set("q",X.trim()),(z.length!==2||!z.includes("movies")||!z.includes("series"))&&oe.set("content_types",z.join(",")),P.length>0&&oe.set("genres",P.join(",")),U.length>0&&oe.set("people",JSON.stringify(U)),V!=="1990"&&oe.set("release_from",V),ue!=="2026"&&oe.set("release_to",ue),D!==0&&oe.set("runtime_min",D.toString()),Z!==240&&oe.set("runtime_max",Z.toString());const ke=t.get("mode");ke&&oe.set("mode",ke),i(oe);const Ae=oe.toString();if(Ae){const De=[Ae,...je.filter(st=>st!==Ae)].slice(0,5);le(De),localStorage.setItem("watchpump_recent",JSON.stringify(De))}},Ct=X=>{dt(X)},ut=X=>{const oe=new URLSearchParams(t);oe.set("mode",X),i(oe)};E.useEffect(()=>{n?(document.body.style.overflow="hidden",setTimeout(()=>w.current?.focus(),100)):(document.body.style.overflow="unset",h(Rf),g(""),C(null))},[n]),E.useEffect(()=>{(async()=>{const oe=t.get("q")||"",ke=t.get("genres"),Ae=t.get("release_from"),De=t.get("release_to"),st=t.get("runtime_min"),te=t.get("runtime_max"),Ie=t.get("content_types"),Pe=t.get("people"),Ze=ke||Ae||De||st||te||Ie||Pe;if(!oe.trim()&&!Ze){h(Rf),g(""),C(null);return}p(!0),h(Rf),C(null);try{const ze=oe.trim()||" ";let ge=`${aS}/search/multi?query=${encodeURIComponent(ze)}`;ke&&(ge+=`&genres=${ke}`),Ae&&(ge+=`&release_from=${Ae}`),De&&(ge+=`&release_to=${De}`),st&&(ge+=`&runtime_min=${st}`),te&&(ge+=`&runtime_max=${te}`),Ie&&(ge+=`&content_types=${Ie}`),Pe&&(ge+=`&people=${encodeURIComponent(Pe)}`);const pt=await(await fetch(ge)).json();h(cL(pt)),C(pt.selected_person||null),g("")}catch(ze){console.error("Search failed:",ze)}finally{p(!1)}})()},[t]);const kt=X=>{const ke=X.media_type==="tv"||X.first_air_date!==void 0||X.name!==void 0?"tv":"movie",Ae=new URLSearchParams(t);Ae.set("watch",`${ke}-${X.id}`),Ae.delete("free"),i(Ae)},K=X=>{const oe=`person:${X.name}`;y(oe),Ct(oe)},Nt=X=>X?`https://image.tmdb.org/t/p/w500${X}`:"https://via.placeholder.com/500x750?text=No+Image",Tt=_?.known_for?.map(X=>X.title).filter(X=>!!X).slice(0,3)||[],Mt=()=>{M(["movies","series"]),G([]),Y([]),se("1990"),Ce("2026"),H(0),Ee(240),y(""),i(new URLSearchParams)},nt=X=>{z.includes(X)?M(z.filter(oe=>oe!==X)):M([...z,X])},I=X=>{P.includes(X)?G(P.filter(oe=>oe!==X)):G([...P,X])},k=X=>{X.preventDefault(),W.trim()&&!U.some(oe=>oe.name.toLowerCase()===W.trim().toLowerCase())&&(Y([...U,{name:W.trim(),profilePath:null}]),J(""))},Q=X=>{Y(U.filter(oe=>oe.name!==X))},fe=()=>{const X=t.toString();if(X&&!Se.includes(X)){const oe=[X,...Se];de(oe),localStorage.setItem("watchpump_saved",JSON.stringify(oe))}},be=X=>{const oe=new URLSearchParams(X),ke=oe.get("q");if(ke)return ke;const Ae=[],De=oe.get("content_types");De&&Ae.push(De.split(",").map(Ie=>Ie==="movies"?"Movies":Ie==="series"?"TV":"Docs").join("/"));const st=oe.get("genres");if(st){const Ie=st.split(",").map(Pe=>uS.find(Ze=>
66Ze.id===Number(Pe))?.name).filter(Boolean);Ie.length>0&&Ae.push(Ie.join(", "))}const te=oe.get("people");if(te)try{const Ie=JSON.parse(te);Ae.push(Ie.map(Pe=>Pe.name).join(", "))}catch{}return Ae.length>0?`Advanced: ${Ae.join(" | ")}`:"Custom Filter Search"},xe=(X,oe)=>{oe.stopPropagation();const ke=Se.filter(Ae=>Ae!==X);de(ke),localStorage.setItem("watchpump_saved",JSON.stringify(ke))},Xe=(X,oe)=>{oe.stopPropagation();const ke=je.filter(Ae=>Ae!==X);le(ke),localStorage.setItem("watchpump_recent",JSON.stringify(ke))},$e=(X,oe)=>oe.length===0?null:o.jsxs("section",{className:"space-y-4 md:space-y-5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3 px-1",children:[o.jsx("h3",{className:"text-lg md:text-2xl font-semibold text-white tracking-wide",children:X}),o.jsx("span",{className:"text-xs md:text-sm text-zinc-400 uppercase tracking-[0.2em]",children:oe.length})]}),o.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-3 md:gap-6",children:oe.map(ke=>o.jsxs("div",{className:"bg-zinc-900 rounded-xl overflow-hidden cursor-pointer group hover:scale-105 hover:shadow-[0_0_30px_rgba(0,0,0,0.8)] hover:-translate-y-2 transition-all duration-300 relative border border-zinc-800/50",onClick:()=>kt(ke),children:[o.jsx("div",{className:"aspect-[2/3] w-full bg-zinc-800",children:o.jsx("img",{src:Nt(ke.poster_path||ke.backdrop_path),alt:ke.title||ke.name,className:"w-full h-full object-cover"})}),o.jsxs("div",{className:"absolute inset-0 bg-gradient-to-t from-black/90 via-black/40 to-transparent opacity-0 group-hover:opacity-100 transition-opacity hidden md:flex flex-col justify-end p-5",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("button",{className:"w-12 h-12 flex flex-shrink-0 items-center justify-center bg-white rounded-full hover:bg-zinc-200 transition text-black shadow-lg",children:o.jsx(Ts,{className:"w-6 h-6 fill-black ml-1"})}),o.jsx("button",{className:"w-10 h-10 flex flex-shrink-0 items-center justify-center border-2 border-white/50 rounded-full text-white hover:border-white hover:bg-white/20 transition backdrop-blur-sm",children:o.jsx(Od,{className:"w-5 h-5"})})]}),o.jsx("h4",{className:"font-bold text-white text-base leading-tight mb-2 drop-shadow-md",children:ke.title||ke.name}),o.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[ke.vote_average>0&&o.jsxs("span",{className:"text-green-500 drop-shadow",children:[Math.round(ke.vote_average*10),"% Match"]}),o.jsx("span",{className:"text-zinc-300 drop-shadow",children:(ke.release_date||ke.first_air_date||"").substring(0,4)})]})]})]},`${X}-${ke.id}`))})]},X),it=()=>Le.people.length===0?null:o.jsxs("section",{className:"space-y-4 md:space-y-5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3 px-1",children:[o.jsx("h3",{className:"text-lg md:text-2xl font-semibold text-white tracking-wide",children:"People"}),o.jsx("span",{className:"text-xs md:text-sm text-zinc-400 uppercase tracking-[0.2em]",children:Le.people.length})]}),o.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-x-4 gap-y-5 md:gap-x-6 md:gap-y-7",children:Le.people.map(X=>o.jsxs("button",{type:"button",onClick:()=>K(X),className:"group flex flex-col items-center text-center transition-transform duration-300 hover:scale-105",children:[o.jsx("div",{className:"size-24 md:size-28 rounded-full overflow-hidden bg-zinc-800 ring-1 ring-zinc-700/70 transition-all duration-300 group-hover:ring-[#E25E0C]/70 group-hover:shadow-[0_0_24px_rgba(226,94,12,0.25)]",children:o.jsx("img",{src:Nt(X.profile_path||""),alt:X.name,className:"w-full h-full object-cover"})}),o.jsxs("div",{className:"mt-2 space-y-1 px-1",children:[o.jsx("h4",{className:"font-medium text-white text-xs md:text-sm leading-tight line-clamp-2",children:X.name}),o.jsx("p",{className:"text-[11px] md:text-xs text-zinc-500 line-clamp-1",children:X.known_for_department||"Actor"})]})]},X.id))})]}),ht=X=>{X&&X.preventDefault(),Ct(b.trim())};return n?o.jsxs("div",{className:"fixed inset-0 z-[100] bg-zinc-950/95 backdrop-blur-md animate-in fade-in duration-200 flex flex-col items-center p-3 md:p-8 overflow-y-auto",children:[o.jsxs("div",{className:"w-full max-w-5xl mt-4 md:mt-10",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4 px-2",children:[o.jsx("h2",{className:"text-xl md:text-2xl font-bold text-white",children:"Search Movies & TV"}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("button",{type:"button",onClick:Mt,className:"text-sm font-semibold text-orange-400 hover:text-orange-300 transition",children:"Reset"}),o.jsx("button",{type:"button",onClick:e,className:"p-1.5 hover:bg-zinc-800 rounded-full text-zinc-400 hover:text-white transition",title:"Close Search",children:o.jsx(Ar,{className:"w-6 h-6"})})]})]}),o.jsxs("form",{onSubmit:ht,className:"flex items-center gap-2 md:gap-4 py-3 md:py-4 rounded-2xl bg-zinc-900/80 border border-zinc-700/50 shadow-2xl px-3 md:px-6 backdrop-blur-xl",children:[o.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2 md:gap-4 bg-transparent md:border-r border-zinc-700/50 md:mr-2 md:pr-4 focus-within:text-white transition-colors",children:[l==="ai"?o.jsx(pr,{className:"w-5 h-5 md:w-6 md:h-6 text-orange-400"}):o.jsx(_d,{className:"w-5 h-5 md:w-6 md:h-6 text-zinc-400"}),o.jsx("input",{ref:w,type:"text",className:"flex-1 min-w-0 bg-transparent text-base md:text-2xl text-white outline-none placeholder:text-zinc-500 font-medium disabled:opacity-50 disabled:cursor-not-allowed",placeholder:l==="ai"?"Describe what you want to watch...":"Search by title, keyword, people...",value:b,disabled:d,onChange:X=>{y(X.target.value)}}),b&&o.jsx("button",{type:"button",disabled:d,onClick:()=>{y(""),Ct("")},className:"p-1.5 md:p-2 hover:bg-zinc-800 rounded-full transition disabled:opacity-50 disabled:cursor-not-allowed",children:o.jsx(Ar,{className:"w-5 h-5 md:w-6 md:h-6 text-zinc-400"})}),b&&o.jsx("button",{type:"submit",disabled:d,className:"p-2 rounded-full transition text-white shadow-lg disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center w-8 h-8 md:w-9 md:h-9 bg-[#E25E0C] hover:bg-[#
66E25E0C]/80",title:l==="ai"?"Send to AI":"Search",children:d?o.jsx("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}):o.jsx(_d,{className:"w-5 h-5"})})]}),o.jsxs("button",{type:"button",disabled:d,onClick:()=>{ut(l==="normal"?"ai":"normal")},className:`flex items-center gap-2 px-5 py-3 rounded-xl transition-all font-semibold whitespace-nowrap disabled:opacity-50 disabled:cursor-not-allowed ${l==="ai"?"bg-[#E25E0C] border border-[#E25E0C] text-white shadow-[0_0_15px_rgba(226,94,12,0.5)]":"bg-zinc-850 text-zinc-300 hover:bg-zinc-700 hover:text-white"}`,children:[o.jsx(pr,{className:"w-5 h-5"}),o.jsx("span",{className:"hidden lg:inline",children:l==="ai"?"AI Active":"Use AI"})]})]}),o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mt-4 px-2",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[o.jsxs("button",{type:"button",onClick:()=>{T(!S),R(!1),j(!1)},className:`flex items-center gap-2 px-4 py-2 rounded-full border text-sm font-semibold transition ${S?"bg-[#E25E0C]/20 border-[#E25E0C] text-orange-400 shadow-[0_0_15px_rgba(226,94,12,0.15)]":"bg-zinc-900 border-zinc-800 text-zinc-300 hover:bg-zinc-800"}`,children:[o.jsx(o8,{className:"w-4 h-4"}),o.jsx("span",{children:"Advanced"}),We>0&&o.jsx("span",{className:"flex items-center justify-center bg-[#E25E0C] text-white text-xs w-5 h-5 rounded-full font-bold",children:We})]}),o.jsxs("button",{type:"button",onClick:()=>{R(!O),T(!1),j(!1)},className:`flex items-center gap-2 px-4 py-2 rounded-full border text-sm font-semibold transition ${O?"bg-[#E25E0C]/20 border-[#E25E0C] text-orange-400 shadow-[0_0_15px_rgba(226,94,12,0.15)]":"bg-zinc-900 border-zinc-800 text-zinc-300 hover:bg-zinc-800"}`,children:[o.jsx(E3,{className:"w-4 h-4"}),o.jsx("span",{children:"Saved Searches"})]}),o.jsxs("button",{type:"button",onClick:()=>{j(!N),T(!1),R(!1)},className:`flex items-center gap-2 px-4 py-2 rounded-full border text-sm font-semibold transition ${N?"bg-[#E25E0C]/20 border-[#E25E0C] text-orange-400 shadow-[0_0_15px_rgba(226,94,12,0.15)]":"bg-zinc-900 border-zinc-800 text-zinc-300 hover:bg-zinc-800"}`,children:[o.jsx(TR,{className:"w-4 h-4"}),o.jsx("span",{children:"Recent Searches"})]})]}),We>0&&o.jsxs("button",{type:"button",onClick:fe,className:"flex items-center gap-2 px-4 py-2 rounded-full border border-orange-500/80 bg-[#E25E0C]/10 text-orange-400 hover:bg-[#E25E0C]/20 hover:text-orange-300 text-sm font-semibold transition shadow-md ml-auto",title:`Save: ${be(t.toString())}`,children:[o.jsx(E3,{className:"w-4 h-4 fill-current"}),o.jsx("span",{children:"Save Search"})]})]}),O&&o.jsxs("div",{className:"bg-zinc-900 border border-zinc-800 rounded-xl p-4 mt-3 mx-2 animate-in fade-in slide-in-from-top-2 duration-200",children:[o.jsx("h4",{className:"text-xs uppercase tracking-wider text-zinc-500 font-bold mb-2",children:"Saved Searches"}),Se.length===0?o.jsx("p",{className:"text-zinc-500 text-sm",children:"No saved searches yet."}):o.jsx("div",{className:"flex flex-wrap gap-2",children:Se.map(X=>o.jsxs("button",{type:"button",onClick:()=>{i(new URLSearchParams(X)),R(!1)},className:"flex items-center gap-2 bg-zinc-800 hover:bg-zinc-700 text-white px-3 py-1.5 rounded-lg text-sm transition",children:[o.jsx("span",{children:be(X)}),o.jsx("span",{onClick:oe=>xe(X,oe),className:"text-zinc-400 hover:text-red-400 transition ml-1",children:o.jsx(Ar,{className:"w-3.5 h-3.5"})})]},X))})]}),N&&o.jsxs("div",{className:"bg-zinc-900 border border-zinc-800 rounded-xl p-4 mt-3 mx-2 animate-in fade-in slide-in-from-top-2 duration-200",children:[o.jsx("h4",{className:"text-xs uppercase tracking-wider text-zinc-500 font-bold mb-2",children:"Recent Searches"}),je.length===0?o.jsx("p",{className:"text-zinc-500 text-sm",children:"No recent searches yet."}):o.jsx("div",{className:"flex flex-wrap gap-2",children:je.map(X=>o.jsxs("button",{type:"button",onClick:()=>{i(new URLSearchParams(X)),j(!1)},className:"flex items-center gap-2 bg-zinc-800 hover:bg-zinc-700 text-white px-3 py-1.5 rounded-lg text-sm transition",children:[o.jsx("span",{children:be(X)}),o.jsx("span",{onClick:oe=>Xe(X,oe),className:"text-zinc-400 hover:text-red-400 transition ml-1",children:o.jsx(Ar,{className:"w-3.5 h-3.5"})})]},X))})]}),S&&o.jsxs("div",{className:"bg-zinc-900/90 border border-zinc-800/80 rounded-2xl p-4 md:p-6 mt-3 mx-2 space-y-6 animate-in fade-in slide-in-from-top-2 duration-200",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-zinc-300 font-semibold text-sm",children:"Content type"}),o.jsx("button",{type:"button",onClick:()=>M(["movies","series","documentary"]),className:"text-xs font-semibold text-orange-400 hover:underline",children:"Select all"})]}),o.jsx("div",{className:"flex flex-wrap gap-2",children:[{id:"movies",label:"Movies"},{id:"series",label:"TV Shows"},{id:"documentary",label:"Documentary"}].map(X=>{const oe=z.includes(X.id);return o.jsxs("button",{type:"button",onClick:()=>
66nt(X.id),className:`flex items-center gap-2 px-4 py-2 rounded-xl text-sm border font-medium transition ${oe?"bg-[#E25E0C]/20 border-[#E25E0C] text-orange-400":"bg-zinc-950/40 border-zinc-800 text-zinc-400 hover:bg-zinc-800"}`,children:[o.jsx("span",{children:X.label}),oe&&o.jsx(zr,{className:"w-4 h-4 text-orange-400"})]},X.id)})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-zinc-300 font-semibold text-sm",children:"Genres"}),o.jsx("button",{type:"button",onClick:()=>G([]),className:"text-xs font-semibold text-orange-400 hover:underline",children:"Clear all"})]}),o.jsx("div",{className:"flex flex-wrap gap-2",children:uS.map(X=>{const oe=P.includes(X.id);return o.jsxs("button",{type:"button",onClick:()=>I(X.id),className:`flex items-center gap-1.5 px-3.5 py-1.5 rounded-full text-xs border font-medium transition ${oe?"bg-[#E25E0C]/25 border-[#E25E0C] text-orange-400":"bg-zinc-950/40 border-zinc-850 text-zinc-400 hover:bg-zinc-800"}`,children:[o.jsx("span",{children:X.name}),oe&&o.jsx(zr,{className:"w-3.5 h-3.5"})]},X.id)})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("span",{className:"text-zinc-300 font-semibold text-sm block",children:"People"}),o.jsxs("div",{className:"relative max-w-md",children:[o.jsxs("form",{onSubmit:k,className:"flex gap-2",children:[o.jsx("div",{className:"flex-1 relative",children:o.jsx("input",{type:"text",placeholder:"Search actor or director...",value:W,onChange:X=>J(X.target.value),className:"w-full bg-zinc-950/50 border border-zinc-805 rounded-xl px-3 py-2 text-sm text-white outline-none focus:border-[#E25E0C] transition"})}),o.jsxs("button",{type:"submit",className:"bg-[#E25E0C] hover:bg-[#E25E0C]/80 text-white font-semibold text-xs px-4 py-2 rounded-xl transition flex items-center gap-1.5",children:[o.jsx(v8,{className:"w-4 h-4"}),"Add"]})]}),F.length>0&&o.jsx("div",{className:"absolute left-0 right-0 mt-1.5 bg-zinc-900 border border-zinc-800 rounded-xl shadow-2xl z-50 overflow-hidden divide-y divide-zinc-800 max-h-60 overflow-y-auto",children:F.map(X=>o.jsxs("button",{type:"button",onClick:()=>{U.some(oe=>oe.name===X.name)||Y([...U,{id:X.id,name:X.name,profilePath:X.profile_path}]),J(""),$([])},className:"w-full text-left flex items-center gap-3 px-3 py-2 hover:bg-zinc-800 transition",children:[o.jsx("div",{className:"size-8 rounded-full overflow-hidden bg-zinc-855 flex-shrink-0",children:X.profile_path?o.jsx("img",{src:Nt(X.profile_path),alt:X.name,className:"w-full h-full object-cover"}):o.jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-white font-bold bg-[#E25E0C]",children:X.name.charAt(0)})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-white text-sm font-semibold truncate",children:X.name}),o.jsx("p",{className:"text-zinc-400 text-xs truncate",children:X.known_for_department||"Actor"})]})]},X.id))})]}),U.length>0&&o.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:U.map(X=>o.jsxs("span",{className:"flex items-center gap-1.5 bg-orange-950/20 border border-orange-900/60 text-orange-400 pl-1.5 pr-3 py-1 rounded-full text-xs",children:[o.jsx("div",{className:"size-5 rounded-full overflow-hidden bg-zinc-800 flex-shrink-0",children:X.profilePath?o.jsx("img",{src:Nt(X.profilePath),alt:X.name,className:"w-full h-full object-cover"}):o.jsx("div",{className:"w-full h-full flex items-center justify-center text-[8px] text-white font-bold bg-[#E25E0C]",children:X.name.charAt(0)})}),o.jsx("span",{children:X.name}),o.jsx("button",{type:"button",onClick:()=>Q(X.name),className:"hover:text-red-400 transition ml-0.5",children:o.jsx(Ar,{className:"w-3.5 h-3.5"})})]},X.name))})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 pt-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("span",{className:"text-zinc-300 font-semibold text-sm block",children:"Release year"}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("div",{className:"flex-1",children:[o.jsx("label",{className:"text-[11px] text-zinc-500 block mb-1",children:"From"}),o.jsx("select",{value:V,onChange:X=>se(X.target.value),className:"w-full bg-zinc-950/50 border border-zinc-800 text-sm text-white rounded-xl p-2.5 outline-none focus:border-[#
66E25E0C]",children:["1970","1980","1990","2000","2010","2015","2020","2024","2026"].map(X=>o.jsx("option",{value:X,className:"bg-zinc-900",children:X},X))})]}),o.jsxs("div",{className:"flex-1",children:[o.jsx("label",{className:"text-[11px] text-zinc-500 block mb-1",children:"To"}),o.jsx("select",{value:ue,onChange:X=>Ce(X.target.value),className:"w-full bg-zinc-950/50 border border-zinc-800 text-sm text-white rounded-xl p-2.5 outline-none focus:border-[#E25E0C]",children:["1990","2000","2010","2015","2020","2024","2026"].map(X=>o.jsx("option",{value:X,className:"bg-zinc-900",children:X},X))})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-zinc-300 font-semibold text-sm",children:"Runtime"}),o.jsxs("span",{className:"text-xs text-orange-400 font-semibold",children:[D===0?"Any":`${D}m`," - ",Z===240?"Any":`${Z}m`]})]}),o.jsxs("div",{className:"relative w-full h-6 flex items-center",children:[o.jsx("div",{className:"absolute left-0 right-0 h-1 bg-zinc-850 rounded-lg pointer-events-none"}),o.jsx("div",{className:"absolute h-1 bg-[#E25E0C] rounded-lg pointer-events-none",style:{left:`${D/240*100}%`,right:`${100-Z/240*100}%`}}),o.jsx("input",{type:"range",min:"0",max:"240",step:"10",value:D,onChange:X=>{const oe=Math.min(parseInt(X.target.value),Z-10);H(oe)},className:"absolute w-full h-1 appearance-none bg-transparent pointer-events-none accent-[#E25E0C] [&::-webkit-slider-thumb]:pointer-events-auto [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-white [&::-webkit-slider-thumb]:cursor-pointer [&::-moz-range-thumb]:pointer-events-auto [&::-moz-range-thumb]:w-4 [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:bg-white [&::-moz-range-thumb]:border-none [&::-moz-range-thumb]:cursor-pointer"}),o.jsx("input",{type:"range",min:"0",max:"240",step:"10",value:Z,onChange:X=>{const oe=Math.max(parseInt(X.target.value),D+10);Ee(oe)},className:"absolute w-full h-1 appearance-none bg-transparent pointer-events-none accent-[#E25E0C] [&::-webkit-slider-thumb]:pointer-events-auto [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-white [&::-webkit-slider-thumb]:cursor-pointer [&::-moz-range-thumb]:pointer-events-auto [&::-moz-range-thumb]:w-4 [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:bg-white [&::-moz-range-thumb]:border-none [&::-moz-range-thumb]:cursor-pointer"})]})]})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t border-zinc-850",children:o.jsxs("button",{type:"button",onClick:()=>{dt(b),T(!1)},className:"w-full md:w-auto bg-[#E25E0C] hover:bg-[#E25E0C]/80 text-white font-bold px-8 py-3.5 rounded-xl transition shadow-lg flex items-center justify-center gap-2",children:[o.jsx(_d,{className:"w-5 h-5"}),o.jsxs("span",{children:["Search (",pe," results)"]})]})})]})]}),o.jsxs("div",{className:"w-full max-w-7xl flex-1 mt-6 md:mt-8 overflow-y-auto scrollbar-hide pb-20 px-1 md:px-2",children:[d&&pe===0&&o.jsx("div",{className:"flex justify-center mt-32",children:o.jsx("div",{className:"w-16 h-16 border-4 border-orange-500 border-t-transparent rounded-full animate-spin"})}),m&&o.jsxs("div",{className:"mb-8 text-lg md:text-2xl font-medium text-orange-400 flex items-center justify-center gap-2 md:gap-3 drop-shadow-md text-center px-2",children:[o.jsx(pr,{className:"w-6 h-6 md:w-8 md:h-8"}),m]}),!d&&_&&o.jsx("div",{className:"mb-6 md:mb-8 rounded-2xl border border-zinc-880 bg-zinc-900/75 p-4 md:p-5 text-zinc-200 shadow-[0_18px_50px_rgba(0,0,0,0.28)]",children:o.jsxs("div",{className:"flex items-center gap-3 md:gap-4",children:[_.profile_path?o.jsx("img",{src:Nt(_.profile_path),alt:_.name,className:"size-18 md:size-32 rounded-full object-cover ring-1 ring-zinc-705/80"}):o.jsx("div",{className:"size-18 md:size-32 rounded-full bg-zinc-800 ring-1 ring-zinc-705/80 flex items-center justify-center text-xl md:text-2xl font-semibold text-white",children:_.name.charAt(0).toUpperCase()}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold text-white truncate",children:_.name}),o.jsx("span",{className:"text-xs uppercase tracking-[0.18em] text-zinc-500",children:_.known_for_department||"Actor"})]}),o.jsx("p",{className:"mt-1 text-sm text-zinc-300",children:"Showing movies and series connected to this person."}),Tt.length>0&&o.jsxs("p",{className:"mt-1 text-xs md:text-sm text-zinc-400 line-clamp-2",children:["Known for: ",Tt.join(" ⢠")]})]})]})}),!d&&r&&pe===0&&o.jsxs("div",{className:"text-center mt-20 md:mt-32 text-zinc-400 text-base md:text-2xl font-medium px-3",children:['No results found for "',r,'"']})," ",o.jsxs("div",{className:"space-y-8 md:space-y-10 pt-4",children:[it(),$e("Titles",[...Le.movies,...Le.series].sort((X,oe)=>(oe.popularity||0)-(X.popularity||0)))]})]})]}):null}const dL=24,hL=12;function fL(n){return(Math.max(0,Number(n||0))/3600).toLocaleStr
66ing(void 0,{minimumFractionDigits:1,maximumFractionDigits:1})}function pL(n){return n?`#${n.toLocaleString()}`:"Unranked"}function mL(n){return n?n===1?"bg-gradient-to-r from-amber-300 to-yellow-500 bg-clip-text text-transparent":n===2?"bg-gradient-to-r from-zinc-300 to-zinc-400 bg-clip-text text-transparent":n===3?"bg-gradient-to-r from-orange-400 to-amber-700 bg-clip-text text-transparent":n<=10?"bg-gradient-to-r from-amber-400 to-orange-500 bg-clip-text text-transparent":n<=100?"bg-gradient-to-r from-orange-300 to-amber-500 bg-clip-text text-transparent":"text-white":"text-zinc-500"}function dS(n){return n>=100?"Legendary":n>=50?"Elite Curator":n>=40?"Veteran Watcher":n>=30?"Dedicated Viewer":n>=20?"Enthusiast":n>=10?"Regular":"Newcomer"}function R5({profile:n,isLoading:e,error:t,onClose:i,mode:r="overlay",canEditAvatar:l=!1,isAvatarUploading:u=!1,onAvatarUpload:h}){const[d,p]=E.useState("movies"),[m,g]=Ki(),b=(w,S,T)=>{const N=new URLSearchParams(m);T?N.set("watch",T):N.set("watch",`${w||"movie"}-${S}`),N.delete("free"),g(N),i()},y=E.useMemo(()=>{if(!n?.activity?.top_watched)return[];const w=n.activity.top_watched[d]||[],S=d==="unlocks"?hL:dL;return w.slice(0,S)},[n?.activity?.top_watched,d]);if(!e&&!t&&!n)return null;const _=r==="overlay",C=Yc({avatarUrl:n?.avatar_url,username:n?.username,displayName:n?.display_name,userId:n?.user_id,fallbackSeed:"viewer"});return o.jsx("div",{className:_?"fixed inset-0 z-[300] flex items-center justify-center bg-zinc-950/80 px-4 py-6 backdrop-blur-md transition-all duration-300 animate-fade-in":"w-full animate-fade-in",onClick:_?i:void 0,children:o.jsxs("div",{className:_?"relative max-h-[92vh] w-full max-w-5xl overflow-y-auto rounded-[2rem] border border-white/10 bg-[#0a0a0a] text-zinc-100 shadow-[0_0_80px_rgba(0,0,0,0.8)] animate-slide-up":"relative w-full rounded-[2rem] border border-white/10 bg-[#0a0a0a] text-zinc-100 shadow-[0_20px_80px_-45px_rgba(0,0,0,0.9)]",onClick:_?w=>w.stopPropagation():void 0,children:[o.jsx("div",{className:"absolute top-0 right-0 h-[300px] w-[500px] bg-[radial-gradient(ellipse_at_center,rgba(249,115,22,0.1)_0%,rgba(0,0,0,0)_70%)] pointer-events-none"}),_&&o.jsx("button",{type:"button",onClick:i,className:"absolute right-6 top-6 z-10 inline-flex h-10 w-10 items-center justify-center rounded-full bg-white/5 text-zinc-400 backdrop-blur-md transition hover:bg-white/10 hover:text-white","aria-label":"Close profile",children:o.jsx(Ar,{className:"h-5 w-5"})}),e&&!n?o.jsx("div",{className:"flex min-h-[400px] items-center justify-center animate-fade-in",children:o.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 text-zinc-400",children:[o.jsx(p1,{className:"h-8 w-8 animate-pulse text-orange-500"}),o.jsx("p",{className:"text-lg font-medium",children:"Loading profile data..."})]})}):t?o.jsx("div",{className:"flex min-h-[400px] items-center justify-center px-6 animate-fade-in",children:o.jsx("div",{className:"rounded-2xl border border-red-500/20 bg-red-500/10 p-6 text-center text-red-400",children:o.jsx("p",{className:"text-lg font-semibold",children:t})})}):n?o.jsxs("div",{className:"p-6 md:p-10",children:[o.jsxs("div",{className:"flex flex-col gap-6 sm:flex-row sm:items-center animate-slide-up",style:{animationDelay:"50ms"},children:[o.jsxs("div",{className:"relative shrink-0",children:[o.jsx("div",{className:"h-28 w-28 overflow-hidden rounded-3xl border-2 border-white/10 bg-zinc-900 shadow-xl",children:o.jsx("img",{src:C,alt:"",className:"h-full w-full object-cover"})}),l&&h&&o.jsxs("label",{className:"absolute -top-2 -right-2 inline-flex h-9 w-9 cursor-pointer items-center justify-center rounded-full border border-white/30 bg-zinc-950/90 text-zinc-100 shadow-lg transition hover:scale-105 hover:border-orange-400 hover:text-orange-300",children:[o.jsx(Y6,{className:"h-4 w-4"}),o.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:h,disabled:u})]}),o.jsxs("div",{className:"absolute -bottom-3 -right-3 rounded-xl bg-gradient-to-r from-orange-600 to-amber-500 px-3 py-1 text-xs font-black tracking-wider text-white shadow-lg border border-white/20",children:["LVL ",n.level]})]}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("h2",{className:"text-3xl font-extrabold tracking-tight text-white md:text-4xl",children:n.username?`@${n.username}`:n.display_name}),o.jsxs("p",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[o.jsxs("span",{className:"flex items-center gap-1.5 font-medium text-amber-500",children:[o.jsx(dl,{className:"h-3.5 w-3.5 fill-amber-500"}),dS(n.level)]}),n.username&&o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"â¢"}),o.jsx("span",{children:n.display_name})]})]}),e&&o.jsx("p",{className:"mt-1 text-xs font-medium text-orange-400",children:"Refreshing details..."})]})]}),o.jsxs("div",{className:"mt-10 grid gap-4 lg:grid-cols-3 animate-slide-up",style:{animationDelay:"100ms"},children:[o.jsxs("div",{className:"flex flex-col justify-between rounded-[24px] border border-white/5 bg-white/[0.02] p-6 lg:col-span-2",children:[o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-bold uppercase tracking-[0.15em] text-zinc-500",children:"Current Standing"}),o.jsx("p",{className:"mt-1 text-2xl font-bold text-white",children:dS(n.level)})]}),o.jsxs("div",{className:"text-right",children:[o.jsxs("p",{className:"text-xl font-bold text-orange-400",children:[n.level_progress_percent,"%"]}),o.jsxs("p",{className:"text-[10px] font-bold uppercase tracking-wider text-zinc-500",children:["To Level ",n.level+1]})]})]}),o.jsxs("div",{className:"mt-6",children:[o.jsx("div",{className:"h-3 w-full overflow-hidden rounded-full bg-white/5 border border-white/10",children:o.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-amber-500 via-orange-500 to-red-500",style:{width:`${Math.max(0,Math.min(100,n.level_progress_percent))}%`}})}),o.jsx("div",{className:"mt-2 flex items-center justify-between text-xs text-zinc-500 font-medium tracking-wide",children:o.jsxs("span",{children:[n.total_xp.toLocaleStr
66ing()," XP EARNED"]})})]})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center rounded-[24px] border border-white/5 bg-white/[0.02] p-6 text-center",children:[o.jsx("div",{className:"mb-3 rounded-full bg-orange-500/20 p-3",children:o.jsx(dl,{className:"h-6 w-6 text-orange-400 fill-orange-400"})}),o.jsx("h3",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-zinc-500",children:"Total XP"}),o.jsx("p",{className:"mt-1 text-3xl font-black tracking-tight text-white",children:n.total_xp.toLocaleString()})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center rounded-[24px] border border-white/5 bg-white/[0.02] p-6 text-center",children:[o.jsx("div",{className:"mb-3 rounded-full bg-orange-500/20 p-3",children:o.jsx(J6,{className:"h-6 w-6 text-orange-400"})}),o.jsx("h3",{className:"text-[14px] font-bold uppercase tracking-[0.2em] text-zinc-500",children:"Watch Time"}),o.jsxs("p",{className:"mt-1 flex items-baseline justify-center gap-1",children:[o.jsx("span",{className:"text-5xl font-black tracking-tight text-white",children:fL(n.total_watch_seconds)}),o.jsx("span",{className:"text-sm font-semibold text-zinc-500",children:"hrs"})]})]}),o.jsxs("div",{className:"flex flex-col md:flex-row gap-6 rounded-[24px] border border-white/5 bg-white/[0.02] p-6 lg:col-span-2",children:[o.jsxs("div",{className:"flex-1 shrink-0",children:[o.jsx("h3",{className:"mb-4 text-[10px] font-bold uppercase tracking-[0.2em] text-zinc-500",children:"Content Stats"}),o.jsxs("div",{className:"flex flex-col sm:flex-row flex-wrap gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-orange-500/5 px-3 py-2 border border-orange-500/10 text-orange-200",children:[o.jsx(Pc,{className:"h-4 w-4 text-orange-400"}),o.jsxs("span",{className:"text-sm font-semibold",children:[n.movies_completed.toLocaleString()," ",o.jsx("span",{className:"text-orange-200/50 font-normal",children:"Movies"})]})]}),o.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-orange-500/5 px-3 py-2 border border-orange-500/10 text-orange-200",children:[o.jsx(wo,{className:"h-4 w-4 text-orange-400"}),o.jsxs("span",{className:"text-sm font-semibold",children:[n.series_episodes_completed.toLocaleString()," ",o.jsx("span",{className:"text-orange-200/50 font-normal",children:"Episodes"})]})]}),o.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-orange-500/5 px-3 py-2 border border-orange-500/10 text-orange-200",children:[o.jsx(pr,{className:"h-4 w-4 text-orange-400"}),o.jsxs("span",{className:"text-sm font-semibold",children:[n.anime_titles_started.toLocaleString()," ",o.jsx("span",{className:"text-orange-200/50 font-normal",children:"Anime"})]})]})]})]}),o.jsx("div",{className:"w-px bg-white/5 hidden md:block"}),o.jsx("div",{className:"h-px bg-white/5 block md:hidden"}),o.jsxs("div",{className:"flex-[2] min-w-0",children:[o.jsxs("h3",{className:"mb-4 text-[10px] font-bold uppercase tracking-[0.2em] text-zinc-500 flex items-center justify-between",children:["Currently Watching",n.activity?.currently_watching&&o.jsxs("span",{className:"flex items-center gap-1.5 text-orange-400 bg-orange-400/10 px-2 py-0.5 rounded-md",children:[o.jsxs("span",{className:"relative flex h-2 w-2",children:[o.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-orange-400 opacity-75"}),o.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-orange-500"})]}),"Live"]})]}),n.activity?.currently_watching?o.jsxs("button",{type:"button",onClick:()=>b(n.activity.currently_watching.content_type,n.activity.currently_watching.content_id,n.activity.currently_watching.watch_param),className:"group flex flex-col items-center gap-4 w-full text-left transition hover:bg-white/[0.03] p-3 -m-3 rounded-2xl cursor-pointer",children:[o.jsx("div",{className:"flex h-14 w-14 sm:h-28 sm:w-full shrink-0 overflow-hidden items-center justify-center rounded-xl bg-zinc-900 border border-white/10 text-zinc-700 shadow-lg group-hover:border-orange-500/50 group-hover:shadow-[0_0_20px_rgba(249,115,22,0.2)] transition-all",children:n.activity.currently_watching.image_url?o.jsx("img",{src:n.activity.currently_watching.image_url,alt:"",className:"h-full w-full object-cover"}):o.jsx(Z6,{className:"h-6 w-6 sm:h-8 sm:w-8"})}),o.jsxs("div",{className:"flex-1 w-full",children:[o.jsx("h4",{className:"truncate text-sm sm:text-base font-bold text-white",children:n.activity.currently_watching.title||"Watching now"}),o.jsx("div",{className:"mt-2 h-1.5 w-full overflow-hidden rounded-full bg-white/10 relative",children:o.jsx("div",{className:"h-full w-full rounded-full bg-gradient-to-r from-orange-600/40 via-orange-400 to-orange-600/40 animate-pulse"})}),o.jsxs("p",{className:"truncate text-[10px] sm:text-xs text-zinc-400 mt-1.5 group-hover:text-orange-300 transition-colors",children:[n.activity.currently_watching.watched_minutes.toLocaleStr
66ing()," min session"]})]})]}):o.jsx("div",{className:"flex h-[56px] sm:h-[64px] items-center justify-center rounded-xl border border-white/5 border-dashed",children:o.jsx("p",{className:"text-xs font-medium text-zinc-600",children:"No active sessions"})})]})]})]}),o.jsxs("div",{className:"mt-10 animate-slide-up",style:{animationDelay:"150ms"},children:[o.jsx("h3",{className:"text-xl font-bold text-white mb-6",children:"Global Rankings"}),o.jsx("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-5",children:[{label:"Overall",icon:n5,rank:n.ranks.overall},{label:"Movies",icon:Pc,rank:n.ranks.movies},{label:"Series",icon:wo,rank:n.ranks.series},{label:"Anime",icon:pr,rank:n.ranks.anime},{label:"Unlocks",icon:OR,rank:n.ranks.unlocks}].map(w=>o.jsxs("div",{className:"flex flex-col rounded-[24px] border border-white/5 bg-white/[0.02] p-5 transition hover:bg-white/[0.04]",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-zinc-500",children:w.label}),o.jsx(w.icon,{className:"h-4 w-4 text-zinc-600"})]}),o.jsx("p",{className:"text-xs font-semibold text-zinc-500 mb-1",children:"RANK"}),w.rank&&o.jsx("p",{className:`text-2xl font-black tracking-tighter ${mL(w.rank)}`,children:pL(w.rank)})]},w.label))})]}),o.jsxs("div",{className:"mt-10 animate-slide-up",style:{animationDelay:"200ms"},children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between mb-6 gap-4",children:[o.jsx("h3",{className:"text-xl font-bold text-white",children:d==="unlocks"?"Recent Unlocks":"Top Watched"}),o.jsx("div",{className:"flex gap-1 rounded-lg bg-white/5 p-1 w-fit",children:["movies","series","anime","unlocks"].map(w=>o.jsx("button",{onClick:()=>p(w),className:`rounded-md px-4 py-1.5 text-[11px] font-bold uppercase tracking-wider transition ${d===w?"bg-orange-500 text-white shadow-[0_0_15px_rgba(249,115,22,0.3)]":"text-zinc-500 hover:text-white"}`,children:w},w))})]}),o.jsx("div",{className:"grid gap-3 lg:grid-cols-3",children:y.length>0?y.map((w,S)=>o.jsxs("button",{type:"button",onClick:()=>b(w.content_type,w.content_id,w.watch_param),className:"group flex items-center gap-4 roun
66ded-[20px] border border-white/5 bg-white/[0.02] p-4 transition hover:bg-white/[0.06] hover:border-orange-500/30 text-left cursor-pointer",children:[o.jsx("span",{className:"text-2xl font-black text-white/10 italic group-hover:text-orange-500/30 transition-colors",children:(S+1).toString().padStart(2,"0")}),o.jsx("div",{className:"h-12 w-12 shrink-0 rounded-lg bg-zinc-900 border border-white/10 overflow-hidden flex items-center justify-center group-hover:border-orange-500/50 group-hover:shadow-[0_0_15px_rgba(249,115,22,0.2)] transition-all",children:w.image_url?o.jsx("img",{src:w.image_url,alt:"",className:"h-full w-full object-cover"}):o.jsx(p1,{className:"h-5 w-5 text-zinc-700"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h4",{className:"truncate text-sm font-bold text-white",children:w.title||"Untitled"}),d==="unlocks"?o.jsx("p",{className:"text-xs font-semibold text-orange-400 mt-0.5",children:"Unlocked"}):o.jsxs("p",{className:"text-xs font-semibold text-orange-400 mt-0.5",children:[w.watched_minutes?.toLocaleString()||0," min watched"]})]}),S===0&&d!=="unlocks"&&o.jsx("div",{className:"shrink-0",children:o.jsx("span",{className:"rounded-full border border-amber-500/30 bg-amber-500/10 px-2 py-1 text-[9px] font-bold uppercase tracking-wider text-amber-500",children:"MVP"})})]},`${d}-${w.content_id}-${S}`)):o.jsx("div",{className:"col-span-3 flex h-[80px] items-center justify-center rounded-[20px] border border-white/5 bg-white/[0.02] border-dashed",children:o.jsxs("p",{className:"text-sm font-medium text-zinc-600",children:["No ",d," data yet"]})})})]})]}):null]})})}function gL({announcement:n,isOpen:e,onConfirm:t}){if(!e||!n)return null;const i=n.cta_label?.trim()||"Okay",r=n.action_label?.trim()||"",l=n.action_url?.trim()||"",u=!!(r&&l),h=/^(https?:)?\/\//i.test(l);return o.jsx("div",{className:"fixed inset-0 z-230 flex items-center justify-center bg-black/80 p-4 backdrop-blur-md animate-in fade-in duration-300",role:"dialog","aria-modal":"true","aria-labelledby":"app-announcement-title",children:o.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-2xl border border-white/10 bg-zinc-950 shadow-2xl animate-in zoom-in-95 duration-300",children:[n.image_url&&o.jsxs("div",{className:"relative h-48 w-full bg-zinc-900 sm:h-56",children:[o.jsx("div",{className:"absolute inset-0 z-10 bg-linear-to-t from-zinc-950 to-transparent"}),o.jsx("img",{src:n.image_url,alt:n.title,className:"h-full w-full object-cover",loading:"lazy"})]}),o.jsxs("div",{className:"p-6 sm:p-8",children:[o.jsx("p",{className:"text-xs font-bold uppercase tracking-widest text-orange-500",children:"Announcement"}),o.jsx("h2",{id:"app-announcement-title",className:"mt-2 text-2xl font-bold tracking-tight text-white sm:text-3xl",children:n.title}),o.jsx("p",{className:"mt-3 whitespace-pre-line text-base leading-relaxed text-zinc-400",children:n.message}),o.jsxs("div",{className:"mt-8 grid gap-3 sm:grid-cols-2",children:[u&&o.jsx("a",{href:l,target:h?"_blank":void 0,rel:h?"noreferrer noopener":void 0,onClick:t,className:"inline-flex w-full items-center justify-center rounded-xl border border-orange-500/40 bg-zinc-900 py-3.5 text-sm font-semibold text-orange-300 shadow-md transition-all hover:border-orange-400 hover:text-orange-200 active:scale-[0.98] focus:outline-none focus:ring-2 focus:ring-orange-500 focus:ring-offset-2 focus:ring-offset-zinc-950",children:r}),o.jsx("button",{type:"button",onClick:t,className:`w-full rounded-xl bg-orange-500 py-3.5 text-sm font-semibold text-white shadow-md transition-all hover:bg-orange-400 active:scale-[0.98] focus:outline-none focus:ring-2 focus:ring-orange-500 focus:ring-offset-2 focus:ring-offset-zinc-950 ${u?"":"sm:col-span-2"}`,autoFocus:!0,children:i})]})]})]})})}function Qd({featuredMovies:n,currentHeroIndex:e,setCurrentHeroIndex:t,onPlay:i,isPlayerOpen:r}){const[l,u]=Ki();if(n.length===0)return null;const h=p=>{const m=p.type==="tv"?"tv":"movie",g=new URLSearchParams(l);g.set("watch",`${m}-${p.id}`),g.delete("free"),u(g)},d=p=>{i({type:p.type,id:p.id,title:p.title})};return E.useEffect(()=>{if(n.length<=1)return;const p=window.setInterval(()=>{const m=(e+1)%n.length;t(m)},3e4);return()=>window.clearInterval(p)},[e,n.length,t]),o.jsxs("div",{className:"relative h-[80vh] min-h-[520px] md:h-[95vh] w-full mb-4 overflow-hidden",children:[n.map((p,m)=>{const g=m===e;return o.jsxs("div",{className:`absolute inset-0 transition-opacity duration-1000 ease-in-out ${g?"opacity-100 z-10":"opacity-0 z-0"}`,children:[o.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[o.jsx("img",{src:p.image,alt:p.title,className:`w-full h-full object-cover transition-transform duration-1000 ease-in-out ${r&&g?"scale-125":"scale-100"}`}),o.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-zinc-950 via-zinc-950/60 to-transparent"}),o.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-zinc-950 via-trans
66parent to-transparent"})]}),o.jsxs("div",{className:"relative h-full flex flex-col justify-end md:justify-center px-4 md:px-12 pb-20 md:pb-0 pt-24 md:pt-20 max-w-3xl",children:[p.logoUrl?o.jsx("img",{src:p.logoUrl,alt:p.title,className:"w-auto max-w-[85%] md:max-w-[60%] max-h-[120px] md:max-h-[200px] object-contain mb-4 drop-shadow-lg"}):o.jsx("h2",{className:"text-3xl sm:text-4xl md:text-7xl font-bold mb-4 drop-shadow-lg leading-tight",children:p.title}),o.jsxs("div",{className:"flex items-center gap-2 md:gap-4 text-xs md:text-sm font-semibold mb-4 md:mb-6 text-zinc-300 flex-wrap",children:[o.jsx("span",{children:p.year}),o.jsx("span",{className:"border border-zinc-600 px-1 rounded",children:p.rating}),p.duration?o.jsx("span",{children:p.duration}):null,o.jsx("span",{className:"border border-zinc-600 px-1 rounded text-xs",children:p.quality})]}),o.jsx("p",{className:"text-sm sm:text-base md:text-xl text-zinc-300 mb-6 md:mb-8 line-clamp-3 drop-shadow-md max-w-2xl",children:p.description}),o.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[o.jsxs("button",{className:"flex items-center gap-2 bg-white text-black px-5 py-2.5 md:px-6 md:py-3 rounded font-bold hover:bg-zinc-200 transition text-sm md:text-base",onClick:()=>d(p),children:[o.jsx(Ts,{className:"w-5 h-5 md:w-6 md:h-6 fill-black"}),"Play"]}),o.jsxs("button",{onClick:()=>h(p),className:"flex items-center gap-2 bg-zinc-500/50 text-white px-5 py-2.5 md:px-6 md:py-3 rounded font-bold hover:bg-zinc-500/70 transition backdrop-blur-sm text-sm md:text-base",children:[o.jsx(kR,{className:"w-5 h-5 md:w-6 md:h-6"}),"More Info"]})]})]})]},p.id)}),o.jsx("div",{className:"absolute bottom-4 md:bottom-32 left-4 md:left-12 z-20 flex gap-2",children:n.map((p,m)=>o.jsx("button",{onClick:()=>t(m),className:`h-1 rounded-full transition-all duration-300 ${m===e?"w-8 bg-white":"w-4 bg-zinc-500 hover:bg-zinc-400"}`,"aria-label":`Go to slide ${m+1}`},m))})]})}const xL="https://watch-server-production-c01b.up.railway.app/api";function Ed(n){return`${n.first_air_date!==void 0||n.name!==void 0||n.media_type==="tv"?"tv":"movie"}:${n.id}`}async function Kc(n,e){const t=Array.from(new Set(n.map(Ed))).slice(0,10);if(t.length===0)return[];const i=await fetch(`${xL}/media/artwork?items=${encodeURIComponent(t.join(","))}`,{signal:e});if(!i.ok)throw new Error(`Artwork request failed (${i.status})`);const r=await i.json();return Array.isArray(r.results)?r.results:[]}function Zc(n,e){const t=new Map(e.map(i=>[i.key,i]));return n.map(i=>{const r=t.get(Ed(i));return r?{...i,logoUrl:r.logoUrl}:i})}const ox="https://watch-server-production-c01b.up.railway.app/api",bL="watchpump:last-row-context";function ur({title:n,movies:e=[],endpoint:t,showViewAll:i=!1,onMovieClick:r}){const[l,u]=Ki(),[h,d]=E.useState(e),[p,m]=E.useState(1),[g,b]=E.useState(!1),[y,_]=E.useState(!1),[C,w]=E.useState(!1),[S,T]=E.useState(!1),[N,j]=E.useState(null),[O,R]=E.useState(null),[z,M]=E.useState(!1),[P,G]=E.useState(!1),[U,Y]=E.useState(!1),[W,J]=E.useState(!1),[F,$]=E.useState(!1),V=E.useRef(null),se=E.useRef(null),ue=E.useRef(null),Ce=E.useRef(null),D=E.useRef(null),H=E.useRef(new Set),Z=I=>`${I.first_air_date!==void 0||I.name!==void 0||I.media_type==="tv"?"tv":"movie"}-${I.id}`,Ee=h.map(I=>Ed(I)).join(",");E.useEffect(()=>{e.length>0&&(d(e),m(1),_(!1))},[e]),E.useEffect(()=>{const I=new IntersectionObserver(([k])=>{k.isIntersecting&&($(!0),I.disconnect())},{threshold:.1});return V.current&&I.observe(V.current),()=>I.disconnect()},[]),E.useEffect(()=>{const I=window.matchMedia("(hover: hover) and (pointer: fine)"),k=()=>{J(I.matches)};return k(),I.addEventListener("change",k),()=>I.removeEventListener("change",k)},[]),E.useEffect(()=>{const I=async()=>{if(t){b(!0);try{const Q=await(await fetch(`${ox}${t}?page=1`)).json(),fe=Array.isArray(Q.results)?Q.results:[];d(fe),m(1),_(Se(Q,1))}catch(k){console.error("Failed to fetch initial movies",k)}finally{b(!1)}}};F&&h.length===0&&t&&I()},[F,t]),E.useEffect(()=>{if(!F||h.length===0)return;const I=new AbortController,k=h.filter(fe=>{const be=Ed(fe);return!fe.logoUrl&&!H.current.has(be)});return k.length===0?()=>I.abort():(k.forEach(fe=>H.current.add(Ed(fe))),(async()=>{for(let fe=0;fe<k.length;fe+=10){if(I.signal.aborted)return;const be=k.slice(fe,fe+10);try{const xe=await Kc(be,I.signal);d(Xe=>Zc(Xe,xe))}catch(xe){I.signal.aborted||console.warn("Failed to restore row logos:",xe)}}})(),()=>I.abort())},[Ee,F]);const je=()=>{se.current&&G(se.current.scrollLeft>0)};E.useEffect(()=>{const I=se.current;if(I)return I.addEventListener("scroll",je),()=>I.removeEventListener("scroll",je)},[]);const le=I=>I.filter((k,Q,fe)=>Q===fe.findIndex(be=>Z(be)===Z(k))),Se=(I,k)=>typeof I.pageInfo?.hasNextPage=="boolean"?I.pageInfo.hasNextPage:typeof I.pageInfo?.lastPage=="number"?(typeof I.pageInfo.currentPage=="number"?I.pageInfo.currentPage:k)<I.pageInfo.lastPage:typeof I.total_pages=="number"?(typeof I.page=="number"?I.page:k)<I.total_pages:!1,de=(I,k)=>{const Q=new Set(I.map(fe=>Z(fe)));return le(k).filter(fe=>!Q.has(Z(fe)))},Me=async()=>
66{if(!(!t||g||!y)){b(!0);try{const I=p+1,Q=await(await fetch(`${ox}${t}?page=${I}`)).json(),fe=Array.isArray(Q.results)?Q.results:[];if(fe.length===0){_(!1);return}const be=de(h,fe);if(be.length===0){_(!1);return}d(xe=>[...xe,...be]),m(I),_(Se(Q,I))}catch(I){console.error("Failed to fetch more movies",I)}finally{b(!1)}}},Le=async()=>{if(!(!t||g||S||!y)){T(!0),b(!0);try{let I=p+1;const k=[],Q=new Set(h.map(be=>Z(be)));let fe=!0;for(;fe;){const xe=await(await fetch(`${ox}${t}?page=${I}`)).json(),Xe=Array.isArray(xe.results)?xe.results:[];if(Xe.length===0){fe=!1;break}const $e=le(Xe).filter(it=>{const ht=Z(it);return Q.has(ht)?!1:(Q.add(ht),!0)});if($e.length===0){fe=!1;break}k.push(...$e),fe=Se(xe,I),I+=1}k.length>0&&(d(be=>[...be,...k]),m(I-1)),_(fe)}catch(I){console.error("Failed to fetch all movies",I)}finally{b(!1),T(!1)}}},pe=async()=>{if(C){w(!1);return}w(!0),t&&y&&await Le()},Be=I=>{if(se.current){const{scrollLeft:k,clientWidth:Q,scrollWidth:fe}=se.current,be=Q*.8;if(I==="left")se.current.scrollBy({left:-be,behavior:"smooth"});else{se.current.scrollBy({left:be,behavior:"smooth"});const xe=fe-Q;y&&xe-(k+be)<Q&&Me()}}},We=le(h),dt=I=>I?`https://image.tmdb.org/t/p/w500${I}`:"https://via.placeholder.com/500x281?text=No+Image",Ct=I=>I.backdrop_with_logo?I.backdrop_with_logo:dt(I.backdrop_path||I.poster_path),ut=I=>`${I.first_air_date!==void 0||I.name!==void 0||I.media_type==="tv"?"tv":"movie"}-${I.id}`,kt=I=>{if(r){r(I);return}const k=ut(I);try{const fe=We.map(be=>ut(be));sessionStorage.setItem(bL,JSON.stringify({rowTitle:n,items:fe,currentWatch:k,updatedAt:Date.now()}))}catch(fe){console.warn("Unable to persist row context for navigation",fe)}const Q=new URLSearchParams(l);Q.set("watch",k),Q.delete("free"),u(Q)},K=()=>{if(D.current!==null&&!Ce.current){M(!0);const I=D.current;Ce.current=setTimeout(()=>{D.current===I&&(j(null),R(null),D.current=null,M(!1)),Ce.current=null},200)}else D.current===null&&(j(null),R(null))},Nt=(I,k)=>{if(!W||U)return;const Q=Z(I),fe=k.currentTarget.getBoundingClientRect();ue.current&&clearTimeout(ue.current),D.current===Q?(Ce.current&&(clearTimeout(Ce.current),Ce.current=null),M(!1)):K(),ue.current=setTimeout(()=>{D.current=Q,j(Q),R({left:fe.left,top:fe.top,width:fe.width}),M(!1)},500)},Tt=()=>{W&&(ue.current&&clearTimeout(ue.current),K())},Mt=()=>{Y(!0),ue.current&&clearTimeout(ue.current),K()},nt=()=>{Y(!1)};return o.jsxs("div",{ref:V,className:"mb-1 md:mb-8 relative group min-h-[180px] md:min-h-[220px]",onMouseLeave:Tt,children:[o.jsxs("div",{className:"flex items-center justify-between mb-4 px-4 md:px-12",children:[o.jsx("h3",{className:"text-lg md:text-xl font-bold text-zinc-100",children:n}),i&&o.jsx("button",{className:"text-sm font-medium text-zinc-300 hover:text-white transition",onClick:pe,disabled:S,children:S?"Loading...":C?"Collapse":"View All"})]}),o.jsxs("div",{className:"relative",children:[!C&&P&&o.jsx("button",{className:"hidden md:flex absolute left-2 top-1/2 z-40 h-16 w-10 -translate-y-1/2 items-center justify-center rounded-md bg-black/60 opacity-0 transition-opacity hover:bg-black/80 group-hover:opacity-100",onClick:()=>Be("left"),onMouseEnter:Mt,onMouseLeave:nt,"aria-label":"Scroll left",children:o.jsx(nm,{className:"h-8 w-8 text-white"})}),!C&&o.jsx("button",{className:"hidden md:flex absolute right-2 top-1/2 z-40 h-16 w-10 -translate-y-1/2 items-center justify-center rounded-md bg-black/60 opacity-0 transition-opacity hover:bg-black/80 group-hover:opacity-100",onClick:()=>Be("right"),onMouseEnter:Mt,onMouseLeave:nt,"aria-label":"Scroll right",children:o.jsx(im,{className:"h-8 w-8 text-white"})}),o.jsx("div",{ref:se,className:`${C?"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-4 overflow-visible":"flex gap-4 overflow-x-auto scrollbar-hide snap-x"} pb-4 px-4 md:px-12 transition-all duration-700 ease-out ${F?"opacity-100 translate-y-0":"opacity-0 translate-y-8"}`,style:{scrollBehavior:"smooth"},children:We.map((I,k)=>o.jsx("div",{className:`${C?"w-full aspect-video":"w-[170px] sm:w-[200px] md:w-[260px] flex-none aspect-video snap-start"} bg-zinc-800 rounded-md overflow-hidden cursor-pointer relative transition-all duration-500 ease-out ${W&&N===Z(I)?"opacity-0 pointer-events-none":"opacity-100 pointer-events-auto"} ${F?"translate-y-0":"translate-y-8"}`,style:{transitionDelay:F?`${Math.min(k*50,500)}ms`:"0ms"},onMouseEnter:Q=>Nt(I,Q),onClick:()=>kt(I),"data-id":Z(I),children:o.jsxs("div",{className:"relative w-full h-full",children:[o.jsx("img",{src:Ct(I),alt:I.title||I.name||I.original_title,className:"w-full h-full object-cover"}),typeof I.pyroRank=="number"&&o.jsx("div",{className:"pointer-events-none absolute left-3 top-3 z-20 flex items-start gap-2",children:o.jsx("span",{className:"text-5xl font-black leading-none text-white [text-shadow:0_8px_20px_rgba(0,0,0,0.95)] md:text-6xl",children:I.pyroRank})}),!I.backdrop_with_logo&&I.logoUrl&&o.jsx("div",{className:"absolute bottom-4 left-0 right-0 px-4 pb-2 z-10 flex justify-center items-end h-full pointer-events-none",children:o.jsx("img",{src:I.logoUrl,alt:"Logo",className:"max-w-[70%] max-h-[50%] object-contain drop-shadow-lg mb-2"})}),o.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 to-transparent opacity-0 hover:opacity-100 transition-opacity duration-300"}),!I.backdrop_with_logo&&!I.logoUrl&&o.jsx("div",{className:"absolute bottom-0 left-0 right-0 p-3",children:o.jsx("h4",{className:"font-bold text-sm truncate text-white drop-shadow-md",children:I.title||I.name||I.original_title})})]})},Z(I)))})]}),W&&N&&O&&o.jsx(vL,{movie:We.find(I=>Z(I)===N),position:O,isClosing:z,onClose:Tt,onPlay:()=>kt(We.find(I=>Z(I)===N))})]})}function vL({movie:n,position:e,isClosing:t,onClose:i,onPlay:r}){const[l,u]=E.useState(!1),h=E.useRef(null),[d,p]=E.useState(!1);E.useEffect(()=>{const j=requestAnimationFrame(()=>{u(!0)});return()=>cancelAnimationFrame(j)},[]),E.useEffect(()=>{p(!1)},[n.id,n.trailer_url]);const m=j=>j?`https://image.tmdb.org/t/p/w500${j}`:"https://via.placeholder.com/500x281?text=No+Image",g=j=>j.backdrop_with_logo?j.backdrop_with_logo:m(j.backdrop_path||j.poster_path),b=n.trailer_url?`${n.trailer_url}${n.trailer_url.includes("?")?"&":"?"}autoplay=1&mute=1&enablejsapi=1&playsinline=1&controls=0&rel=0&modestbranding=1`
66:null,y=(n.release_date||n.first_air_date||"").substring(0,4),_=Math.random()*100,C=320,w=e.left+e.width/2-C/2,S=e.top-20,T=Math.max(20,Math.min(w,window.innerWidth-C-20));let N=null;return!n.backdrop_with_logo&&n.logoUrl&&(N=n.logoUrl),o.jsxs("div",{className:`fixed z-[60] flex flex-col bg-zinc-900 rounded-md overflow-hidden shadow-2xl transition-all duration-300 ease-out border-[0.5px] border-zinc-700 origin-center pointer-events-auto ${t?"opacity-0 scale-95":l?"opacity-100 scale-100":"opacity-0 scale-95"}`,style:{left:T,top:S,width:C},onClick:r,onMouseLeave:i,children:[o.jsxs("div",{className:"relative aspect-video w-full bg-zinc-800 group",children:[o.jsx("img",{src:g(n),alt:n.title||n.name||n.original_title,className:`absolute inset-0 h-full w-full object-cover transition-opacity duration-300 ${b&&d?"opacity-0":"opacity-100"}`}),b&&o.jsx("iframe",{ref:h,width:"100%",height:"100%",src:b,title:n.title||n.name||n.original_title,onLoad:()=>p(!0),className:`pointer-events-none absolute inset-0 h-full w-full object-cover transition-opacity duration-300 ${d?"opacity-100":"opacity-0"}`,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",referrerPolicy:"strict-origin-when-cross-origin",allowFullScreen:!0}),o.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-zinc-900 via-transparent to-transparent"}),N&&o.jsx("div",{className:"absolute bottom-4 left-0 right-0 px-4 pb-2 z-10 flex justify-center items-end h-full pointer-events-none",children:o.jsx("img",{src:N,alt:"Logo",className:"max-w-[70%] max-h-[50%] object-contain drop-shadow-lg mb-2"})}),o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-1 bg-zinc-700/50 z-20",children:o.jsx("div",{className:"h-full bg-[#E25E0C]",style:{width:`${_}%`}})})]}),o.jsxs("div",{className:"p-4 bg-zinc-900 flex flex-col gap-3 shadow-inner pointer-events-auto",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("div",{className:"text-white font-bold text-sm mt-1",children:n.title||n.name||n.original_title})}),o.jsx("button",{className:"w-8 h-8 flex items-center justify-center border-2 border-zinc-500 rounded-full hover:border-white text-zinc-300 hover:text-white transition bg-zinc-800/50",title:"More Info",onClick:j=>{j.stopPropagation(),r()},children:o.jsx(K6,{className:"w-4 h-4"})})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("div",{children:o.jsx("div",{className:"text-white font-normal text-sm mt-1",children:n.overview})}),o.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[o.jsx("span",{className:"text-zinc-400 font-normal",children:y}),o.jsx("span",{className:"border border-zinc-600 px-1 rounded text-[10px] text-zinc-400 font-normal",children:"HD"}),n.runtime&&o.jsxs("span",{className:"text-zinc-400 font-normal ml-1",children:[Math.floor(n.runtime/60),"h ",n.runtime%60,"m"]}),n.number_of_seasons&&o.jsxs("span",{className:"text-zinc-400 font-normal ml-1",children:[n.number_of_seasons," Season",n.number_of_seasons>1?"s":""]})]}),n.genres&&o.jsx("div",{className:"flex items-center flex-wrap gap-x-2 gap-y-1 text-xs text-zinc-300 font-medium",children:n.genres.map((j,O)=>o.jsxs("span",{className:"flex items-center",children:[O>0&&o.jsx("span",{className:"text-zinc-600 mr-2",children:"â¢"}),j.name]},j.id)).slice(0,3)})]})]})]})}const cm=async(n,e)=>{const t=await fetch(n,{signal:e});if(!t.ok)throw new Error(`Request failed: ${t.status}`);return await t.json()},um=n=>{const e=Number.parseInt(String(n||""),10);return Number.isFinite(e)&&e>0?e:null},k5=(n,e,t)=>{const i=um(n.id);return i?{id:i,title:typeof n.title=="string"?n.title:void 0,name:typeof n.name=="string"?n.name:void 0,original_title:typeof n.original_title=="string"?n.original_title:void 0,overview:typeof n.overview=="string"?n.overview:"",backdrop_path:typeof n.backdrop_path=="string"?n.backdrop_path:"",backdrop_with_logo:typeof n.backdrop_with_logo=="string"?n.backdrop_with_logo:void 0,trailer_url:typeof n.trailer_url=="string"?n.trailer_url:null,poster_path:typeof n.poster_path=="string"?n.poster_path:"",release_date:typeof n.release_date=="string"?n.release_date:void 0,first_air_date:typeof n.first_air_date=="string"?n.first_air_date:void 0,vote_average:Number(n.vote_average||0),adult:!!n.adult,logoUrl:typeof n.logoUrl=="string"?n.logoUrl:void 0,pyroRank:e,pyroVisitors:t}:null},yL=(n,e,t)=>n?.id?{...n,pyroRank:e,pyroVisitors:t}:null,pv=async(n,e,t)=>{const i=await cm(`${n}/trending-pyro/${e}`,t);return Array.isArray(i.results)?i.results:[]},j5=async(n,e)=>{const t=await pv(n,"movies",e);return(await Promise.allSettled(t.map(async(r,l)=>{const u=um(r.mediaId);if(!u)return null;const h=await cm(`${n}/movies/${u}`,e);return k5(h,l+1,Number(r.visitors||0))}))).filter(r=>r.status==="fulfilled").map(r=>r.value).filter(r=>!!r)},L5=async(n,e)=>{const t=await pv(n,"series",e);return(await Promise.allSettled(t.map(async(r,l)=>{const u=um(r.mediaId);if(!u)return null;const h=await cm(`${n}/tv/${u}`,e);return k5(h,l+1,Number(r.visitors||0))}))).filter(r=>r.status==="fulfilled").map(r=>r.value).filter(r=>!!r)},_L=async(n,e)=>{const t=await pv(n,"anime",e);return(await Promise.allSettled(t.map(async(r,l)=>{const u=um(r.mediaId);if(!u)return null;const h=await cm(`${n}/anime/${u}`,e);return yL(h.anime,l+1,Number(r.visitors||0))}))).filter(r=>r.status==="fulfilled").map(r=>r.value).filter(r=>!!r)};function wL(){return o.jsxs("div",{className:"flex flex-col items-center justify-center min-h-screen bg-zinc-950 text-white pt-20",children:[o.jsx("div",{className:"animate-spin rounded-full h-16 w-16 border-t-4 border-b-4 border-blue-500 mb-4"}),o.jsx("span",{className:"text-lg font-semibold",children:"Loading..."})]})}
66const jf="https://watch-server-production-c01b.up.railway.app/api",SL=15,hS=(n,e)=>{let t=Math.max(1,Math.floor(e*1e6));for(const i of`${n}:${e}`)t=(t*31+i.charCodeAt(0))%2147483647;return t},fS=(n,e)=>[...n].sort((t,i)=>hS(t.key,e)-hS(i.key,e));function EL({onPlay:n,isPlayerOpen:e}){const[t,i]=E.useState(0),[r,l]=E.useState([]),[u,h]=E.useState([]),[d,p]=E.useState([]),[m,g]=E.useState([]),[b,y]=E.useState([]),[_]=E.useState(()=>Math.random());E.useEffect(()=>{const w=new AbortController;return(async()=>{try{const[T,N,j]=await Promise.all([fetch(`${jf}/movies/trending?hero=true`,{signal:w.signal}),j5(jf,w.signal),L5(jf,w.signal)]),O=await T.json();if(Array.isArray(O.results)){const R=O.results;l(R);const z=R.slice(0,5).filter(M=>!M.logoUrl);if(z.length>0)try{const M=await Kc(z,w.signal),P=M.filter(G=>!!G.logoUrl).length;console.info(`[HERO] Loaded ${P}/${z.length} missing title logos.`),l(G=>Zc(G,M))}catch(M){w.signal.aborted||console.warn("[HERO] Failed to load title logos:",M)}else console.info("[HERO] All five title logos arrived with the trending response.")}h(N),p(j)}catch(T){if(w.signal.aborted)return;console.error("Error fetching data:",T)}})(),()=>w.abort()},[]),E.useEffect(()=>{const w=new AbortController,S=async j=>{if(!j){g([]);return}try{const O=await fetch(`${jf}/users/for-you`,{signal:w.signal,headers:{Authorization:`Bearer ${j}`}});if(!O.ok){const z=await O.text().catch(()=>"");throw new Error(z||O.statusText||"Failed to load for-you rows")}const R=await O.json();g(Array.isArray(R.rows)?R.rows.filter(z=>Array.isArray(z.results)&&z.results.length>0):[])}catch(O){if(w.signal.aborted)return;console.error("Error fetching for-you rows:",O),g([])}};(async()=>{if(!Fe){g([]);return}const{data:{session:j}}=await Fe.auth.getSession();await S(j?.access_token||null)})();const{data:N}=Fe?.auth.onAuthStateChange((j,O)=>{S(O?.access_token||null)})||{data:{subscription:null}};return()=>{w.abort(),N?.subscription?.unsubscribe()}},[]),E.useEffect(()=>{if(r.length===0){y([]);return}const w=[{key:"trending-now",title:"Trending Now",movies:r,endpoint:"/movies/trending"},u.length>0?{key:"top-pyro-movies",title:"Top 10 Movies On PyroPlay Today",movies:u}:null,d.length>0?{key:"top-pyro-series",title:"Top 10 Series On PyroPlay Today",movies:d}:null].flatMap(R=>R?[R]:[]),S=m.map(R=>({key:R.key,title:R.title,movies:R.results})),T=fS([{key:"trending-tv",title:"Trending TV This Week",endpoint:"/tv/trending"},{key:"popular-movies",title:"Popular Movies",endpoint:"/movies/popular"},{key:"popular-tv",title:"Popular TV Shows",endpoint:"/tv/popular"},{key:"top-rated-movies",title:"Top Rated Movies",endpoint:"/movies/toprated"},{key:"top-rated-tv",title:"Critics Love These Shows",endpoint:"/tv/toprated"},{key:"now-playing-movies",title:"Now Playing",endpoint:"/movies/nowplaying"},{key:"on-air-tv",title:"On The Air",endpoint:"/tv/onair"},{key:"marvel-universe",title:"Marvel Universe",endpoint:"/universes/marvel",showViewAll:!0},{key:"star-wars",title:"Star Wars Saga",endpoint:"/universes/starwars",showViewAll:!0},{key:"harry-potter",title:"Harry Potter World",endpoint:"/universes/harrypotter",showViewAll:!0},{key:"pixar",title:"Pixar Favorites",endpoint:"/universes/pixar",showViewAll:!0},{key:"dreamworks",title:"DreamWorks Adventures",endpoint:"/universes/dreamworks",showViewAll:!0}],_),N=Math.max(0,SL-w.length-S.length),j=T.slice(0,N),O=[...w,...fS([...S,...j],_+1)];y(O)},[m,_,u,d,r]);const C=r.slice(0,5).map(w=>{const S=!!w.first_air_date&&!w.release_date;return{id:w.id,title:w.title||w.name||w.original_title,logoUrl:w.logoUrl,year:(w.release_date||w.first_air_date||"").substring(0,4),rating:w.adult?"R":"TV-MA",duration:"",trailer_url:w.trailer_url,quality:"HD",description:w.overview,image:`https://image.tmdb.org/t/p/original${w.backdrop_path}`,type:S?"tv":"movie"}});return E.useEffect(()=>{if(C.length===0)return;const w=setInterval(()=>{i(S=>(S+1)%C.length)},8e3);return()=>clearInterval(w)},[C.length]),r.length===0?o.jsx(wL,{}):o.jsxs(o.Fragment,{children:[o.jsx(Qd,{featuredMovies:C,currentHeroIndex:t,setCurrentHeroIndex:i,onPlay:n,isPlayerOpen:e}),o.jsx("div",{className:"pb-20 -mt-2 md:-mt-8 lg:-mt-24 relative z-10",children:b.map(w=>o.jsx(ur,{title:w.title,movies:w.movies,endpoint:w.endpoint,showViewAll:w.showViewAll},w.key))})]})}
66const td="https://watch-server-production-c01b.up.railway.app/api";function CL(){return o.jsxs("div",{className:"flex flex-col items-center justify-center min-h-screen bg-zinc-950 text-white pt-20",children:[o.jsx("div",{className:"animate-spin rounded-full h-16 w-16 border-t-4 border-b-4 border-[#E25E0C] mb-4"}),o.jsx("span",{className:"text-lg font-semibold",children:"Loading Anime..."})]})}const Cd=n=>n.title?.english||n.title?.romaji||n.title?.native||n.title?.userPreferred||`Anime #${n.id}`,NL=n=>n.coverImage?.extraLarge||n.coverImage?.large||n.coverImage?.medium||"",TL=(n,e)=>e?n.coverImage?.extraLarge||n.coverImage?.large||n.coverImage?.medium||n.bannerImage||"":n.bannerImage||n.coverImage?.extraLarge||n.coverImage?.large||n.coverImage?.medium||"",ML=n=>n.format==="MOVIE"||typeof n.episodes=="number"&&n.episodes<=1,AL=n=>{if(!n)return"No description available.";const e=n.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();return e?e.length>240?`${e.slice(0,237)}...`:e:"No description available."},nd=({title:n,items:e,onPlay:t,onOpenDetails:i})=>e.length?o.jsxs("section",{className:"px-4 md:px-12 mt-10 md:mt-14",children:[o.jsx("div",{className:"mb-5 flex items-center justify-between gap-3",children:o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx("span",{className:"inline-block h-6 w-1.5 rounded-full bg-[#E25E0C]"}),o.jsx("h2",{className:"text-white text-xl md:text-2xl font-black tracking-tight",children:n})]})}),o.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4 md:gap-5",children:e.map(r=>{const l=NL(r),u=ML(r);return o.jsxs("article",{className:"group relative rounded-2xl border border-white/10 bg-zinc-900/60 overflow-hidden cursor-pointer transition duration-300 hover:-translate-y-1 hover:border-[#E25E0C]/60 hover:shadow-[0_20px_60px_-35px_rgba(226,94,12,0.85)]",onClick:()=>i(r.id),children:[o.jsxs("div",{className:"relative aspect-2/3 bg-zinc-800 overflow-hidden",children:[l?o.jsx("img",{src:l,alt:Cd(r),className:"h-full w-full object-cover transition-transform duration-700 group-hover:scale-110",loading:"lazy"}):o.jsx("div",{className:"h-full w-full flex items-center justify-center text-zinc-400 text-sm",children:"No image"}),o.jsx("div",{className:"absolute inset-0 bg-linear-to-t from-black via-black/35 to-transparent opacity-90"}),typeof r.pyroRank=="number"?o.jsxs("div",{className:"pointer-events-none absolute left-2.5 top-10 z-10 flex items-start gap-2",children:[o.jsx("span",{className:"text-5xl font-black leading-none text-white [text-shadow:0_8px_20px_rgba(0,0,0,0.95)] md:text-6xl",children:r.pyroRank}),o.jsx("span",{className:"mt-1 rounded-full border border-white/20 bg-black/70 px-2 py-0.5 text-[10px] font-black uppercase tracking-[0.18em] text-zinc-100 backdrop-blur-sm",children:"Top 24h"})]}):null,o.jsx("div",{className:"absolute left-2.5 top-2.5 rounded-full bg-black/70 border border-white/15 px-2 py-0.5 text-[10px] font-semibold tracking-wide text-zinc-100 backdrop-blur-sm",children:r.format||"ANIME"}),o.jsx("div",{className:"absolute right-2.5 top-2.5 rounded-full bg-[#E25E0C] px-2 py-0.5 text-[10px] font-black text-white",children:r.averageScore?`${r.averageScore}%`:"NEW"}),o.jsx("div",{className:"absolute inset-x-0 bottom-0 p-3",children:o.jsxs("button",{type:"button",onClick:h=>{h.stopPropagation(),t({type:"anime",id:r.id,title:Cd(r),image:l,provider:"videasy",animeIsMovie:u,episode:1,maxEpisodes:u?1:r.episodes||void 0,dub:!1})},className:"w-full inline-flex items-center justify-center gap-2 rounded-md bg-[#E25E0C] hover:bg-[#f76c15] px-3 py-2 text-xs font-black text-white uppercase tracking-wide transition",children:[o.jsx(Ts,{className:"w-3.5 h-3.5 fill-white"})," Watch"]})})]}),o.jsxs("div",{className:"p-3.5 space-y-1.5 bg-zinc-900/95",children:[o.jsx("h3",{className:"text-sm font-bold text-white line-clamp-2 min-h-10",children:Cd(r)}),o.jsxs("p",{className:"text-xs text-zinc-400",children:[r.seasonYear||"Unknown year"," ",r.episodes?`⢠${r.episodes} eps`:""]})]})]},r.id)})})]}):null;function RL({onPlay:n}){const[e,t]=Ki(),[i,r]=E.useState([]),[l,u]=E.useState([]),[h,d]=E.useState([]),[p,m]=E.useState([]),[g,b]=E.useState(""),[y,_]=E.useState([]),[C,w]=E.useState(!1),[S,T]=E.useState(0),[N,j]=E.useState(!1),O=(M,P)=>{const G=new URLSearchParams(e);G.set("watch",`anime-${M}`),P?.episode&&P.episode>0?G.set("episode",String(P.episode)):G.delete("episode"),G.delete("season"),G.delete("server"),t(G,{replace:!0})};E.useEffect(()=>{const M=window.matchMedia("(orientation: portrait)"),P=()=>{j(M.matches)};return P(),M.addEventListener("change",P),()=>M.removeEventListener("change",P)},[]),E.useEffect(()=>{const M=new AbortController;return(async()=>{try{const[G,U,Y,W]=await Promise.all([fetch(`${td}/anime/trending?perPage=24`,{signal:M.signal}),fetch(`${td}/anime/popular?perPage=24`,{signal:M.signal}),fetch(`${td}/anime/toprated?perPage=24`,{signal:M.signal}),_L(td,M.signal)]),[J,F,$]=await Promise.all([G.json(),U.json(),Y.json()]);r(Array.isArray(J.results)?J.results:[]),u(Array.isArray(F.results)?F.results:[]),d(Array.isArray($.results)?$.results:[]),m(W)}catch(G){if(M.signal.aborted)return;console.error("Failed to load anime page data:",G)}})(),()=>M.abort()},[]);const R=E.useMemo(()=>i.slice(0,7),[i]);E.useEffect(()=>{if(R.length<=1)return;const M=window.setInterval(()=>{T(P=>(P+1)%R.length)},7e3);return()=>window.clearInterval(M)},[R.length]);const z=async M=>{M.preventDefault();const P=g.trim();if(!P){_([]);return}w(!0);try{const U=await(await fetch(`${td}/anime/search?query=${encodeURIComponent(P)}&perPage=24`)).json();_(Array.isArray(U.results)?U.results:[])}catch(G){console.error("Anime search failed:",G),_([])}finally{w(!1)}};return i.length===0?o.jsx(CL,{}):o.jsxs("div",{className:"relative pb-20 bg-zinc-950 min-h-screen overflow-hidden",children:[o.jsxs("section",{className:"relative h-[75vh] min-h-125 overflow-hidden",children:[R.map((M,P)=>{const G=P===S,U=TL(M,N);return o.jsxs("div",{className:`absolute inset-0 transition-opacity duration-700 ${G?"opacity-100 z-10":"opacity-0 z-0"}`,children:[o.jsxs("div",{className:"absolute inset-0 bg-zinc-900",children:[U?o.jsx("img",{src:U,alt:Cd(M),className:"w-full h-full object-cover object-center"}):null,o.jsx("div",{className:"absolute inset-0 bg-linear-to-r from-zinc-950 via-zinc-950/75 to-zinc-950/35"}),o.jsx("div",{className:"absolute inset-0 bg-linear-to-t from-zinc-950 via-zinc-950/10 to-transparent"}),o.jsx("div",{className:"absolute inset-0 bg-[linear-gradient(transparent_96%,rgba(255,255,255,0.09)_100%)] bg-size-[100%_22px] opacity-[0.08]"})]}),o.jsx("div",{className:"relative z-10 h-full flex items-end md:items-center px-4 md:px-12 pb-16 md:pb-0 max-w-3xl",children:o.jsxs("div",{children:[o.jsx("p",{className:"inline-flex items-center rounded-full border border-[#
66E25E0C]/35 bg-black/35 px-3 py-1 text-[#E25E0C] text-[11px] font-black tracking-[0.16em] uppercase mb-4",children:"Now Streaming"}),o.jsx("h1",{className:"text-3xl md:text-6xl font-black leading-tight text-white",children:Cd(M)}),o.jsx("p",{className:"mt-4 text-zinc-300 text-sm md:text-base line-clamp-4",children:AL(M.description)}),o.jsxs("div",{className:"mt-5 flex items-center gap-3 text-xs md:text-sm text-zinc-200 flex-wrap",children:[o.jsx("span",{className:"px-2 py-1 rounded border border-white/20",children:M.format||"ANIME"}),o.jsx("span",{children:M.seasonYear||"Unknown year"}),o.jsxs("span",{children:["Episodes: ",M.episodes||"?"]}),o.jsxs("span",{children:["Score: ",M.averageScore?`${M.averageScore}/100`:"N/A"]})]}),o.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[o.jsxs("button",{type:"button",onClick:()=>O(M.id,{episode:1}),className:"inline-flex items-center gap-2 bg-[#E25E0C] hover:bg-[#f76c15] text-white px-5 py-2.5 rounded-md font-black uppercase tracking-wide transition",children:[o.jsx(Ts,{className:"w-4 h-4 fill-white"})," Watch Now"]}),o.jsx("button",{type:"button",onClick:()=>O(M.id),className:"inline-flex items-center gap-2 bg-zinc-900/70 hover:bg-zinc-800 text-white px-4 py-2.5 rounded-md font-semibold transition border border-white/20",children:"Details"})]})]})})]},M.id)}),o.jsx("div",{className:"absolute bottom-4 md:bottom-6 left-4 md:left-12 z-20 flex gap-2",children:R.map((M,P)=>o.jsx("button",{onClick:()=>T(P),className:`h-1 rounded-full transition-all ${P===S?"w-8 bg-white":"w-4 bg-zinc-500 hover:bg-zinc-300"}`,"aria-label":`Anime hero slide ${P+1}`},P))})]}),o.jsx("section",{className:"px-4 md:px-12 mt-8 md:mt-10",children:o.jsxs("form",{onSubmit:z,className:"flex flex-col sm:flex-row gap-3 rounded-xl border border-white/10 bg-zinc-900/70 p-3 md:p-4 backdrop-blur-sm",children:[o.jsx("label",{className:"sr-only",htmlFor:"anime-search-input",children:"Search anime"}),o.jsxs("div",{className:"relative flex-1",children:[o.jsx(_d,{className:"w-4 h-4 text-zinc-400 absolute left-3 top-1/2 -translate-y-1/2"}),o.jsx("input",{id:"anime-search-input",value:g,onChange:M=>b(M.target.value),placeholder:"Search anime titles...",className:"w-full rounded-lg bg-zinc-950/90 border border-white/10 pl-9 pr-3 py-2.5 text-sm text-white placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-[#E25E0C]/50"})]}),o.jsx("button",{type:"submit",className:"rounded-lg bg-[#E25E0C] hover:bg-[#f76c15] px-5 py-2.5 text-sm font-black uppercase tracking-wide text-white transition",children:C?"Searching...":"Search"})]})}),g.trim()&&o.jsx(nd,{title:C?"Searching...":`Search Results${y.length?` (${y.length})`:""}`,items:y,onPlay:n,onOpenDetails:O}),o.jsx(nd,{title:"Top 10 Anime On PyroPlay Today",items:p,onPlay:n,onOpenDetails:O}),o.jsx(nd,{title:"Trending Anime",items:i,onPlay:n,onOpenDetails:O}),o.jsx(nd,{title:"Popular Anime",items:l,onPlay:n,onOpenDetails:O}),o.jsx(nd,{title:"Top Rated Anime",items:h,onPlay:n,onOpenDetails:O})]})}function kL(){return o.jsxs("div",{className:"flex flex-col items-center justify-center min-h-screen bg-zinc-950 text-white pt-20",children:[o.jsx("div",{className:"animate-spin rounded-full h-16 w-16 border-t-4 border-b-4 border-blue-500 mb-4"}),o.jsx("span",{className:"text-lg font-semibold",children:"Loading..."})]})}const lx="https://watch-server-production-c01b.up.railway.app/api",pS=(n,e)=>{let t=Math.max(1,Math.floor(e*1e6));for(const i of`${n}:${e}`)t=(t*31+i.charCodeAt(0))%2147483647;return t},mS=(n,e)=>[...n].sort((t,i)=>pS(t.key,e)-pS(i.key,e)),jL=n=>n.first_air_date!==void 0||n.name!==void 0||n.media_type==="tv";function LL({onPlay:n,isPlayerOpen:e}){const[t,i]=E.useState(0),[r,l]=E.useState([]),[u,h]=E.useState([]),[d,p]=E.useState([]),[m,g]=E.useState([]),[b]=E.useState(()=>Math.random());E.useEffect(()=>{const _=new AbortController;return(async()=>{try{const[w,S]=await Promise.all([fetch(`${lx}
66/tv/trending?hero=true`,{signal:_.signal}),L5(lx,_.signal)]),T=await w.json();if(Array.isArray(T.results)){const N=T.results;l(N);const j=N.slice(0,5).filter(O=>!O.logoUrl);if(j.length>0){const O=await Kc(j,_.signal).catch(()=>[]);l(R=>Zc(R,O))}}h(S)}catch(w){if(_.signal.aborted)return;console.error("Error fetching tv shows data:",w)}})(),()=>_.abort()},[]),E.useEffect(()=>{const _=new AbortController,C=async T=>{if(!T){p([]);return}try{const N=await fetch(`${lx}/users/for-you`,{signal:_.signal,headers:{Authorization:`Bearer ${T}`}});if(!N.ok){const O=await N.text().catch(()=>"");throw new Error(O||N.statusText||"Failed to load for-you rows")}const j=await N.json();p(Array.isArray(j.rows)?j.rows.filter(O=>Array.isArray(O.results)&&O.results.length>0):[])}catch(N){if(_.signal.aborted)return;console.error("Error fetching for-you rows:",N),p([])}};(async()=>{if(!Fe){p([]);return}const{data:{session:T}}=await Fe.auth.getSession();await C(T?.access_token||null)})();const{data:S}=Fe?.auth.onAuthStateChange((T,N)=>{C(N?.access_token||null)})||{data:{subscription:null}};return()=>{_.abort(),S?.subscription?.unsubscribe()}},[]),E.useEffect(()=>{if(r.length===0){g([]);return}const _=d.map(T=>({...T,results:T.results.filter(N=>jL(N))})).filter(T=>T.results.length>0),C=[{key:"trending-tv",title:"Trending TV Shows",movies:r,endpoint:"/tv/trending"},u.length>0?{key:"top-pyro-series",title:"Top 10 Series On PyroPlay Today",movies:u}:null].flatMap(T=>T?[T]:[]),w=_.map(T=>({key:T.key,title:T.title,movies:T.results})),S=mS([{key:"popular-tv",title:"Popular TV Shows",endpoint:"/tv/popular"},{key:"top-rated-tv",title:"Top Rated TV Shows",endpoint:"/tv/toprated"},{key:"on-air-tv",title:"On The Air",endpoint:"/tv/onair"}],b);g([...C,...mS([...w,...S],b+1)])},[d,b,u,r]);const y=r.slice(0,5).map(_=>({id:_.id,title:_.title||_.name||_.original_title,logoUrl:_.logoUrl,year:(_.first_air_date||"").substring(0,4),rating:_.adult?"TV-MA":"TV-14",duration:"",quality:"HD",description:_.overview,image:`https://image.tmdb.org/t/p/original${_.backdrop_path}`,type:"tv"}));return E.useEffect(()=>{if(y.length===0)return;const _=setInterval(()=>{i(C=>(C+1)%y.length)},8e3);return()=>clearInterval(_)},[y.length]),r.length===0?o.jsx(kL,{}):o.jsxs(o.Fragment,{children:[o.jsx(Qd,{featuredMovies:y,currentHeroIndex:t,setCurrentHeroIndex:i,onPlay:n,isPlayerOpen:e}),o.jsx("div",{className:"pb-20 -mt-2 md:-mt-8 lg:-mt-24 relative z-10",children:m.map(_=>o.jsx(ur,{title:_.title,movies:_.movies,endpoint:_.endpoint,showViewAll:_.showViewAll},_.key))})]})}function PL(){return o.jsxs("div",{className:"flex flex-col items-center justify-center min-h-screen bg-zinc-950 text-white pt-20",children:[o.jsx("div",{className:"animate-spin rounded-full h-16 w-16 border-t-4 border-b-4 border-blue-500 mb-4"}),o.jsx("span",{className:"text-lg font-semibold",children:"Loading..."})]})}const cx="https://watch-server-production-c01b.up.railway.app/api",gS=(n,e)=>{let t=Math.max(1,Math.floor(e*1e6));for(const i of`${n}:${e}`)t=(t*31+i.charCodeAt(0))%2147483647;return t},xS=(n,e)=>[...n].sort((t,i)=>gS(t.key,e)-gS(i.key,e)),OL=n=>n.first_air_date!==void 0||n.name!==void 0||n.media_type==="tv";function DL({onPlay:n,isPlayerOpen:e}){const[t,i]=E.useState(0),[r,l]=E.useState([]),[u,h]=E.useState([]),[d,p]=E.useState([]),[m,g]=E.useState([]),[b]=E.useState(()=>Math.random());E.useEffect(()=>{const _=new AbortController;return(async()=>{try{const[w,S]=await Promise.all([fetch(`${cx}/movies/trending?hero=true`,{signal:_.signal}),j5(cx,_.signal)]),T=await w.json();if(Array.isArray(T.results)){const N=T.results;l(N);const j=N.slice(0,5).filter(O=>!O.logoUrl);if(j.length>0){const O=await Kc(j,_.signal).catch(()=>[]);l(R=>Zc(R,O))}}h(S)}catch(w){if(_.signal.aborted)return;console.error("Error fetching movies data:",w)}})(),()=>_.abort()},[]),E.useEffect(()=>{const _=new AbortController,C=async T=>{if(!T){p([]);return}try{const N=await fetch(`${cx}/users/for-you`,{signal:_.signal,headers:{Authorization:`Bearer ${T}`}});if(!N.ok){const O=await N.text().catch(()=>"");throw new Error(O||N.statusText||"Failed to load for-you rows")}const j=await N.json();p(Array.isArray(j.rows)?j.rows.filter(O=>Array.isArray(O.results)&&O.results.length>0):[])}catch(N){if(_.signal.aborted)return;console.error("Error fetching for-you rows:",N),p([])}};(async()=>
66{if(!Fe){p([]);return}const{data:{session:T}}=await Fe.auth.getSession();await C(T?.access_token||null)})();const{data:S}=Fe?.auth.onAuthStateChange((T,N)=>{C(N?.access_token||null)})||{data:{subscription:null}};return()=>{_.abort(),S?.subscription?.unsubscribe()}},[]),E.useEffect(()=>{if(r.length===0){g([]);return}const _=d.map(T=>({...T,results:T.results.filter(N=>!OL(N))})).filter(T=>T.results.length>0),C=[{key:"trending-movies",title:"Trending Movies",movies:r,endpoint:"/movies/trending"},u.length>0?{key:"top-pyro-movies",title:"Top 10 Movies On PyroPlay Today",movies:u}:null].flatMap(T=>T?[T]:[]),w=_.map(T=>({key:T.key,title:T.title,movies:T.results})),S=xS([{key:"popular-movies",title:"Popular Movies",endpoint:"/movies/popular"},{key:"top-rated-movies",title:"Top Rated Movies",endpoint:"/movies/toprated"},{key:"now-playing-movies",title:"Now Playing",endpoint:"/movies/nowplaying"},{key:"marvel-universe",title:"Marvel Universe",endpoint:"/universes/marvel",showViewAll:!0},{key:"star-wars",title:"Star Wars Saga",endpoint:"/universes/starwars",showViewAll:!0},{key:"harry-potter",title:"Harry Potter World",endpoint:"/universes/harrypotter",showViewAll:!0},{key:"pixar",title:"Pixar Favorites",endpoint:"/universes/pixar",showViewAll:!0},{key:"dreamworks",title:"DreamWorks Adventures",endpoint:"/universes/dreamworks",showViewAll:!0}],b);g([...C,...xS([...w,...S],b+1)])},[d,b,u,r]);const y=r.slice(0,5).map(_=>({id:_.id,title:_.title||_.original_title,logoUrl:_.logoUrl,year:(_.release_date||"").substring(0,4),rating:_.adult?"R":"PG-13",duration:"",trailer_url:_.trailer_url,quality:"HD",description:_.overview,image:`https://image.tmdb.org/t/p/original${_.backdrop_path}`,type:"movie"}));return E.useEffect(()=>{if(y.length===0)return;const _=setInterval(()=>{i(C=>(C+1)%y.length)},8e3);return()=>clearInterval(_)},[y.length]),r.length===0?o.jsx(PL,{}):o.jsxs(o.Fragment,{children:[o.jsx(Qd,{featuredMovies:y,currentHeroIndex:t,setCurrentHeroIndex:i,onPlay:n,isPlayerOpen:e}),o.jsx("div",{className:"pb-20 -mt-2 md:-mt-8 lg:-mt-24 relative z-10",children:m.map(_=>o.jsx(ur,{title:_.title,movies:_.movies,endpoint:_.endpoint,showViewAll:_.showViewAll},_.key))})]})}function UL(){return o.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center bg-zinc-950 pt-20 text-white",children:[o.jsx("div",{className:"mb-4 h-16 w-16 animate-spin rounded-full border-b-4 border-t-4 border-amber-400"}),o.jsx("span",{className:"text-lg font-semibold",children:"Loading family picks..."})]})}const IL="https://watch-server-production-c01b.up.railway.app/api",zL=new Set([16,10751]);function Lf(n){return!n.adult&&Array.isArray(n.genre_ids)&&n.genre_ids.some(e=>zL.has(e))}function id(n){const e=new Set;return n.filter(t=>{const i=`${t.id}:${t.title||t.name||t.original_title||""}`;return e.has(i)?!1:(e.add(i),!0)})}async function Pf(n,e){const i=await(await fetch(`${IL}${n}`,{signal:e})).json();return Array.isArray(i.results)?i.results:[]}function $L({onPlay:n,isPlayerOpen:e}){const[t,i]=E.useState(0),[r,l]=E.useState([]),[u,h]=E.useState([]);E.useEffect(()=>{const p=new AbortController;return(async()=>{try{const[g,b,y,_]=await Promise.all([Pf("/movies/trending",p.signal),Pf("/movies/popular",p.signal),Pf("/movies/toprated",p.signal),Pf("/movies/nowplaying",p.signal)]),C=id(g.filter(Lf)),w=id(b.filter(Lf)),S=id(y.filter(Lf)),T=id(_.filter(Lf)),N=id([...w,...S,...T]),j=(C.length>0?C:N).slice(0,5),O=await Kc(j,p.signal).catch(()=>[]);l(Zc(j,O)),h([{key:"family-trending",title:"Family Picks Right Now",movies:C},{key:"family-popular",title:"Animated Adventures",movies:w},{key:"family-top-rated",title:"Family Movie Night",movies:S},{key:"family-now-playing",title:"Fresh for Kids",movies:T},{key:"pixar-favorites",title:"Pixar Favorites",endpoint:"/universes/pixar",showViewAll:!0},{key:"dreamworks-adventures",title:"DreamWorks Adventures",endpoint:"/universes/dreamworks",showViewAll:!0},{key:"harry-potter-world",title:"Harry Potter World",endpoint:"/universes/harrypotter",showViewAll:!0}].filter(R=>R.endpoint||Array.isArray(R.movies)&&R.movies.length>0))}catch(g){if(p.signal.aborted)return;console.error("Error fetching family page data:",g),l([]),h([{key:"pixar-favorites",title:"Pixar Favorites",endpoint:"/universes/pixar",showViewAll:!0},{key:"dreamworks-adventures",title:"DreamWorks Adventures",endpoint:"/universes/dreamworks",
66showViewAll:!0}])}})(),()=>p.abort()},[]);const d=r.map(p=>({id:p.id,title:p.title||p.original_title||"Family Pick",logoUrl:p.logoUrl,year:(p.release_date||"").substring(0,4),rating:p.adult?"PG-13":"PG",duration:"",trailer_url:p.trailer_url,quality:"HD",description:p.overview,image:`https://image.tmdb.org/t/p/original${p.backdrop_path}`,type:"movie"}));return E.useEffect(()=>{if(d.length===0)return;const p=window.setInterval(()=>{i(m=>(m+1)%d.length)},8e3);return()=>window.clearInterval(p)},[d.length]),u.length===0?o.jsx(UL,{}):o.jsxs(o.Fragment,{children:[d.length>0&&o.jsx(Qd,{featuredMovies:d,currentHeroIndex:t,setCurrentHeroIndex:i,onPlay:n,isPlayerOpen:e}),o.jsxs("div",{className:`relative z-10 pb-20 ${d.length>0?"-mt-2 md:-mt-8 lg:-mt-24":"pt-28 md:pt-32"}`,children:[d.length===0&&o.jsx("section",{className:"px-4 pb-4 md:px-12",children:o.jsxs("div",{className:"mx-auto max-w-6xl rounded-3xl border border-amber-400/20 bg-linear-to-br from-amber-500/12 via-orange-500/8 to-zinc-950 p-6 text-white shadow-[0_20px_80px_-50px_rgba(245,158,11,0.7)]",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-amber-200/80",children:"Family"}),o.jsx("h1",{className:"mt-3 text-3xl font-black tracking-tight md:text-5xl",children:"Only family and kids movies."}),o.jsx("p",{className:"mt-3 max-w-2xl text-sm leading-relaxed text-zinc-300 md:text-base",children:"A safer browse built from animated favorites, family adventures, and universe collections that work for shared watch sessions."})]})}),u.map(p=>o.jsx(ur,{title:p.title,movies:p.movies,endpoint:p.endpoint,showViewAll:p.showViewAll},p.key))]})]})}function bS(n){if(!n)return"--";const e=n.split(/\s+/).map(t=>t.trim()).filter(Boolean);return e.length===0?"--":e.length===1?e[0].slice(0,3).toUpperCase():`${e[0][0]||""}${e[1][0]||""}`.toUpperCase()}function mv({event:n}){const[e,t]=n.thumbnail.colors.length>=2?[n.thumbnail.colors[0],n.thumbnail.colors[1]]:[n.thumbnail.colors[0]||"#f97316","#18181b"];return n.thumbnail.mode==="poster"&&n.thumbnail.posterUrl?o.jsx("img",{src:n.thumbnail.posterUrl,alt:n.name,className:"h-full w-full object-cover",loading:"lazy"}):o.jsxs("div",{className:"relative flex h-full w-full items-center justify-center overflow-hidden",style:{background:`linear-gradient(140deg, ${e}, ${t})`},children:[o.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_20%_15%,rgba(255,255,255,0.24),transparent_42%),radial-gradient(circle_at_80%_80%,rgba(0,0,0,0.36),transparent_48%)]"}),o.jsxs("div",{className:"relative z-10 flex items-center gap-4 px-4",children:[o.jsx("div",{className:"flex h-14 w-14 items-center justify-center overflow-hidden rounded-full border border-white/35 bg-black/25 shadow-lg md:h-16 md:w-16",children:n.thumbnail.logoTeam1?o.jsx("img",{src:n.thumbnail.logoTeam1,alt:n.team1||"Team 1",className:"h-full w-full object-cover",loading:"lazy"}):o.jsx("span",{className:"text-xs font-black text-white md:text-sm",children:bS(n.team1)})}),o.jsx("span",{className:"text-sm font-black uppercase tracking-[0.2em] text-white/90",children:"vs"}),o.jsx("div",{className:"flex h-14 w-14 items-center justify-center overflow-hidden rounded-full border border-white/35 bg-black/25 shadow-lg md:h-16 md:w-16",children:n.thumbnail.logoTeam2?o.jsx("img",{src:n.thumbnail.logoTeam2,alt:n.team2||"Team 2",className:"h-full w-full object-cover",loading:"lazy"}):o.jsx("span",{className:"text-xs font-black text-white md:text-sm",children:bS(n.team2)})})]})]})}function P5(n){if(!n)return null;const e=Date.parse(n);return Number.isFinite(e)?e:null}function FL(n){const e=Math.max(0,Math.floor(n/1e3)),t=Math.floor(e/86400),i=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),l=e%60;return t>0?`${t}d ${i.toString().padStart(2,"0")}h ${r.toString().padStart(2,"0")}m ${l.toString().padStart(2,"0")}s`:`${i.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}`}function BL(n){if(!n)return"TBA";const e=P5(n);return e===null?"TBA":new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(e)}function HL(n){return n==="live"?"border-rose-300/60 bg-rose-500/70 text-white":n==="upcoming"?"border-orange-300/50 bg-orange-500/20 text-orange-100":"border-zinc-300/40 bg-zinc-500/20 text-zinc-100"}function VL(n){return n==="live"?"Live":n==="upcoming"?"Upcoming":"Ended"}function GL(n,e){const t=P5(n.startsAt);return t===null?null:t-e}function O5(n){const e=Array.isArray(n.sources.ppv?.colors)?n.sources.ppv.colors.filter(
66Boolean):[],t=Array.isArray(n.thumbnail.colors)?n.thumbnail.colors.filter(Boolean):[],i=e.length>0?e:t;return[i[0]||"#E25E0C",i[1]||"#27272a"]}function qL(n){const[e,t]=O5(n);return{background:`radial-gradient(circle_at_18%_22%, ${e}66, transparent 52%), radial-gradient(circle_at_84%_84%, ${t}66, transparent 54%)`}}function WL(n){const[e,t]=O5(n);return{"--card-shadow-base":`0 18px 60px rgba(0,0,0,0.45), 0 0 26px ${e}2e`,"--card-shadow-hover":`0 22px 70px rgba(0,0,0,0.55), 0 0 34px ${t}5a`,"--card-top-line":`linear-gradient(90deg, ${e} 0%, ${t} 100%)`}}function XL({event:n,nowMs:e}){const t=GL(n,e),i=n.status==="upcoming"&&t!==null&&t>0,r=qL(n),l=WL(n);return o.jsx(Ut,{to:n.watchPath,className:"rounded-2xl focus:outline-none focus-visible:ring-2 focus-visible:ring-orange-300 focus-visible:ring-offset-2 focus-visible:ring-offset-zinc-950",children:o.jsxs("article",{className:"group relative isolate aspect-video overflow-hidden rounded-2xl border border-orange-200/20 bg-zinc-900/75 shadow-(--card-shadow-base) transition-all duration-300 hover:-translate-y-0.5 hover:border-orange-300/45 hover:shadow-(--card-shadow-hover)",style:l,children:[o.jsx("div",{className:"absolute inset-0 transition-transform duration-500 group-hover:scale-105",children:o.jsx(mv,{event:n})}),o.jsx("div",{className:"absolute inset-0 opacity-45",style:r}),o.jsx("div",{className:"absolute inset-0 bg-linear-to-b from-zinc-950/10 via-zinc-950/50 to-zinc-950/75"}),o.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-0.5 opacity-90",style:{background:"var(--card-top-line)"}}),i&&o.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center px-4",children:o.jsxs("div",{className:"w-full max-w-sm rounded-xl border border-orange-300/40 bg-black/55 px-4 py-4 text-center text-orange-50 shadow-[0_20px_45px_rgba(0,0,0,0.5)] backdrop-blur-md",children:[o.jsxs("p",{className:"inline-flex items-center justify-center gap-2 text-[11px] font-bold uppercase tracking-[0.16em] text-orange-200",children:[o.jsx(lv,{className:"h-4 w-4"}),"Starts In"]}),o.jsx("p",{className:"mt-2 text-3xl font-black tracking-tight md:text-4xl",children:FL(t)})]})}),o.jsxs("div",{className:"relative flex h-full flex-col p-4 md:p-5",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx("span",{className:"rounded-md border border-orange-200/30 bg-black/50 px-3 py-1 text-[10px] font-bold uppercase tracking-[0.16em] text-orange-100 backdrop-blur",children:n.category||n.league||"Event"}),o.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-[10px] font-bold uppercase tracking-widest backdrop-blur ${HL(n.status)}`,children:[n.status==="live"&&o.jsx(ul,{className:"h-3 w-3 animate-pulse"}),VL(n.status)]})]}),o.jsxs("div",{className:"mt-auto",children:[o.jsx("p",{className:"mb-2 line-clamp-2 text-lg font-extrabold uppercase leading-tight text-white drop-shadow-md md:text-xl",children:n.name}),!i&&o.jsxs("p",{className:"mb-3 text-xs font-semibold uppercase tracking-[0.18em] text-orange-100/90 drop-shadow-sm",children:["Kickoff: ",BL(n.startsAt)]})]})]})]})})}function YL(n){if(!n)return null;const e=Date.parse(n);return Number.isFinite(e)?e:null}function KL(n){const e=Math.max(0,Math.floor(n/1e3)),t=Math.floor(e/86400),i=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),l=e%60;return t>0?[{label:"Days",value:String(t).padStart(2,"0")},{label:"Hours",value:String(i).padStart(2,"0")},{label:"Minutes",value:String(r).padStart(2,"0")},{label:"Seconds",value:String(l).padStart(2,"0")}]:[{label:"Hours",value:String(i).padStart(2,"0")},{label:"Minutes",value:String(r).padStart(2,"0")},{label:"Seconds",value:String(l).padStart(2,"0")}]}function vS(n){if(!n)return"TBA";const e=YL(n);return e===null?"TBA":new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(e)}function ZL(n){return n==="live"?"border-rose-300/60 bg-rose-500/30 text-rose-100 shadow-[0_0_15px_rgba(244,63,94,0.4)]":n==="upcoming"?"border-orange-300/50 bg-orange-500/20 text-orange-100":"border-zinc-300/40 bg-zinc-500/20 text-zinc-100"}function QL(n){return n==="live"?"Live":n==="upcoming"?"Upcoming":"Ended"}function JL({digit:n}){const[e,t]=E.useState(n),[i,r]=E.useState(n),[l,u]=E.useState(0),[h,d]=E.useState(!1),p=E.useRef(null);if(E.useEffect(()=>{if(n!==i)return p.current!==null&&window.clearTimeout(p.current),t(i),r(n),d(!0),u(0),requestAnimationFrame(()=>{u(1)}),p.current=window.setTimeout(()=>{d(!1),u(0),t(n),p.current=null},240),()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)}},[n,i]),!h)return o.jsx("span",{className:"relative inline-flex h-[1em] w-[0.68em] items-center justify-center overflow-hidden align-baseline",children:o.jsx("span",{children:i})});const m="transform 240ms cubic-bezier(0.25, 0.75, 0.25, 1)";return o.jsxs("span",{className:"relative inline-flex h-[1em] w-[0.68em] items-center justify-center overflow-hidden align-baseline",children:[o.jsx("span",{className:"absolute inset-0 flex items-center justify-center",style:{transform:`translateY(${l*100}%)`,transition:m},children:e}),o.jsx("span",{className:"absolute inset-0 flex items-center justify-center",style:{transform:`translateY(${(l-1)*100}%)`,transition:m},children:i})]})}function eP({value:n}){return o.jsx("span",{className:"inline-flex items-center justify-center gap-[0.02em]",children:Array.from(n).map((e,t)=>/\d/.test(e)?o.jsx(JL,{digit:e},`${t}-${e}`):o.jsx("span",{className:"inline-flex h-[1em] items-center justify-center",children:e},`${t}-${e}`))})}function tP({event:n,isUpcoming:e,countdownMs:t,updatedAt:i}){const r=e&&t!==null?KL(t):[];return o.jsxs("section",{className:"relative mb-8 w-full",children:[o.jsx("div",{className:"absolute inset-x-0 top-0 z-20 h-1 bg-linear-to-r from-orange-500 via-orange-300 to-orange-500"}),o.jsxs("div",{className:"relative h-105 w-full sm:h-115 md:h-110 lg:h-115",children:[o.jsx("div",{className:"absolute inset-0 md:left-1/2",children:o.jsx(mv,{event:n})}),o.jsx("div",{className:"absolute inset-0 bg-linear-to-t from-zinc-950/88 via-zinc-950/45 to-zinc-950/25 md:hidden"}),o.jsx("div",{className:"absolute inset-y-0 left-0 hidden w-1/2 bg-zinc-950/94 md:block"}),o.jsx("div",{className:"absolute inset-0 hidden bg-linear-to-r from-zinc-950 via-zinc-950/96 via-55% to-zinc-950/18 md:block"}),o.jsxs("div",{className:"relative z-10 flex h-full max-w-3xl flex-col justify-end px-4 pb-10 pt-28 md:max-w-[50%] md:justify-center md:px-12 md:pb-12 md:pt-18",children:[o.jsx("p",{className:"mb-3 text-[11px] font-bold uppercase tracking-[0.34em] text-orange-100/85",children:"Featured Live Match"}),o.jsx("h1",{className:"text-3xl font-black uppercase leading-tight text-white drop-shadow-md md:text-5xl",children:n.name}),o.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2 text-xs font-semibold uppercase tracking-[0.14em] text-zinc-200",children:[o.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full border px-3 py-1 backdrop-blur ${ZL(n.status)}`,children:[n.status==="live"&&o.jsx(ul,{className:"h-3 w-3 animate-pulse"}),e?"Upcoming":QL(n.status)]}),o.jsx("span",{className:"rounded-full border border-white/20 bg-black/40 px-3 py-1",children:n.category||n.league||"Event"}),o.jsxs("span",{className:"rounded-full border border-white/20 bg-black/40 px-3 py-1",children:["Kickoff ",vS(n.startsAt)]})]}),o.jsx("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:o.jsx(Ut,{to:n.watchPath,className:"inline-flex items-center justify-center rounded-md border border-orange-200/45 bg-orange-500/30 px-6 py-2.5 text-sm font-bold uppercase tracking-[0.12em] text-orange-50 transition hover:bg-orange-400/35",children:"Open Match"})})]}),e&&t!==null&&o.jsx("div",{className:"pointer-events-none absolute right-4 top-1/2 z-10 hidden -translate-y-1/2 md:block lg:right-8",children:o.jsxs("div",{className:"rounded-2xl border border-orange-300/35 bg-zinc-950/70 p-4 shadow-[0_18px_55px_rgba(0,0,0,0.45)] backdrop-blur-xl lg:p-5",children:[o.jsx("p",{className:"mb-3 text-center text-[11px] font-bold uppercase tracking-[0.28em] text-orange-200/90",children:"Starts In"}),o.jsx("div",{className:"flex items-stretch gap-2 lg:gap-3",children:r.map(l=>o.jsxs("div",{className:"min-w-18 rounded-xl border border-orange-300/35 bg-orange-500/14 px-3 py-2 text-center shadow-[inset_0_0_0_1px_rgba(255,255,255,0.03)] lg:min-w-24 lg:px-4 lg:py-3",children:[o.jsx("p",{className:"text-2xl font-black leading-none tracking-tight text-orange-50 tabular-nums lg:text-4xl",children:o.jsx(eP,{value:l.value})}),o.jsx("p",{className:"mt-1 text-[10px] font-bold uppercase tracking-[0.22em] text-orange-200/80 lg:text-[11px]",children:l.label})]},l.label))}),o.jsxs("p",{className:"mt-3 text-center text-[10px] uppercase tracking-[0.16em] text-zinc-400",children:["Feed sync ",i?vS(i):"Connecting..."]})]})})]})]})}
66const nP="https://watch-server-production-c01b.up.railway.app/api",iP=6e4,sP=3e4,rP=2500,aP=250;function yS(n){const e=n.toLowerCase(),t="h-5 w-5";return e==="live now"?o.jsx("svg",{viewBox:"0 0 24 24",className:t,fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:o.jsx("path",{d:"M6.34277267,4.93867691 C6.73329697,5.3292012 6.73329697,5.96236618 6.34277267,6.35289047 C3.21757171,9.47809143 3.21757171,14.5450433 6.34277267,17.6702443 C6.73329697,18.0607686 6.73329697,18.6939336 6.34277267,19.0844579 C5.95224838,19.4749821 5.3190834,19.4749821 4.92855911,19.0844579 C1.02230957,15.1782083 1.02230957,8.84492646 4.92855911,4.93867691 C5.3190834,4.54815262 5.95224838,4.54815262 6.34277267,4.93867691 Z M19.0743401,4.93867691 C22.9805896,8.84492646 22.9805896,15.1782083 19.0743401,19.0844579 C18.6838158,19.4749821 18.0506508,19.4749821 17.6601265,19.0844579 C17.2696022,18.6939336 17.2696022,18.0607686 17.6601265,17.6702443 C20.7853275,14.5450433 20.7853275,9.47809143 17.6601265,6.35289047 C17.2696022,5.96236618 17.2696022,5.3292012 17.6601265,4.93867691 C18.0506508,4.54815262 18.6838158,4.54815262 19.0743401,4.93867691 Z M9.3094225,7.81205295 C9.69994679,8.20257725 9.69994679,8.83574222 9.3094225,9.22626652 C7.77845993,10.7572291 7.77845993,13.2394099 9.3094225,14.7703724 C9.69994679,15.1608967 9.69994679,15.7940617 9.3094225,16.184586 C8.91889821,16.5751103 8.28573323,16.5751103 7.89520894,16.184586 C5.58319778,13.8725748 5.58319778,10.1240641 7.89520894,7.81205295 C8.28573323,7.42152866 8.91889821,7.42152866 9.3094225,7.81205295 Z M16.267742,7.81205295 C18.5797531,10.1240641 18.5797531,13.8725748 16.267742,16.184586 C15.8772177,16.5751103 15.2440527,16.5751103 14.8535284,16.184586 C14.4630041,15.7940617 14.4630041,15.1608967 14.8535284,14.7703724 C16.384491,13.2394099 16.384491,10.7572291 14.8535284,9.22626652 C14.4630041,8.83574222 14.4630041,8.20257725 14.8535284,7.81205295 C15.2440527,7.42152866 15.8772177,7.42152866 16.267742,7.81205295 Z M12.0814755,10.5814755 C12.9099026,10.5814755 13.5814755,11.2530483 13.5814755,12.0814755 C13.5814755,12.9099026 12.9099026,13.5814755 12.0814755,13.5814755 C11.2530483,13.5814755 10.5814755,12.9099026 10.5814755,12.0814755 C10.5814755,11.2530483 11.2530483,10.5814755 12.0814755,10.5814755 Z",fill:"currentColor"})}):e.includes("baseball")?o.jsxs("svg",{viewBox:"0 0 24 24",className:t,fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[o.jsx("path",{d:"M5.51971 11.6679C5.38628 12.0125 4.9682 12.1706 4.61602 12.0587C4.26384 11.9468 4.07911 11.593 4.17097 11.2351L4.30609 10.7086C4.41418 10.2874 4.80736 10.021 5.22175 10.1526C5.63614 10.2843 5.87297 10.7555 5.71598 11.161L5.51971 11.6679Z",fill:"currentColor"}),o.jsx("path",{d:"M8.01677 12.9936C7.80606 13.2969 7.37725 13.3614 7.06167 13.1697C6.74609 12.9779 6.63437 12.5827 6.80738 12.2565L7.06187 11.7766C7.26583 11.392 7.72803 11.2343 8.10009 11.4604C8.47215 11.6864 8.57514 12.1901 8.32672 12.5476L8.01677 12.9936Z",fill:"currentColor"}),o.jsx("path",{d:"M9.17133 14.8286C8.90951 14.5668 8.88327 14.1441 9.12924 13.8673L9.48892 13.4626C9.77806 13.1372 10.2777 13.1066 10.5855 13.4144C10.8933 13.7222 10.8627 14.2218 10.5373 14.511L10.1326 14.8707C9.85584 15.1166 9.43315 15.0904 9.17133 14.8286Z",fill:"currentColor"}),o.jsx("path",{d:"M11.7434 17.1925C11.4172 17.3655 11.022 17.2538 10.8302 16.9382C10.6385 16.6227 10.7031 16.1939 11.0063 15.9831L11.4523 15.6732C11.8098 15.4248 12.3135 15.5278 12.5395 15.8998C12.7656 16.2719 12.6079 16.7341 12.2233 16.938L11.7434 17.1925Z",fill:"currentColor"}),o.jsx("path",{d:"M12.7648 19.8289C12.4069 19.9208 12.0531 19.7361 11.9412 19.3839C11.8293 19.0317 11.9874 18.6136 12.332 18.4802L12.839 18.2839C13.2444 18.1269 13.7156 18.3638 13.8473 18.7782C13.979 19.1926 13.7125 19.5857 13.2913 19.6938L12.7648 19.8289Z",fill:"currentColor"}),o.jsx("path",{d:"M19.829 12.7649C19.9209 12.407 19.7362 12.0532 19.384 11.9413C19.0318 11.8294 18.6137 11.9875 18.4803 12.3321L18.284 12.839C18.127 13.2445 18.3639 13.7157 18.7782 13.8474C19.1926 13.979 19.5858 13.7126 19.6939 13.2914L19.829 12.7649Z",fill:"currentColor"}),o.jsx("path",{d:"M17.1926 11.7435C17.3656 11.4173 17.2539 11.0221 16.9383 10.8303C16.6228 10.6386 16.1939 10.7031 15.9832 11.0064L15.6733 11.4524C15.4249 11.8099 15.5279 12.3136 15.8999 12.5396C16.272 12.7657 16.7342 12.608 16.9381 12.2234L17.1926 11.7435Z",fill:"currentColor"}),o.jsx("path",{d:"M14.8708 10.1327C15.1167 9.85592 15.0905 9.43324 14.8287 9.17142C14.5668 8.9096 14.1442 8.88336 13.8674 9.12932L13.4627 9.489C13.1373 9.77815 13.1067 10.2778 13.4145 10.5856C13.7223 10.8934 14.2219 10.8628 14.5111 10.5374L14.8708 10.1327Z",fill:"currentColor"}),o.jsx("path",{d:"M12.9937 8.01685C13.2969 7.80615 13.3615 7.37733 13.1698 7.06175C12.978 6.74618 12.5828 6.63446 12.2566 6.80746L11.7767 7.06195C11.3921 7.26592 11.2344 7.72812 11.4605 8.10017C11.6865 8.47223 12.1902 8.57523 12.5477 8.32681L12.9937 8.01685Z",fill:"currentColor"}),o.jsx("path",{d:"M11.668 5.51979C12.0126 5.38637 12.1707 4.96829 12.0588 4.61611C11.9469 4.26393 11.5931 4.0792 11.2352 4.17106L10.7087 4.30618C10.2875 4.41426 10.021 4.80745 10.1527 5.22184C10.2844 5.63623 10.7556 5.87306 11.161 5.71606L11.668 5.51979Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22.9999 11.9998C22.9999 18.0749 18.075 22.9998 11.9999 22.9998C5.92478 22.9998 0.999908 18.0749 0.999908 11.9998C0.999908 5.92462 5.92478 0.999756 11.9999 0.999756C18.075 0.999756 22.9999 5.92462 22.9999 11.9998ZM3.00674 11.9998C3.00674 16.9665 7.03312 20.9929 11.9999 20.9929C16.9667 20.9929 20.9931 16.9665 20.9931 11.9998C20.9931 7.03297 16.9667 3.00659 11.9999 3.00659C7.03312 3.00659 3.00674 7.03297 3.00674 11.9998Z",fill:"currentColor"})]}):e.includes("football")?o.jsx("svg",{viewBox:"0 0 24 24",className:t,fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.9999 22.9998C18.075 22.9998 22.9999 18.0749 22.9999 11.9998C22.9999 5.92462 18.075 0.999756 11.9999 0.999756C5.92478 0.999756 0.999908 5.92462 0.999908 11.9998C0.999908 18.0749 5.92478 22.9998 11.9999 22.9998ZM3.02676 12.6047C3.08664 13.5062 3.27939 14.3715 3.5856 15.181L7.66338 15.9224L8.78323 14.8025L7.25464 11.7454L5.99999 11.118L3.02676 12.6047ZM4.83959 17.4418C5.74823 18.6355 6.94856 19.5951 8.3343 20.2144L7.30091 17.8893L4.83959 17.4418ZM10.8358 20.9183C11.2168 20.9675 11.6054 20.9929 11.9999 20.9929C12.3945 20.9929 12.7831 20.9675 13.1642 20.9182L14.8072 17.2215L13.5858 16H10.4142L9.19274 17.2215L10.8358 20.9183ZM15.6657 20.2143C17.0514 19.595 18.2516 18.6354 19.1602 17.4418L16.6991 17.8893L15.6657 20.2143ZM3.16748 10.2982L4.86962 9.44715L4.41375 7.16782C3.81434 8.10693 3.38453 9.16479 3.16748 10.2982ZM6.06786 5.24032L6.88466 9.3243L7.89442 9.82918L11 7.5V6.11803L7.35671 4.29639C6.89885 4.57295 6.46765 4.88918 6.06786 5.24032ZM9.79419 3.27906L12 4.38197L14.2057 3.27909C13.4999 3.10112 12.761 3.00659 11.9999 3.00659C11.2389 3.00659 10.5 3.10111 9.79419 3.27906ZM16.6432 4.29644L13 6.11803V7.5L16.1056 9.82918L17.1153 9.3243L17.9321 5.24044C17.5323 4.88928 17.1011 4.57302 16.6432 4.29644ZM19.5862 7.16802L19.1304 9.44715L20.8323 10.2981C20.6153 9.16481 20.1855 8.10706 19.5862 7.16802ZM20.9731 12.6046L18 11.118L16.7453 11.7454L15.2168 14.8025L16.3366 15.9224L20.4142 15.181C20.7204 14.3715 20.9132 13.5062 20.9731 12.6046ZM9.26765 11.2993L12 9.25L14.7323 11.2993L13.382 14H10.618L9.26765 11.2993Z",fill:"currentColor"})}):e.includes("cricket")?o.jsx("svg",{viewBox:"0 0 24 24",className:t,fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:o.jsx("path",{d:"M4.152,21a3.15,3.15,0,0,1-2.229-5.379l3.805-3.8.7-.824-.7.716a2.01,2.01,0,0,1-.612-1.443,2.1,2.1,0,0,1,.611-1.492l6.849-6.848a3.155,3.155,0,0,1,4.457,0l3.044,3.044a3.158,3.158,0,0,1,0,4.458,1,1,0,0,1-1.415-1.414,1.155,1.155,0,0,0,0-1.63L15.619,3.337a1.154,1.154,0,0,0-1.629,0L7.142,10.186a2.523,2.523,0,0,1,.608,1.563,2.058,2.058,0,0,1-.609,1.48l-3.8,3.8a1.153,1.153,0,0,0,1.63,1.63l3.369-3.37A1,1,0,0,1,9.75,16.707l
66-3.369,3.37A3.143,3.143,0,0,1,4.152,21ZM23,17a6,6,0,1,1-6-6A6.006,6.006,0,0,1,23,17Zm-2,0a4,4,0,1,0-4,4A4,4,0,0,0,21,17Z",fill:"currentColor"})}):e.includes("basketball")?o.jsx("svg",{viewBox:"0 0 24 24",className:t,fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21.5262 17.4999C18.4887 22.7611 11.7612 24.5637 6.49994 21.5262C1.23873 18.4886 -0.563901 11.7611 2.47367 6.49988C5.51123 1.23866 12.2387 -0.563962 17.4999 2.4736C22.7612 5.51117 24.5638 12.2387 21.5262 17.4999ZM5.84382 7.87995C5.25279 7.64272 4.74291 7.45257 4.3292 7.30543C5.59153 5.24057 7.56267 3.85898 9.74648 3.29362C9.77176 3.62621 9.82851 4.00289 9.93722 4.40861C10.3269 5.86297 11.3579 7.58777 13.75 8.96886C14.0666 9.15165 14.3765 9.31079 14.6793 9.44842C14.4757 10.219 14.1794 11.0351 13.7614 11.8848C13.3566 11.6365 12.936 11.3857 12.5 11.1339C9.85449 9.60655 7.52076 8.55305 5.84382 7.87995ZM12.7587 13.6161C12.3555 13.3682 11.9358 13.1176 11.5 12.866C8.94938 11.3934 6.70297 10.3799 5.09882 9.73602C4.44209 9.47241 3.89359 9.27099 3.47664 9.12556C2.8887 10.8629 2.86217 12.7007 3.33339 14.4015C3.63406 14.2571 3.98864 14.1179 4.39435 14.0092C5.84872 13.6195 7.85792 13.65 10.25 15.0311C10.5667 15.2139 10.8594 15.4027 11.13 15.5961C11.6875 15.0424 12.2384 14.3885 12.7587 13.6161ZM12.6204 16.9341C13.4037 17.8315 13.839 18.756 14.0628 19.5913C14.1715 19.997 14.2283 20.3736 14.2536 20.7061C15.962 20.2638 17.5403 19.3219 18.7509 17.9441C18.4164 17.6557 17.9678 17.2815 17.4112 16.8446C16.6284 16.2301 15.633 15.4925 14.4426 14.6962C13.8639 15.5605 13.2482 16.3006 12.6204 16.9341ZM9.52737 16.9296C9.43788 16.8737 9.34548 16.8182 9.25005 16.7631C7.31205 15.6442 5.84818 15.6902 4.91199 15.9411C4.58 16.03 4.30141 16.1484 4.0805 16.2639C4.53358 17.1073 5.12461 17.8846 5.84359 18.5583C5.87614 18.5513 5.90977 18.5439 5.94444 18.5361C6.44532 18.4223 7.15871 18.2112 7.97658 17.8245C8.4626 17.5947 8.98712 17.3022 9.52737 16.9296ZM7.92672 20.018C8.21347 19.909 8.51642 19.7815 8.83145 19.6326C9.54844 19.2936 10.3256 18.8442 11.1145 18.2503C11.6989 18.9202 11.9873 19.5728 12.131 20.109C12.2199 20.4409 12.2567 20.7413 12.2672 20.9903C10.8031 21.0352 9.31171 20.7231 7.92672 20.018ZM18.6461 15.2714C17.8061 14.612 16.7364 13.8204 15.4558 12.968C15.9672 11.9634 16.3317 10.9922 16.5833 10.0701C17.7521 10.2998 18.7704 10.2145 19.6057 9.99072C20.0114 9.88202 20.3659 9.74284 20.6666 9.59846C21.2688 11.7723 21.0579 14.1701 19.9008 16.2957C19.5666 16.011 19.147 15.6645 18.6461 15.2714ZM16.9702 8.10789C17.8425 8.27902 18.5519 8.20254 19.0881 8.05887C19.42 7.96992 19.6986 7.85154 19.9195 7.73607C19.2263 6.44565 18.2102 5.3101 16.907 4.46319C16.956 4.76614 16.9971 5.09234 17.0257 5.43977C17.0906 6.23015 17.09 7.1278 16.9702 8.10789ZM15.0328 7.39372C15.0854 6.73963 15.0764 6.13922 15.0324 5.60348C14.9583 4.70183 14.7845 3.97847 14.6326 3.4878C14.622 3.45374 14.6116 3.42082 14.6013 3.38905C13.6584 3.10331 12.6898 2.9801 11.7329 3.00943C11.7433 3.2585 11.7801 3.55897 11.8691 3.89097C12.1199 4.82716 12.812 6.11791 14.75 7.23681C14.8454 7.2919 14.9397 7.34416 15.0328 7.39372Z",fill:"currentColor"})}):e.includes("hockey")?o.jsxs("svg",{viewBox:"0 0 24 24",className:t,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M6 7l5 7 6-.7"}),o.jsx("rect",{x:"8",y:"16",width:"8",height:"4",rx:"2"})]}):e.includes("dart")?o.jsxs("svg",{viewBox:"0 0 24 24",className:t,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M20 4l-8 8"}),o.jsx("path",{d:"M9 15l-5 5"}),o.jsx("path",{d:"M12 4h8v8"})]}):e.includes("arm wrestling")||e.includes("wrestling")||e.includes("combat")?o.jsxs("svg",{viewBox:"0 0 24 24",className:t,fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[o.jsx("path",{d:"M8.48901 17.7273H18.3556M8.48901 17.7273V21H18.3556V17.7273M8.48901 17.7273C5.20016 15.5455 3.55573 10.0909 4.10387 8.45455C4.54239 7.14545 6.47916 7.54545 7.39273 7.90909C7.39273 4.09091 9.03715 3 13.4223 3C17.8074 3 20 4.09091 20 9.54545C20 13.9091 18.9037 16.8182 18.3556 17.7273",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M7.39282 7.90909C7.75825 8.27272 8.81799 9 10.1335 9C11.4491 9 13.9705 9 15.0668 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M7.39282 7.90909C7.39282 11.7273 9.03725 12.2727 10.1335 12.2727",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}):o.jsx("svg",{viewBox:"0 0 24 24",className:t,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o.jsx("path",{d:"M12 3l2.4 4.9L20 8.7l-4 3.9.9 5.5L12 15.7l-4.9 2.4.9-5.5-4-3.9 5.6-.8L12 3z"})})}
66function gv(n){if(!n)return null;const e=Date.parse(n);return Number.isFinite(e)?e:null}function oP(n){const e=Math.max(0,Math.floor(n/1e3)),t=Math.floor(e/86400),i=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),l=e%60;return t>0?`${t}d ${i.toString().padStart(2,"0")}h ${r.toString().padStart(2,"0")}m ${l.toString().padStart(2,"0")}s`:`${i.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}`}function lP(n){if(!n)return"TBA";const e=gv(n);return e===null?"TBA":new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(e)}function _S(n){if(!n)return"--";const e=n.split(/\s+/).map(t=>t.trim()).filter(Boolean);return e.length===0?"--":e.length===1?e[0].slice(0,3).toUpperCase():`${e[0][0]||""}${e[1][0]||""}`.toUpperCase()}function cP(n){return n==="live"?"border-rose-300/60 bg-rose-500/30 text-rose-100 shadow-[0_0_15px_rgba(244,63,94,0.4)]":n==="upcoming"?"border-orange-300/50 bg-orange-500/20 text-orange-100":"border-zinc-300/40 bg-zinc-500/20 text-zinc-100"}function uP(n){return n==="live"?"Live":n==="upcoming"?"Upcoming":"Ended"}function dP(n,e){const t=gv(n.startsAt);return t===null?null:t-e}function hP(n){const e=n.team1?.trim()||"Team 1",t=n.team2?.trim()||"Team 2";return`${e} vs ${t}`}function fP(n){return{team1Logo:n.thumbnail.logoTeam1||n.sources.streamcenter?.logoTeam1||null,team2Logo:n.thumbnail.logoTeam2||n.sources.streamcenter?.logoTeam2||null}}function pP(n){if(!n)return[];const e=n.split(";").map(i=>i.trim()).filter(Boolean).map((i,r)=>{const l=i.indexOf("<"),u=(l>=0?i.slice(0,l):i).trim(),h=(l>=0?i.slice(l+1):"").trim();return u?{url:u,label:h||`Server ${r+1}`}:null}).filter(i=>!!i),t=new Map;return e.forEach(i=>{t.has(i.url)||t.set(i.url,i)}),Array.from(t.values())}function mP(n){if(!n)return{selectedUrl:null,options:[]};const e=pP(n.sources.streamcenter?.videoUrl||null),t=n.streamUrl?.trim()||null;if(e.length>0){const i=[...e];return t&&!i.some(r=>r.url===t)&&i.push({label:"Default",url:t}),{selectedUrl:e[0].url,options:i}}return t?{selectedUrl:t,options:[{label:"Default",url:t}]}:{selectedUrl:null,options:[]}}async function D5(){const n=await fetch(`${nP}/sports/live`,{headers:{Accept:"application/json"}});if(!n.ok){const t=await n.text().catch(()=>"");throw new Error(t||n.statusText||"Failed to fetch sports feed.")}const e=await n.json();return{updatedAt:typeof e.updatedAt=="string"?e.updatedAt:new Date().toISOString(),total:Number.isFinite(e.total)?e.total:Array.isArray(e.events)?e.events.length:0,warnings:Array.isArray(e.warnings)?e.warnings:[],events:Array.isArray(e.events)?e.events:[]}}function gP(){const[n,e]=Ki(),[t,i]=E.useState([]),[r,l]=E.useState([]),[u,h]=E.useState(!0),[d,p]=E.useState(null),[m,g]=E.useState(""),[b,y]=E.useState(()=>Date.now()),_=n.get("category")?.trim()||"Live Now",C=O=>{const R=new URLSearchParams(n);O==="Live Now"?R.delete("category"):R.set("category",O),e(R),window.scrollTo({top:0,behavior:"smooth"})};E.useEffect(()=>{let O=!1;const R=async M=>{M&&h(!0);try{const P=await D5();if(O)return;i(P.events),l(P.warnings),g(P.updatedAt),p(null)}catch(P){if(O)return;p(P instanceof Error?P.message:"Failed to load live sports.")}finally{!O&&M&&h(!1)}};R(!0);const z=window.setInterval(()=>{R(!1)},iP);return()=>{O=!0,window.clearInterval(z)}},[]),E.useEffect(()=>{const O=window.setInterval(()=>{y(Date.now())},1e3);return()=>{window.clearInterval(O)}},[]);const w=E.useMemo(()=>{const O={"Live Now":0,Football:0,Baseball:0,Hockey:0,Basketball:0,Wrestling:0,Cricket:0};return t.forEach(R=>{R.status==="live"&&O["Live Now"]++;const z=(R.category||R.league||"").toLowerCase();z.includes("football")?O.Football++:z.includes("baseball")?O.Baseball++:z.includes("hockey")?O.Hockey++:z.includes("basketball")?O.Basketball++:z.includes("wrestling")||z.includes("combat")||z.includes("arm wrestling")||z.includes("ufc")||z.includes("wwe")||z.includes("aew")?O.Wrestling++:z.includes("cricket")&&O.Cricket++}),Object.entries(O).map(([R,z])=>({name:R,count:z})).filter(R=>R.name==="Live Now"||R.count>0)},[t]),S=E.useMemo(()=>_==="Live Now"?t.filter(O=>O.status==="live"):t.filter(O=>{const R=(O.category||O.league||"").toLowerCase();return _==="Football"?R.includes("football"):_==="Baseball"?R.includes("baseball"):_==="Hockey"?R.includes("hockey"):_==="Basketball"?R.includes("basketball"):_==="Wrestling"?R.includes("wrestling")||R.includes("combat")||R.includes("arm wrestling")||R.includes("ufc")||R.includes("wwe")||R.includes("aew"):_==="Cricket"?R.includes("cricket"):!1}),[t,_]),T=E.useMemo(()=>{const O=S.length>0?S:t;if(O.length===0)return null;const R=O.filter(M=>M.status==="live"&&!!M.streamUrl);if(R.length>0)return R[Math.floor(Math.random()*R.length)];const z=O.filter(M=>M.status==="live");return z.length>0?z[Math.floor(Math.random()*z.length)]:O[0]},[t,S]),N=T?dP(T,b):null,j=!!(T&&N!==null&&N>0);return o.jsxs("div",{className:"relative w-full overflow-visible px-4 pb-12 pt-18 md:px-12 md:pt-20",children:[o.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[linear-gradient(to_right,rgba(255,255,255,0.04)_1px,transparent_1px),linear-gradient(to_bottom,rgba(255,255,255,0.04)_1px,transparent_1px)] bg-size-[44px_44px] opacity-35"}),o.jsxs("div",{className:"pointer-events-none absolute inset-0",children:[o.jsx("div",{className:"absolute -left-20 top-24 h-72 w-72 rounded-full bg-orange-500/10 blur-3xl"}),o.jsx("div",{className:"absolute right-0 top-12 h-80 w-80 rounded-full bg-[#E25E0C]/20 blur-3xl"})]}),T&&o.jsx("div",{className:"-mx-4 md:-mx-12",children:o.jsx(tP,{event:T,isUpcoming:j,countdownMs:N,updatedAt:m})}),w.length>1&&o.jsx("div",{className:"fixed inset-x-0 pb-2 bottom-[calc(4.3rem+env(safe-area-inset-bottom))] z-[110] border-t border-white/15 bg-zinc-950/95 px-1 pt-1.5 backdrop-blur-lg grid grid-cols-7 max-w-full gap-0.5 md:flex md:w-auto md:relative md:bottom-auto md:z-auto md:mb-8 md:border-none md:bg-transparent md:px-0 md:pt-0 md:backdrop-blur-none md:flex-wrap md:items-center md:gap-2 md:pb-2 md:scrollbar-none items-center",children:w.map(O=>o.jsxs("button",{onClick:()=>C(O.name),className:`flex flex-col items-center justify-center rounded-xl px-0 py-1.5 text-[0.6rem] font-semibold transition ${_===O.name?"bg-
66orange-500/18 text-orange-200 shadow-[0_4px_20px_-5px_rgba(226,94,12,0.3)]":"text-zinc-400 hover:bg-white/8 hover:text-zinc-100"} md:inline-flex md:w-auto md:flex-row md:items-center md:whitespace-nowrap md:rounded-md md:border md:px-4 md:py-2 md:text-xs md:font-bold md:uppercase md:tracking-[0.14em] md:bg-zinc-900/60 md:shadow-none ${_===O.name?"md:border-orange-300/60 md:bg-orange-500 md:text-white md:shadow-[0_0_20px_rgba(226,94,12,0.3)]":"md:border-white/10 md:text-zinc-300 md:hover:border-orange-200/30 md:hover:bg-zinc-800/70 md:hover:text-orange-100"}`,children:[o.jsxs("div",{className:"mb-0.5 text-current md:hidden relative inline-flex items-center justify-center",children:[yS(O.name),o.jsx("span",{className:`absolute -right-3 -top-1 flex h-3.5 min-w-[14px] items-center justify-center rounded-full px-1 text-[8px] font-bold ${_===O.name?"bg-orange-500 text-white":"bg-white/10 text-zinc-100"}`,children:O.count})]}),o.jsx("span",{className:"md:hidden mt-0.5 text-[10px] leading-none whitespace-nowrap overflow-hidden text-ellipsis w-[95%] text-center",children:O.name}),o.jsxs("span",{className:"hidden md:inline-flex md:items-center gap-2.5",children:[o.jsx("span",{className:"text-current/90",children:yS(O.name)}),o.jsx("span",{children:O.name}),o.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] leading-none ${_===O.name?"bg-black/25 text-white":"bg-white/10 text-zinc-200"}`,children:O.count})]})]},O.name))}),r.length>0&&o.jsx("div",{className:"mb-6 rounded-xl border border-amber-300/40 bg-amber-500/10 px-4 py-3 text-sm text-amber-100 backdrop-blur-md",children:r.join(" | ")}),u&&o.jsx("div",{className:"flex min-h-88 items-center justify-center rounded-2xl border border-white/10 bg-zinc-900/50 shadow-[0_18px_50px_rgba(0,0,0,0.45)]",children:o.jsx("p",{className:"text-zinc-200 font-semibold animate-pulse",children:"Scanning live feeds..."})}),!u&&d&&t.length===0&&o.jsxs("div",{className:"rounded-2xl border border-rose-300/40 bg-rose-500/10 px-5 py-8 text-rose-100 backdrop-blur-md shadow-[0_18px_50px_rgba(0,0,0,0.45)] text-center",children:[o.jsx("p",{className:"font-extrabold text-xl mb-2",children:"Connection Error"}),o.jsx("p",{className:"text-sm",children:d})]}),!u&&!d&&t.length===0&&o.jsxs("div",{className:"rounded-2xl border border-white/10 bg-zinc-900/55 px-5 py-8 text-zinc-200 text-center shadow-[0_18px_50px_rgba(0,0,0,0.45)]",children:[o.jsx("p",{className:"text-xl font-extrabold mb-2",children:"No live feeds available"}),o.jsx("p",{className:"text-sm text-zinc-400",children:"Please check back later or check another category."})]}),!u&&S.length===0&&t.length>0&&o.jsxs("div",{className:"rounded-2xl border flex items-center flex-col justify-center border-white/10 bg-zinc-900/55 min-h-88 px-5 py-8 text-zinc-200 text-center shadow-[0_18px_50px_rgba(0,0,0,0.45)]",children:[o.jsx("p",{className:"text-lg font-bold mb-2",children:"No events match this category"}),o.jsx("button",{onClick:()=>C("Live Now"),className:"text-[#E25E0C] hover:underline font-semibold text-sm",children:"Switch to Live Now"})]}),!u&&S.length>0&&o.jsx("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:S.map(O=>o.jsx(XL,{event:O,nowMs:b},O.id))})]})}function xP(){const{slug:n=""}=nv(),[e,t]=E.useState([]),[i,r]=E.useState([]),[l,u]=E.useState(!0),[h,d]=E.useState(null),[p,m]=E.useState(()=>Date.now()),[g,b]=E.useState(!0),[y,_]=E.useState(!1),[C,w]=E.useState(null),S=E.useRef(null),T=E.useRef(Date.now()),N=E.useRef(!1),{isMobile:j,isLoading:O}=M5();E.useEffect(()=>{let D=!1;const H=async Ee=>{Ee&&u(!0);try{const je=await D5();if(D)return;t(je.events),r(je.warnings),d(null)}catch(je){if(D)return;d(je instanceof Error?je.message:"Failed to load match center.")}finally{!D&&Ee&&u(!1)}};H(!0);const Z=window.setInterval(()=>{H(!1)},sP);return()=>{D=!0,window.clearInterval(Z)}},[]),E.useEffect(()=>{const D=window.setInterval(()=>{m(Date.now())},1e3);return()=>{window.clearInterval(D)}},[]);const R=E.useMemo(()=>e.find(D=>D.slug===n||D.id===n)||null,[e,n]),z=R?gv(R.startsAt):null,M=R&&z!==null?z-p:null,P=!!(R&&M!==null&&M>0),G=E.useMemo(()=>mP(R),[R]),U=G.options,Y=C||G.selectedUrl,W=!P&&!!Y,{team1Logo:J,team2Logo:F}=R?fP(R):{team1Logo:null,team2Logo:null};E.useEffect(()=>{w(G.selectedUrl)},[G.selectedUrl,n]),E.useEffect(()=>{if(!C)return;U.some(H=>H.url===C)||w(G.selectedUrl)},[C,U,G.selectedUrl]);const $=async()=>
66{if(!W||!j||O||N.current)return;const D=S.current;try{D&&!document.fullscreenElement&&(D.requestFullscreen?await D.requestFullscreen():D.webkitRequestFullscreen?await D.webkitRequestFullscreen():D.msRequestFullscreen&&await D.msRequestFullscreen())}catch{}const H=screen.orientation;H.lock&&H.lock("landscape").then(()=>{N.current=!0}).catch(()=>{})},V=()=>{const D=document,H=screen.orientation;try{N.current&&H.unlock&&H.unlock()}catch{}N.current=!1;try{document.fullscreenElement?document.exitFullscreen():D.webkitExitFullscreen?D.webkitExitFullscreen():D.msExitFullscreen&&D.msExitFullscreen()}catch{}},se=()=>{if(!j||O)return;const D=screen.orientation;D.lock&&D.lock("portrait").then(()=>{N.current=!1}).catch(()=>{})};E.useEffect(()=>($(),()=>{V()}),[W,j,O]);const ue=()=>{b(!1),_(!1)},Ce=()=>{T.current=Date.now(),b(!0)};return E.useEffect(()=>{T.current=Date.now(),b(!0),_(!1);const D=()=>{Ce()},H=()=>{document.visibilityState==="visible"&&Ce()};window.addEventListener("mousemove",D,{passive:!0}),window.addEventListener("pointermove",D,{passive:!0}),window.addEventListener("touchstart",D,{passive:!0}),window.addEventListener("focus",D),document.addEventListener("visibilitychange",H);const Z=window.setInterval(()=>{Date.now()-T.current>rP&&ue()},aP);return()=>{window.removeEventListener("mousemove",D),window.removeEventListener("pointermove",D),window.removeEventListener("touchstart",D),window.removeEventListener("focus",D),document.removeEventListener("visibilitychange",H),window.clearInterval(Z)}},[n]),l&&!R?o.jsx("div",{className:"pt-20 px-4 md:px-12 pb-12 w-full mx-auto",children:o.jsx("div",{className:"flex min-h-88 items-center justify-center rounded-2xl border border-white/10 bg-zinc-900/50 shadow-[0_18px_50px_rgba(0,0,0,0.45)]",children:o.jsx("p",{className:"text-zinc-200 font-semibold animate-pulse",children:"Loading match center..."})})}):!l&&h&&!R?o.jsx("div",{className:"pt-20 px-4 md:px-12 pb-12 w-full mx-auto",children:o.jsxs("div",{className:"rounded-2xl border border-rose-300/40 bg-rose-500/10 px-5 py-8 text-rose-100 text-center shadow-[0_18px_50px_rgba(0,0,0,0.45)]",children:[o.jsx("p",{className:"font-extrabold text-xl mb-2",children:"Error"}),o.jsx("p",{className:"text-sm",children:h})]})}):R?o.jsxs("div",{ref:S,className:"group fixed inset-0 z-220 overflow-hidden bg-black",onMouseMove:Ce,onTouchStart:()=>{$(),Ce()},onTouchMove:Ce,onClick:()=>{$(),Ce()},children:[!P&&Y?.includes("streams.center")?o.jsx("iframe",{src:Y,title:R.name,className:"absolute inset-0 h-full w-full border-none pointer-events-auto",allow:"autoplay; encrypted-media; picture-in-picture; fullscreen",allowFullScreen:!0}):!P&&Y?o.jsx("iframe",{src:Y,title:R.name,className:"absolute inset-0 h-full w-full border-none pointer-events-auto",allow:"autoplay; encrypted-media; picture-in-picture; fullscreen",allowFullScreen:!0}):o.jsx("div",{className:"absolute inset-0",children:o.jsx(mv,{event:R})}),o.jsx("div",{className:`pointer-events-none absolute inset-y-0 left-0 w-[60vw] max-w-2xl bg-linear-to-r from-black/72 via-black/35 to-transparent transition-opacity duration-300 ${g?"opacity-100":"opacity-0"}`}),!W&&o.jsx("div",{className:"pointer-events-none absolute inset-0 bg-linear-to-t from-black/85 via-black/30 to-black/55"}),!W&&o.jsx("div",{className:"pointer-events-none absolute inset-0 bg-linear-to-r from-black/65 via-transparent to-black/40"}),o.jsxs("div",{className:`pointer-events-none absolute left-4 top-4 z-30 w-fit max-w-[calc(100%-2rem)] px-1 py-1 text-white [text-shadow:0_2px_18px_rgba(0,0,0,0.75)] transition-all duration-300 md:left-6 md:top-6 ${g?"opacity-100":"opacity-0"}`,children:[o.jsx("p",{className:"text-[11px] font-bold uppercase tracking-[0.22em] text-orange-100/85",children:R.league||R.category||"Live Sports"}),o.jsx("h1",{className:"mt-1 text-lg font-black uppercase md:text-2xl",children:hP(R)}),o.jsx("p",{className:"mt-1 text-sm text-zinc-200/90",children:R.name}),o.jsxs("div",{className:"mt-2 flex w-fit items-center gap-2",children:[o.jsx("div",{className:"flex h-8 w-8 items-center justify-center overflow-hidden rounded-full bg-zinc-800/65 text-[10px] font-black uppercase text-zinc-100 shadow-lg",children:J?o.jsx("img",{src:J,alt:R.team1||"Team 1",className:"h-full w-full object-cover",loading:"lazy"}):_S(R.team1)}),o.jsx("span",{className:"text-[9px] font-black uppercase tracking-[0.16em] text-zinc-200/90",children:"vs"}),o.jsx("div",{className:"flex h-8 w-8 items-center justify-center overflow-hidden rounded-full bg-zinc-800/65 text-[10px] font-black uppercase text-zinc-100 shadow-lg",children:F?o.jsx("img",{src:F,alt:R.team2||"Team 2",className:"h-full w-full object-cover",loading:"lazy"}):_S(R.team2)})]}),o.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[o.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full border px-2.5 py-1 text-[10px] font-bold uppercase tracking-wider ${cP(
66R.status)}`,children:[R.status==="live"&&o.jsx(ul,{className:"h-3 w-3 animate-pulse"}),P?"Upcoming":uP(R.status)]}),o.jsx("span",{className:"rounded-full border border-white/20 bg-black/40 px-2.5 py-1 text-[10px] font-bold uppercase tracking-wider text-zinc-200",children:lP(R.startsAt)})]})]}),o.jsx("div",{className:`absolute right-4 top-4 z-40 transition-all duration-300 md:right-6 md:top-6 ${g?"opacity-100":"opacity-80"}`,children:o.jsxs("div",{className:"relative",children:[o.jsx("button",{type:"button",onClick:D=>{D.stopPropagation(),_(H=>!H),Ce()},"aria-label":"Open player menu",title:"Player menu",className:"inline-flex items-center justify-center rounded-full border border-white/20 bg-black/60 p-1 backdrop-blur-md transition hover:bg-black/80",children:o.jsx("img",{src:"/pyroplay.png",alt:"PyroPlay",className:"h-10 w-auto opacity-90 md:h-12"})}),y&&o.jsxs("div",{className:"absolute right-0 mt-2 w-60 rounded-xl border border-white/15 bg-black/80 p-2 text-white shadow-xl backdrop-blur-md",children:[U.length>0&&o.jsxs("div",{className:"mb-2 rounded-lg border border-white/10 bg-white/5 p-2",children:[o.jsx("p",{className:"mb-2 text-[10px] font-bold uppercase tracking-[0.14em] text-zinc-300",children:"Stream Server"}),o.jsx("div",{className:"flex flex-col gap-1.5",children:U.map(D=>{const H=Y===D.url;return o.jsx("button",{type:"button",onClick:Z=>{Z.stopPropagation(),w(D.url),Ce()},className:`w-full rounded-md border px-2.5 py-1.5 text-left text-[11px] font-semibold uppercase tracking-[0.08em] transition ${H?"border-orange-300/70 bg-orange-500/25 text-orange-50":"border-white/10 bg-white/5 text-zinc-200 hover:bg-white/15"}`,children:D.label},D.url)})})]}),o.jsx(Ut,{to:"/sports",onClick:D=>{D.stopPropagation(),_(!1),se()},className:"flex w-full items-center justify-center rounded-lg border border-white/15 bg-white/10 px-3 py-2 text-xs font-bold uppercase tracking-[0.12em] text-zinc-100 transition hover:bg-white/20",children:"Back to Browse"})]})]})}),P&&M!==null&&M>0&&o.jsxs("div",{className:"pointer-events-none absolute left-1/2 top-1/2 z-30 w-[min(92vw,720px)] -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-orange-300/35 bg-black/55 px-5 py-6 text-center text-orange-100 backdrop-blur-xl",children:[o.jsxs("p",{className:"inline-flex items-center justify-center gap-2 text-sm font-bold uppercase tracking-[0.16em] text-orange-200",children:[o.jsx(lv,{className:"h-4 w-4"}),"Match Countdown"]}),o.jsx("p",{className:"mt-3 text-4xl font-black tracking-tight md:text-7xl",children:oP(M)}),o.jsx("p",{className:"mt-3 text-xs uppercase tracking-[0.12em] text-orange-200/85",children:"Stream appears automatically at kickoff"})]}),!P&&!R.streamUrl&&o.jsxs("div",{className:"pointer-events-none absolute left-1/2 top-1/2 z-30 w-[min(92vw,720px)] -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-white/20 bg-black/55 px-5 py-6 text-center text-zinc-100 backdrop-blur-xl",children:[o.jsx("p",{className:"text-xl font-black uppercase",children:"Searching for feed"}),o.jsx("p",{className:"mt-2 text-sm text-zinc-300",children:"Stream URL has not been allocated yet. Feeds refresh automatically."})]}),i.length>0&&o.jsx("div",{className:"pointer-events-none absolute right-4 top-20 z-30 max-w-md rounded-lg border border-amber-300/40 bg-amber-500/10 px-3 py-2 text-xs text-amber-50 backdrop-blur md:right-6 md:top-24",children:i.join(" | ")})]}):o.jsx("div",{className:"pt-20 px-4 md:px-12 pb-12 w-full mx-auto",children:o.jsxs("div",{className:"rounded-2xl border border-white/10 bg-zinc-900/55 p-8 text-center shadow-[0_18px_50px_rgba(0,0,0,0.45)]",children:[o.jsx("p",{className:"text-2xl font-extrabold text-white mb-2",children:"Match not found"}),o.jsx("p",{className:"text-sm text-zinc-300",children:"This stream may have ended or been removed from the feed."}),o.jsx("div",{className:"mt-6 flex justify-center",children:o.jsxs(Ut,{to:"/sports",onClick:se,className:"inline-flex items-center justify-center rounded-md bg-[#E25E0C] hover:bg-[#ff7a27] px-5 py-2 text-sm font-semibold text-white transition",children:[o.jsx(nm,{className:"h-4 w-4 mr-2"}),"Back to Sports"]})})]})})}
66const U5="https://watch-server-production-c01b.up.railway.app/api",ux=[{uid:"HARlh3kv",name:"Featured",sortOrder:1},{uid:"LKDE5vG6",name:"Trending",sortOrder:2},{uid:"4OlE4Nx1",name:"College",sortOrder:3},{uid:"aS2XAWin",name:"News",sortOrder:4},{uid:"LJFnqdKt",name:"Motorsports",sortOrder:5},{uid:"Zr27gY8w",name:"Combat",sortOrder:6},{uid:"9pZtsoQT",name:"Team Sports",sortOrder:7},{uid:"KAwgURAH",name:"Racquet",sortOrder:8},{uid:"2pGqYMFP",name:"Action & Extreme",sortOrder:9},{uid:"OCOPi76K",name:"Poker",sortOrder:10},{uid:"oavXBvPm",name:"Billiards",sortOrder:11},{uid:"3hlRApfW",name:"Outdoors",sortOrder:12},{uid:"L2KpAyhh",name:"Specialist",sortOrder:13},{uid:"EIN0rWNJ",name:"Spanish",sortOrder:14},{uid:"GGuN3tPG",name:"Equestrian",sortOrder:15},{uid:"VbAlZNUo",name:"Wellness",sortOrder:16},{uid:"rcPdDx8s",name:"Entertainment",sortOrder:17}].sort((n,e)=>n.sortOrder-e.sortOrder);function L1(n){return String(n.id||n._id||"").trim()}function zp(n,e){const t=n.start?Date.parse(n.start):Number.NaN,i=n.stop?Date.parse(n.stop):Number.NaN;return!Number.isFinite(t)||!Number.isFinite(i)?!1:t<=e&&e<i}function bP(n,e){const t=n.start?Date.parse(n.start):Number.NaN;return Number.isFinite(t)&&t>e}function P1(n){return[...n].sort((e,t)=>{const i=e.start?Date.parse(e.start):Number.MAX_SAFE_INTEGER,r=t.start?Date.parse(t.start):Number.MAX_SAFE_INTEGER;return i-r})}async function vP(n){const e=await fetch(`${U5}/channels`,{headers:{accept:"application/json"},signal:n});if(!e.ok){const i=await e.text().catch(()=>"");throw new Error(i||e.statusText||"Failed to load channels.")}const t=await e.json();return Array.isArray(t.results)?t.results:[]}async function yP(n){try{const e=await fetch(`${U5}/channels/${encodeURIComponent(n)}/play-url`,{headers:{accept:"application/json"}});return e.ok?(await e.json()).url??null:null}catch{return null}}function _P(){return o.jsxs("div",{className:"flex flex-col items-center justify-center min-h-screen bg-zinc-950 text-white pt-20",children:[o.jsx("div",{className:"animate-spin rounded-full h-16 w-16 border-t-4 border-b-4 border-blue-500 mb-4"}),o.jsx("span",{className:"text-lg font-semibold",children:"Loading channels..."})]})}function wP({title:n,channels:e,nowMs:t}){const i=E.useRef(null),[r,l]=E.useState(!1),u=()=>{i.current&&l(i.current.scrollLeft>0)};E.useEffect(()=>{const d=i.current;if(d)return d.addEventListener("scroll",u),()=>d.removeEventListener("scroll",u)},[]);const h=d=>{if(!i.current)return;const p=i.current.clientWidth*.75;i.current.scrollBy({left:d==="left"?-p:p,behavior:"smooth"})};return e.length===0?null:o.jsxs("section",{className:"mb-8",children:[o.jsx("h2",{className:"px-4 md:px-12 mb-3 text-lg font-bold text-white",children:n}),o.jsxs("div",{className:"relative group/row",children:[r&&o.jsx("button",{type:"button",onClick:()=>h("left"),className:"absolute left-0 top-0 bottom-0 z-10 w-12 bg-linear-to-r from-zinc-950/90 to-transparent flex items-center justify-center opacity-0 group-hover/row:opacity-100 transition-opacity",children:o.jsx(nm,{className:"h-8 w-8 text-white drop-shadow"})}),o.jsx("div",{ref:i,className:"flex gap-2 overflow-x-auto scroll-smooth px-4 md:px-12 pb-2 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:e.map(d=>{const p=L1(d),m=P1(Array.isArray(d.epg?.entries)?d.epg.entries:[]),g=m.some(_=>zp(_,t)),b=m.find(_=>zp(_,t))||null,y=d.thumbnail||d.thumbnails?.dark||d.thumbnails?.light||null;return o.jsxs(Ut,{to:`/channels/${encodeURIComponent(p)}`,className:"group/card relative shrink-0 w-44 md:w-52 overflow-hidden rounded cursor-pointer",children:[o.jsxs("div",{className:"relative aspect-video bg-zinc-900 overflow-hidden",children:[y?o.jsx("img",{src:y,alt:d.name||"Channel",className:"w-full h-full object-contain p-4 transition duration-300 group-hover/card:scale-105",loading:"lazy"}):o.jsx("div",{className:"w-full h-full bg-zinc-800 flex items-center justify-center",children:o.jsx("span",{className:"text-xs text-zinc-500 uppercase tracking-widest",children:"No logo"})}),o.jsx("div",{className:"absolute inset-0 bg-linear-to-t from-black/70 via-trans
66parent to-transparent"}),g&&o.jsxs("div",{className:"absolute top-1.5 left-1.5 inline-flex items-center gap-1 rounded-full bg-red-600 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider text-white",children:[o.jsx(ul,{className:"h-2 w-2 animate-pulse"}),"Live"]}),o.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover/card:bg-black/30 transition-colors flex items-center justify-center opacity-0 group-hover/card:opacity-100",children:o.jsx("div",{className:"bg-white/90 rounded-full p-2",children:o.jsx(Ts,{className:"h-4 w-4 text-black fill-black"})})})]}),o.jsxs("div",{className:"py-1.5 px-0.5",children:[o.jsx("p",{className:"text-xs font-semibold text-white line-clamp-1",children:d.name||"Unnamed"}),b?.title?o.jsx("p",{className:"text-[10px] text-zinc-400 line-clamp-1 mt-0.5",children:b.title}):o.jsxs("p",{className:"text-[10px] text-zinc-600 mt-0.5",children:["Ch ",d.channelNumber??"--"]})]})]},p||`${d.name}-${d.channelNumber}`)})}),o.jsx("button",{type:"button",onClick:()=>h("right"),className:"absolute right-0 top-0 bottom-0 z-10 w-12 bg-linear-to-l from-zinc-950/90 to-transparent flex items-center justify-center opacity-0 group-hover/row:opacity-100 transition-opacity",children:o.jsx(im,{className:"h-8 w-8 text-white drop-shadow"})})]})]})}function wS(){const[n,e]=E.useState([]),[t,i]=E.useState(!1),[r,l]=E.useState(null),[u,h]=E.useState(null),[d,p]=E.useState(null),m=E.useRef(null),g=Date.now(),b=E.useMemo(()=>[...n].sort((R,z)=>{const M=Number(R.channelNumber||0),P=Number(z.channelNumber||0);return M===P?String(R.name||"").localeCompare(String(z.name||"")):M-P}),[n]),y=E.useMemo(()=>b.filter(R=>P1(Array.isArray(R.epg?.entries)?R.epg.entries:[]).some(M=>zp(M,g))),[g,b]),_=E.useMemo(()=>y.length>0?y[0]:b[0]||null,[y,b]),C=E.useMemo(()=>ux.map(R=>({category:R,channels:b.filter(z=>(z.categories??z.siteOptions?.categories??[]).includes(R.uid))})).filter(R=>R.channels.length>0),[b]),w=E.useMemo(()=>{const R=new Set(ux.map(z=>z.uid));return b.filter(z=>{const M=z.categories??z.siteOptions?.categories??[];return M.length===0||!M.some(P=>R.has(P))})},[b]);E.useEffect(()=>{const R=new AbortController;return(async()=>{i(!0),l(null);try{const M=await vP(R.signal);e(M)}
66catch(M){if(R.signal.aborted)return;l(M instanceof Error?M.message:"Failed to load channels.")}finally{R.signal.aborted||i(!1)}})(),()=>R.abort()},[]),E.useEffect(()=>{if(!_)return;const R=L1(_);if(!R)return;let z=!1;return yP(R).then(M=>{z||p(M)}),()=>{z=!0}},[_]),E.useEffect(()=>{const R=m.current;if(!(!R||!d)){if(R.canPlayType("application/vnd.apple.mpegurl"))R.src=d;else if("MediaSource"in window)return;R.play().catch(()=>{})}},[d]);const S=E.useMemo(()=>{if(u){const z=ux.find(P=>P.uid===u),M=C.find(P=>P.category.uid===u);if(z&&M)return[{uid:z.uid,name:z.name,channels:M.channels}]}const R=[];for(const{category:z,channels:M}of C)R.push({uid:z.uid,name:z.name,channels:M});return w.length>0&&R.push({uid:"other",name:"Other",channels:w}),R.length===0&&R.push({uid:"all",name:"All channels",channels:b}),R},[u,C,w,b]);if(t&&n.length===0)return o.jsx(_P,{});const T=P1(Array.isArray(_?.epg?.entries)?_.epg.entries:[]),N=T.find(R=>zp(R,g))||null,j=T.find(R=>bP(R,g))||null,O=_?.thumbnail||_?.thumbnails?.dark||_?.thumbnails?.light||null;return o.jsxs("div",{className:"min-h-screen bg-zinc-950 text-white",children:[o.jsxs("div",{className:"relative h-[70vh] min-h-120 md:h-[85vh] w-full mb-8 overflow-hidden",children:[o.jsx("div",{className:"absolute inset-0 bg-zinc-900",children:d?o.jsx("video",{ref:m,className:"w-full h-full object-cover opacity-40",muted:!0,playsInline:!0,autoPlay:!0,loop:!0}):O?o.jsx("img",{src:O,alt:_?.name||"Channel",className:"w-full h-full object-contain md:object-cover opacity-40"}):null}),o.jsx("div",{className:"absolute inset-0 bg-linear-to-r from-zinc-950 via-zinc-950/70 to-transparent"}),o.jsx("div",{className:"absolute inset-0 bg-linear-to-t from-zinc-950 via-trans
66parent to-transparent"}),o.jsxs("div",{className:"relative h-full flex flex-col justify-end md:justify-center px-4 md:px-12 pb-16 md:pb-0 pt-24 max-w-3xl",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.3em] text-zinc-400 mb-2",children:"Live TV"}),o.jsx("h1",{className:"text-4xl sm:text-5xl md:text-6xl font-bold leading-tight mb-3 drop-shadow-lg",children:_?.name||"Channels"}),N&&o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsxs("span",{className:"inline-flex items-center gap-1 bg-red-600 rounded px-2 py-0.5 text-[11px] font-bold uppercase tracking-wider",children:[o.jsx(ul,{className:"h-2.5 w-2.5 animate-pulse"}),"Live"]}),o.jsx("span",{className:"text-sm text-zinc-300 line-clamp-1",children:N.title})]}),j&&o.jsxs("p",{className:"text-sm text-zinc-400 mb-5 line-clamp-1",children:["Up next: ",o.jsx("span",{className:"text-zinc-300",children:j.title})]}),!N&&!j&&_&&o.jsxs("p",{className:"text-sm text-zinc-400 mb-5",children:["Ch ",_.channelNumber??"--"," · ",b.length," channels available"]}),o.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[_&&o.jsxs(Ut,{to:`/channels/${encodeURIComponent(L1(_))}`,className:"flex items-center gap-2 bg-white text-black px-5 py-2.5 rounded font-bold hover:bg-zinc-200 transition text-sm md:text-base",children:[o.jsx(Ts,{className:"w-5 h-5 fill-black"}),"Watch now"]}),o.jsxs("span",{className:"bg-zinc-500/50 text-white px-5 py-2.5 rounded font-bold backdrop-blur-sm text-sm md:text-base",children:[b.length," channels"]})]})]}),y.length>1&&o.jsx("div",{className:"absolute bottom-4 md:bottom-8 left-4 md:left-12 z-20 flex gap-2",children:y.slice(0,8).map((R,z)=>o.jsx("div",{className:`h-1 rounded-full transition-all duration-300 ${z===0?"w-8 bg-white":"w-4 bg-zinc-500"}`},z))})]}),r&&o.jsx("div",{className:"mx-auto max-w-6xl px-4 md:px-12 mb-6",children:o.jsx("div",{className:"rounded border border-rose-400/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200",children:r})}),C.length>0&&o.jsxs("div",{className:"px-4 md:px-12 mb-6 flex gap-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[o.jsx("button",{type:"button",onClick:()=>h(null),className:`shrink-0 rounded-full border px-4 py-1.5 text-xs font-bold uppercase tracking-[0.12em] transition ${u===null?"border-orange-400/60 bg-orange-500 text-white shadow-[0_0_16px_rgba(226,94,12,0.3)]":"border-white/10 bg-zinc-900/60 text-zinc-300 hover:border-orange-200/30 hover:text-orange-100"}`,children:"All"}),C.map(({category:R,channels:z})=>o.jsxs("button",{type:"button",onClick:()=>h(R.uid),className:`shrink-0 rounded-full border px-4 py-1.5 text-xs font-bold uppercase tracking-[0.12em] transition ${u===R.uid?"border-orange-400/60 bg-orange-500 text-white shadow-[0_0_16px_rgba(226,94,12,0.3)]":"border-white/10 bg-zinc-900/60 text-zinc-300 hover:border-orange-200/30 hover:text-orange-100"}`,children:[R.name,o.jsx("span",{className:`ml-1.5 rounded-full px-1.5 py-0.5 text-[9px] leading-none ${u===R.uid?"bg-black/25 text-white":"bg-white/10 text-zinc-400"}`,children:z.length})]},R.uid))]}),o.jsx("div",{className:"pb-20",children:S.map(R=>o.jsx(wP,{title:R.name,channels:R.channels,nowMs:g},R.uid))})]})}const $r=Symbol(0);let $p=!1,O1=!1,mr=null,Mc=null,Hs=null,Es=0,Sc=[],xv={};const SP=()=>{},Qc=0,I5=1,Vd=2,dm=3;function EP(){$p=!0,queueMicrotask(z5)}function z5(){if(!Sc.length){$p=!1;return}O1=!0;for(let n=0;n<Sc.length;n++)Sc[n].$st!==Qc&&CP(Sc[n]);Sc=[],$p=!1,O1=!1}function CP(n){let e=[n];for(;n=n[$r];)n.$e&&n.$st!==Qc&&e.push(n);for(let t=e.length-1;t>=0;t--)Sv(e[t])}function $5(n){const e=V5();return eh(e,n.length?n.bind(null,Oc.bind(e)):n,null)}function gt(n){return eh(mr,n,null)}function NP(n){return eh(null,n,null)}function Pr(){O1||z5()}function Jd(){return mr}function Vs(n,e){try{return eh(e,n,null)}catch(t){bv(e,t);return}}function F5(n,e=mr){return e?.$cx[n]}function TP(n,e,t=mr){t&&(t.$cx={...t.$cx,[n]:e})}function _r(n){if(!n||!mr)return n||SP;const e=mr;return e.$d?Array.isArray(e.$d)?e.$d.push(n):e.$d=[e.$d,n]:e.$d=n,function(){e.$st!==dm&&(n.call(null),bo(e.$d)?e.$d=null:Array.isArray(e.$d)&&e.$d.splice(e.$d.indexOf(n),1))}}function Oc(n=!0){if(this.$st!==dm){if(this.$h)if(Array.isArray(this.$h))for(let e=this.$h.length-1;e>=0;e--)Oc.call(this.$h[e]);else Oc.call(this.$h);if(n){const e=this[$r];e&&(Array.isArray(e.$h)?e.$h.splice(e.$h.indexOf(this),1):e.$h=null),MP(this)}}}function MP(n){n.$st=dm,n.$d&&B5(n),n.$s&&vp(n,0),n[$r]=null,n.$s=null,n.$o=null,n.$h=null,n.$cx=xv,n.$eh=null}function B5(n){try{if(Array.isArray(n.$d))for(let e=n.$d.length-1;e>=0;e--){const t=n.$d[e];t.call(t)}else n.$d.call(n.$d);n.$d=null}catch(e){bv(n,e)}}function eh(n,e,t){const i=mr,r=Mc;mr=n,Mc=t;try{return e.call(n)}finally{mr=i,Mc=r}}function bv(n,e){if(!n||!n.$eh)throw e;let t=0,i=n.$eh.length,r=SS(e);for(t=0;t<i;t++)try{n.$eh[t](r);break}catch(l){r=SS(l)}if(t===i)throw r}function SS(n){return n instanceof Error?n:Error(JSON.stringify(n))}function vv(){return this.$st===dm?this.$v:(Mc&&!this.$e&&(!Hs&&Mc.$s&&Mc.$s[Es]==this?Es++:Hs?Hs.push(this):Hs=[this]),this.$c&&Sv(this),this.$v)}function H5(n){const e=bo(n)?n(this.$v):n;if(this.$ch(this.$v,e)&&(this.$v=e,this.$o))for(let t=0;t<this.$o.length;t++)W5(this.$o[t],Vd);return this.$v}const yv=function(){this[$r]=null,this.$h=null,mr&&mr.append(this)},gl=yv.prototype;
66gl.$cx=xv;gl.$eh=null;gl.$c=null;gl.$d=null;gl.append=function(n){n[$r]=this,this.$h?Array.isArray(this.$h)?this.$h.push(n):this.$h=[this.$h,n]:this.$h=n,n.$cx=n.$cx===xv?this.$cx:{...this.$cx,...n.$cx},this.$eh&&(n.$eh=n.$eh?[...n.$eh,...this.$eh]:this.$eh)};gl.dispose=function(){Oc.call(this)};function V5(){return new yv}const G5=function(e,t,i){yv.call(this),this.$st=t?Vd:Qc,this.$i=!1,this.$e=!1,this.$s=null,this.$o=null,this.$v=e,t&&(this.$c=t),i&&i.dirty&&(this.$ch=i.dirty)},_v=G5.prototype;Object.setPrototypeOf(_v,gl);_v.$ch=AP;_v.call=vv;function wv(n,e,t){return new G5(n,e,t)}function AP(n,e){return n!==e}function bo(n){return typeof n=="function"}function Sv(n){if(n.$st===I5)for(let e=0;e<n.$s.length&&(Sv(n.$s[e]),n.$st!==Vd);e++);n.$st===Vd?q5(n):n.$st=Qc}function ES(n){n.$h&&Oc.call(n,!1),n.$d&&B5(n),n.$eh=n[$r]?n[$r].$eh:null}function q5(n){let e=Hs,t=Es;Hs=null,Es=0;try{ES(n);const i=eh(n,n.$c,n);if(Hs){if(n.$s&&vp(n,Es),n.$s&&Es>0){n.$s.length=Es+Hs.length;for(let l=0;l<Hs.length;l++)n.$s[Es+l]=Hs[l]}else n.$s=Hs;let r;for(let l=Es;l<n.$s.length;l++)r=n.$s[l],r.$o?r.$o.push(n):r.$o=[n]}else n.$s&&Es<n.$s.length&&(vp(n,Es),n.$s.length=Es);!n.$e&&n.$i?H5.call(n,i):(n.$v=i,n.$i=!0)}catch(i){bv(n,i),n.$st===Vd&&(ES(n),n.$s&&vp(n,0));return}Hs=e,Es=t,n.$st=Qc}function W5(n,e){if(!(n.$st>=e)&&(n.$e&&n.$st===Qc&&(Sc.push(n),$p||EP()),n.$st=e,n.$o))for(let t=0;t<n.$o.length;t++)W5(n.$o[t],I5)}function vp(n,e){let t,i;for(let r=e;r<n.$s.length;r++)t=n.$s[r],t.$o&&(i=t.$o.indexOf(n),t.$o[i]=t.$o[t.$o.length-1],t.$o.pop())}function pn(n,e){const t=wv(n,null,e),i=vv.bind(t);return i[$r]=!0,i.set=H5.bind(t),i}function RP(n){return bo(n)&&$r in n}function $i(n,e){const t=wv(e?.initial,n,e),i=vv.bind(t);return i[$r]=!0,i}function Nd(n,e){const t=wv(null,function(){let r=n();return bo(r)&&_r(r),null},void 0);return t.$e=!0,q5(t),Oc.bind(t,!0)}function CS(n){return RP(n)&&"set"in n}function hm(...n){}function xl(n){return n===null}function Xs(n){return typeof n>"u"}function kP(n){return xl(n)||Xs(n)}function Dc(n){return typeof n=="number"&&!Number.isNaN(n)}function Fr(n){return typeof n=="string"}function X5(n){return typeof n=="boolean"}function as(n){return typeof n=="function"}function br(n){return Array.isArray(n)}function Jc(n){return{id:Symbol(),provide:n}}function Pa(n,e,t=Jd()){const i=!Xs(e);TP(n.id,i?e:n.provide?.(),t)}function Br(n){return F5(n.id)}function fm(n){return!Xs(F5(n.id))}var Y5=class{constructor(n){this.id=Symbol(0),this.record=n,this.v=Object.getOwnPropertyDescriptors(n)}create(){const n={},e=new Proxy(n,{get:(t,i)=>n[i]()});for(const t of Object.keys(this.record)){const i=this.v[t].get;n[t]=i?$i(i.bind(e)):pn(this.record[t])}return n}reset(n,e){for(const t of Object.keys(n))!this.v[t].get&&(!e||e(t))&&n[t].set(this.record[t])}};function Ev(n){return Br(n)}var tt=Nd;function K5(n){let e=n;for(;typeof e=="function";)e=e();return e}var jP=Event,Z5=Symbol("DOM_EVENT"),Q5,Hn=class extends jP{constructor(n,...e){super(n,e[0]),this[Q5]=!0,this.detail=e[0]?.detail,this.trigger=e[0]?.trigger}get originEvent(){return Fp(this)??this}get isOriginTrusted(){return Fp(this)?.isTrusted??!1}};Q5=Z5;function D1(n){return!!n?.[Z5]}function Fp(n){let e=n.trigger;for(;e&&e.trigger;)e=e.trigger;return e}function Pn(n,e){const t=Fp(n)??n;if(t===e)throw Error("");Object.defineProperty(t,"trigger",{configurable:!0,enumerable:!0,get:()=>e})}var Cv=class extends EventTarget{addEventListener(n,e,t){return super.addEventListener(n,e,t)}removeEventListener(n,e,t){return super.removeEventListener(n,e,t)}};function Rt(n,e,t,i){return n.addEventListener(e,t,i),_r(()=>n.removeEventListener(e,t,i))}function U1(n){return!!n?.type.startsWith("pointer")}function I1(n){return!!n?.type.startsWith("touch")}function J5(n){return/^(click|mouse)/.test(n?.type??"")}function wa(n){return!!n?.type.startsWith("key")}function Nv(n){return wa(n)&&(n.key==="Enter"||n.key===" ")}function pm(n){return n instanceof Node}function Tv(n){return pm(n)&&n.nodeType===1}function e4(){return document.createDocumentFragment()}function Mv(n){return document.createComment(n)}function Xt(n,e,t){if(!t&&t!==""&&t!==0)n.removeAttribute(e);else{const i=t+"";n.getAttribute(e)!==i&&n.setAttribute(e,i)}}function Ms(n,e,t){!t&&t!==0?n.style.removeProperty(e):n.style.setProperty(e,t+"")}function t4(n){const e=n.firstChild,t=e.getAttribute("shadowroot");e.parentNode.attachShadow({mode:t}).appendChild(e.content),e.remove()}function n4(n,e){for(const t of n)t(e)}function Av(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function i4(n){return n.replace(/-./g,e=>e[1].toUpperCase())}function Rv(n){return s4(n).replace(/\s/g,"")}function s4(n){return kv(n.replace(/-./g,e=>" "+e[1].toUpperCase()))}function kv(n){return n.charAt(0).toUpperCase()+n.slice(1)}function jv(n){const e=[];for(let t=0;t<n.length;t++)br(n[t])?e.push(...jv(n[t])):(n[t]||n[t]===0)&&e.push(n[t]);return e}var ls=class{get el(){return this.instance.m}get $props(){return this.instance.e}get $store(){return this.instance.k}constructor(n){this.instance=n,this.onAttach&&n.d.push(this.onAttach.bind(this)),this.onConnect&&n.p.push(this.onConnect.bind(this)),this.onDisconnect&&n.i.push(this.onDisconnect.bind(this)),this.onDestroy&&n.x.push(this.onDestroy.bind(this))}setAttributes(n){this.instance.f&&Object.assign(this.instance.f,n)}setStyles(n){this.instance.q&&Object.assign(this.instance.q,n)}setCSSVars(n){this.setStyles(n)}createEvent(n,...e){return new Hn(n,e[0])}dispatch(n,...e){if(!this.el)return;const t=new Hn(n,e[0]);this.el.dispatchEvent(t)}listen(n,e,t){return this.el?Rt(this.el,n,e,t):hm}},Vn=class extends ls{constructor(n){super(n),this.render&&!n.F&&!n.h&&(n.h=this.render.bind(this))}destroy(){this.instance.y()}},r4=n=>document.createTreeWalker(n,NodeFilter.SHOW_COMMENT,e=>e.nodeValue==="$"),Or=null;function LP(n,e){const t=Or;Or={w:r4(e.target)};const i=n();return Or=t,i}var z1=Symbol(0),PP=Mv("$$"),$1=Symbol(0),OP=Mv("/$"),DP="/[]";function Lv(n,e,t){let i=as(e);i&&e[HP]&&(e=e(),i=as(e)),i?o4(n,e,t):!Or&&(e||e===0)&&a4(n,br(e)?l4(e):pm(e)?e:document.createTextNode(e+""),t)}function a4(n,e,t){e&&(t?n.insertBefore(e,t):n.appendChild(e))}function o4(n,e,t){const i=t&&t.nodeType===8?t:PP.cloneNode();i!==t&&a4(n,i,t),tt(()=>{UP(i,K5(e))})}function UP(n,e){const t=n[$1];if(br(e))if(Or)n[$1]=IP(n);else{t&&Of(n,t);const i=l4(e);if(!i)return;t||i.appendChild(dx(n)),n.after(i)}else if(pm(e))t&&Of(n,t),Or||n.after(e),t||e.after(dx(n));else if(Fr(e)||Dc(e)){if(n[z1]){n.nextSibling.data=e+"";return}t&&Of(n,t);let i;Or?i=n.nextSibling:(i=document.createTextNode(e+""),n.after(i)),n[z1]=!0,t||i.after(dx(n))}else t&&Of(n,t)}function dx(n){return n[$1]=OP.cloneNode()}function IP(n){for(;n;){if(n.nodeType===8&&n.nodeValue===DP)return n;n=n.nextSibling}}function Of(n,e){for(;n.nextSibling!==e;)n.nextSibling.remove();n[z1]=!1}function l4(n){const e=jv(n);if(!e.length)return null;const t=e4();for(let i=0;i<e.length;i++){const r=e[i];as(r)?o4(t,r):t.append(r)}return t}function zP(n){c4(n,{insert:Lv})}var yp=Symbol(0);function c4(n,e){const t=n.el.tagName;window.customElements.get(t)||(window[yp]||(window[yp]=new Map),window[yp].set(t,n),window.customElements.define(t,KP(n,e)))}function zt(n){const e=document.createElement("template");return e.innerHTML=n,e.content}function An(n,e=Or?.w){try{return[u4(e),e]}catch{return An(n,r4(document.importNode(n,!0)))}}function mm(n){return An(n)[0]}function u4(n){let e=n.nextNode().nextSibling;if(e.localName.indexOf("-")>0&&e.firstChild&&e.firstChild.nodeName==="SHADOW-ROOT"){let t=e.firstChild.nextSibling||e.nextSibling;t&&(n.currentNode=t)}return e}var $P=Or;function St(n,e){const t=window[yp]?.get(n.localName);if(!t)throw Error(n.localName);const i=Ov(t,{props:e});return n.attachComponent(i),i.instance.c}function mi(n){return document.importNode(n,!0).firstElementChild}function FP(n){return document.createElement(n)}function BP(n){n.firstChild?.nodeName==="TEMPLATE"&&(n.firstChild.hasAttribute("shadowroot")?t4(n):n.firstChild.remove())}var _t=Lv;function Xi(n,e){Lv(n.parentElement,e,n)}function xt(n,e={}){return gt(()=>n(e))}var HP=Symbol(0);
vendor: 4,636 bytes, line 66
66function gm(n,e){br(e)?e.filter(as).forEach(t=>t(n)):as(e)&&e(n)}var ln=Xt;function Uc(n,e,t,i=!1){as(t)&&Rt(n,e,t,{capture:i})}var VP=gt,Mn=Vs,ci=tt,Pv=$i,Ac=Symbol(0),Td=Symbol(0),Md=Symbol(0);function Ov(n,e){const t=new GP(n,e);return Vs(()=>new n(t),t.c)}var GP=class{constructor(n,e={}){this.m=null,this.h=null,this.F=!1,this.j=!1,this.f={},this.q={},this.e={},this.z=null,this.k=null,this.d=[],this.p=[],this.i=[],this.x=[],$5(t=>{this.c=Jd(),this.G=t,e.scope&&e.scope.append(this.c);const i=n.el.store;i&&(this.k=i.create(),this.z=new Proxy(this.k,{get:(l,u)=>this.k[u]()}),Pa(i,this.k));const r=n.el.props;if(r&&(this.e=qP(r),e.props)){for(const l of Object.keys(e.props))if(l in r){const u=e.props[l];bo(u)?Nd(()=>{this.e[l].set(u())}):this.e[l].set(u)}}e.props?.innerHTML&&(this.F=!0),_r(this.y.bind(this))})}y(){if(!this.j){this.j=!0;for(const n of this.x)Vs(()=>n(this.m),this.c);this.m?.destroy(),this.d.length=0,this.p.length=0,this.i.length=0,this.x.length=0,Pr(),this.G(),this.m=null,this.h=null}}};function qP(n){const e={};for(const t of Object.keys(n)){const i=n[t];e[t]=pn(i.value,i)}return e}async function WP(n){const e=YP(n),t=n.constructor,i=t.a;e&&(await customElements.whenDefined(e.localName),e[Ac]===!0||await new Promise(r=>e[Ac].push(r))),n.isConnected&&(e?.keepAlive&&(n.keepAlive=!0),n.attachComponent(Ov(i,{scope:e?.component?.instance.c})))}function XP(n){const e=n.constructor,t=e.a,i={};if(!e.f)return i;for(const r of n.attributes){let l=e.f.get(r.name),u=l&&t.el.props[l].type?.from;if(u){let h=n.getAttribute(r.name);i[l]=u(h)}}return i}function YP(n){let e=n.constructor,t=e.a,i=n.parentNode,r=t.el.tagName.split("-",1)[0]+"-";for(;i;){if(i.nodeType===1&&i.localName.startsWith(r))return i;i=i.parentNode}return null}function KP(n,e){const t=n.register;if(n.register){const h=br(t)?t:t?.();if(br(h))for(const d of h)c4(d,e)}let i;if(n.el.props){i=new Map;for(const h of Object.keys(n.el.props)){const p=n.el.props[h].attribute;if(p!==!1){const m=p??Av(h);i.set(m,h)}}}class r extends QP{static get a(){return n}}r.H=e,r.f=i;const l=r.prototype,u=n.prototype;if(n.el.props)for(const h of Object.keys(n.el.props))Object.defineProperty(l,h,{enumerable:!0,configurable:!0,get(){return this.component?this.component.instance.e[h]():n.el.props[h].value},set(d){const p=()=>this.component.instance.e[h].set(d);if(!this.component){this.l.delete(h),this.l.set(h,p);return}p()}});if(u[Td])for(const h of u[Td])Object.defineProperty(l,h,{enumerable:!0,configurable:!0,get(){return this.component?this.component[h]:void 0},set(d){if(!this.component){this.l.delete(h),this.l.set(h,()=>{this.component[h]=d});return}this.component[h]=d}});if(u[Md])for(const h of u[Md])l[h]=function(...d){return this.component[h](...d)};return r}var ZP=HTMLElement,d4,QP=class extends ZP{constructor(){super(...arguments),this.r=!1,this.j=!1,this.a=null,this.s=null,this.d=new Set,this.i=[],this.l=new Map,this.keepAlive=!1,this[d4]=[],this.B=!1}get A(){return this.hasAttribute("mk-d")}get component(){return this.a}get $store(){return this.a?.instance.k}get state(){return this.a.instance.z}static get observedAttributes(){return this.f?Array.from(this.f.keys()):[]}attributeChangedCallback(n,e,t){const i=this.constructor;if(!this.a||!i.f)return;const r=i.f.get(n),l=i.a.el.props[r]?.type?.from;l&&this.a.instance.e[r].set(l(t))}connectedCallback(){const n=this.a?.instance;if(!this.A&&!n)return this.N();!n||!this.isConnected||this.r||this.j||(this.hasAttribute("keep-alive")&&(this.keepAlive=!0),this.r=!0,n.p.length&&Vs(()=>{$5(e=>{this.s=Jd();for(const t of n.p)Vs(()=>{const i=t(this);bo(i)&&this.i.push(i)},this.s);this.i.push(e)})},n.c),br(this[Ac])&&(n4(this[Ac],this),this[Ac]=!0))}disconnectedCallback(){const n=this.a?.instance;if(!(!this.r||this.j)){this.r=!1;for(const e of this.i)Vs(e,this.s);if(n?.i.length)for(const e of n.i)Vs(()=>e(this),n.c);this.s=null,!this.A&&!this.keepAlive&&requestAnimationFrame(()=>{this.isConnected||(n?.y(),this.j=!0)})}}attachComponent(n){const e=n.instance,t=this.constructor,i=t.a.el,r=t.H;this.a||this.j||Vs(()=>{this.o=e.h?i.shadowRoot?this.shadowRoot??this.attachShadow(X5(i.shadowRoot)?{mode:"open"}:i.shadowRoot):JP(this):null,!Or&&i.shadowRoot&&i.css&&r?.adoptCSS&&r.adoptCSS(this.o,i.css),e.m=this,this.a=n;const l=XP(this);for(const d of Object.keys(l))e.e[d].set(l[d]);if(this.l?.size)for(const d of this.l.values())d();this.l=null;for(const d of[...e.d,...this.d])Vs(()=>d(this),e.c);e.d.length=0,this.d=null;const u=e.f,h=e.q;if(u)for(const d of Object.keys(u))bo(u[d])?Nd(()=>Xt(this,d,u[d]())):Xt(this,d,u[d]);if(h)for(const d of Object.keys(h))bo(h[d])?Nd(()=>
66Ms(this,d,h[d]())):Ms(this,d,h[d]);if(this.dispatchEvent(new Event("attached")),this.o&&r&&e.h){const d=()=>r.insert(this.o,e.h);this.hasAttribute("mk-h")&&!t.a.el.nohydrate?LP(d,{target:this.o}):d()}this.connectedCallback()},e.c)}subscribe(n){return Vs(()=>Nd(()=>n(this.a.instance.z)),this.a.instance.c)}onAttach(n){return this.a?(n(this),hm):(this.d.add(n),()=>this.d?.delete(n))}onEventDispatch(n){const e=this.constructor;if(e.n)for(const t of e.n)n(t);this.I=n}destroy(){this.disconnectedCallback(),this.a?.destroy(),this.a=null,this.j=!0}dispatchEvent(n){if(this.A){const e=this.constructor;e.n||(e.n=new Set),e.n.has(n.type)||(this.I?.(n.type),e.n.add(n.type))}return NP(()=>super.dispatchEvent(n))}async N(){this.B||(this.B=!0,await WP(this),this.B=!1)}P(n){}};d4=Ac;function JP(n){if(n.firstChild&&Tv(n.firstChild)&&n.firstChild.localName==="shadow-root")return n.firstChild;{const e=FP("shadow-root");return n.prepend(e),e}}var F1=Symbol(0);function Ca(n){return{[F1]:!0,...n}}function Yt(n){if("props"in n){const e=n.props;for(const t of Object.keys(e)){const i=e[t]?.[F1]?e[t]:{[F1]:!0,value:e[t]};i.attribute!==!1&&!i.type&&(i.type=rO(i.value)),e[t]=i}}return n}var Df={from:n=>n===null?"":n+""},eO={from:n=>n===null?0:Number(n)},tO={from:n=>n!==null,to:n=>n?"":null},nO={from:!1,to:()=>null},iO={from:n=>n===null?[]:JSON.parse(n),to:n=>JSON.stringify(n)},sO={from:n=>n===null?{}:JSON.parse(n),to:n=>JSON.stringify(n)};function rO(n){if(n===null)return Df;switch(typeof n){case"undefined":return Df;case"string":return Df;case"boolean":return tO;case"number":return eO;case"function":return nO;case"object":return br(n)?iO:sO;default:return Df}}function ki(n,e,t){n[Td]||(n[Td]=new Set),n[Td].add(e)}function Wr(n,e,t){n[Md]||(n[Md]=new Set),n[Md].add(e)}var Dv=E.createContext(null);function h4(n,e){return E.createElement(Dv.Provider,{value:n},e)}var aO=class extends E.Component{constructor(n,e){super(n);const t=V5();this.c=t,e&&e.append(t);const i=this.constructor;i.C&&Pa(i.C,i.K?.(),t)}render(){return h4(this.c,this.props?.children)}};aO.contextType=Dv;function oO(n,e){typeof n=="function"?n(e):n.current=e}function Uv(n,e){return lO(zP,n)}function lO(n,e,t){n(e);class i extends f4{}i.displayName=Rv(e.el.tagName),i.contextType=Dv,i.a=e,i.e=new Set(Object.keys(e.el.props??{}));const r=E.forwardRef((l,u)=>E.createElement(i,{...l,O:u},l?.children));return r.displayName="ForwardRef_"+i.displayName,r}var f4=class extends E.Component{constructor(){super(...arguments),this.g=null}componentDidMount(){!this.g||this.g.component||(BP(this.g),this.g.onEventDispatch(n=>{const e=`on${Rv(n)}`,t=this.props[e];this.constructor.D.set(e,n),t&&this.M(n,t)}),this.g.attachComponent(this.a))}componentWillUnmount(){window.requestAnimationFrame(()=>{this.g||this.a.destroy()})}render(){const n=this.constructor,{O:e,className:t,children:i,...r}=this.props;this.a||(this.u=new Map,this.a=Ov(n.a,{props:this.props,scope:this.context})),(!this.E||this.L!==e)&&(this.E=h=>{this.g=h,e&&oO(e,h),this.L=e});const l={class:t,ref:this.E},u=this.a.instance.e;for(const h of Object.keys(r)){const d=r[h];n.D.has(h)?this.M(n.D.get(h),d):n.e.has(h)?u[h].set(d):l[h]=d}return Pr(),h4(this.a.instance.c,E.createElement(n.a.el.tagName,{...l,"mk-d":!0,suppressHydrationWarning:!0},E.createElement(cO,{shadow:n.a.el.shadowRoot}),i))}M(n,e){let t=this.u.get(n);!this.g||t?.handleEvent===e||(e?t?t.handleEvent=e:(this.u.set(n,t={handleEvent:e}),this.g.addEventListener(n,t)):t&&(this.u.delete(n),this.g.removeEventListener(n,t)))}};f4.D=new Map;function cO(n){return E.createElement(n.shadow?"template":"shadow-root",{dangerouslySetInnerHTML:{__html:""},suppressHydrationWarning:!0})}function xm(n){return n?"true":"false"}function Iv(){const n=new Set;return{add(...e){for(const t of e)n.add(t)},empty(){for(const e of n)e();n.clear()}}}function uO(){const n=Iv();return _r(n.empty),n}function Bp(){let n,e;return{promise:new Promise((i,r)=>{n=i,e=r}),resolve:n,reject:e}}function p4(n){return new Promise(e=>setTimeout(e,n))}function hl(n){let e=-1,t;function i(...r){t=r,!(e>=0)&&(e=window.requestAnimationFrame(()=>{n.apply(this,t),e=-1,t=void 0}))}return i}var dO="requestIdleCallback"in window?window.requestIdleCallback:n=>window.requestAnimationFrame(n);function hO(n,e){return new Promise(t=>{dO(i=>{n?.(i),t()},e)})}const fO=Object.freeze(Object.defineProperty({__proto__:null,DOMEvent:Hn,EventsTarget:Cv,animationFrameThrottle:hl,appendTriggerEvent:Pn,ariaBool:xm,attachDeclarativeShadowDOM:t4,camelToKebabCase:Av,createComment:Mv,createDisposalBin:Iv,createFragment:e4,deferredPromise:Bp,flattenArray:jv,getOriginEvent:Fp,isArray:br,isBoolean:X5,isDOMElement:Tv,isDOMEvent:D1,isDOMNode:pm,isFunction:as,isKeyboardClick:Nv,isKeyboardEvent:wa,isMouseEvent:J5,isNil:kP,isNull:xl,isNumber:Dc,isPointerEvent:U1,isString:Fr,isTouchEvent:I1,isUndefined:Xs,kebabToCamelCase:i4,kebabToPascalCase:Rv,kebabToTitleCase:s4,listenEvent:Rt,noop:hm,runAll:n4,setAttribute:Xt,setStyle:Ms,unwrapDeep:K5,uppercaseFirstChar:kv,useDisposalBin:uO,waitIdlePeriod:hO,waitTimeout:p4},Symbol.toStringTag,{value:"Module"}));function pO(n){return n instanceof HTMLAudioElement}function mO(n){return n instanceof HTMLVideoElement}function gO(n){return pO(n)||mO(n)}const xO=/\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i,bO=new Set(["audio/mpeg","audio/ogg","audio/3gp","audio/mp4","audio/webm","audio/flac"]),vO=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,yO=new Set(["video/mp4","video/webm","video/3gp","video/ogg","video/avi","video/mpeg"]),m4=/\.(m3u8)($|\?)/i,g4=new Set(["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"]);function _O({src:n,type:e}){return typeof n=="string"&&m4.test(n)||g4.has(e)}function XX(n){return typeof window.MediaStream<"u"&&n instanceof window.MediaStream}const wO=zt('<!$><audio preload="none" aria-hidden="true"></audio>'),SO=wO;class EO{kh;canPlay({src:e,type:t}){return Fr(e)?xO.test(e)||bO.has(t)||e.startsWith("blob:")&&t==="audio/object":t==="audio/object"}mediaType(){return"audio"}async load(){return new(await xr(async()=>
66{const{AudioProvider:e}=await import("./provider-B7WZfCL6.js");return{AudioProvider:e}},__vite__mapDeps([0,1]))).AudioProvider(this.kh)}render(e){return(()=>{const[t,i]=An(SO);return ci(()=>ln(t,"controls",e.controls())),ci(()=>ln(t,"crossorigin",e.crossorigin())),gm(t,r=>{this.kh=r}),t})()}}const CO=zt('<!$><video preload="none" aria-hidden="true"></video>'),NO=CO;class x4{qa;canPlay(e){return Fr(e.src)?vO.test(e.src)||yO.has(e.type)||e.src.startsWith("blob:")&&e.type==="video/object"||_O(e)&&PO():e.type==="video/object"}mediaType(){return"video"}async load(e){return new(await xr(async()=>{const{VideoProvider:t}=await import("./provider-B_aWLiKZ.js");return{VideoProvider:t}},__vite__mapDeps([2,1]))).VideoProvider(this.qa,e)}render(e){const t=$i(()=>e.poster()&&e.controls()?e.poster():null);return(()=>{const[i,r]=An(NO);return ci(()=>ln(i,"controls",e.controls())),ci(()=>ln(i,"crossorigin",e.crossorigin())),ci(()=>ln(i,"poster",t())),gm(i,l=>{this.qa=l}),i})()}}class zv extends x4{static supported=IO();preconnect(){$v("https://cdn.jsdelivr.net","preconnect")}canPlay({src:e,type:t}){return zv.supported&&Fr(e)&&(m4.test(e)||g4.has(t))}async load(e){return new(await xr(async()=>{const{HLSProvider:t}=await import("./provider-DtjsIvQz.js");return{HLSProvider:t}},__vite__mapDeps([3,2,1]))).HLSProvider(this.qa,e)}}const Hp=Symbol(0),B1=Symbol(0),H1=Symbol(0),hx=Symbol(0),Uf=Symbol(0),NS=Symbol(0),b4=Symbol(0),v4=Symbol(0),y4=Symbol(0);class _4 extends Cv{a=[];[Uf]=!1;get length(){return this.a.length}get readonly(){return this[Uf]}toArray(){return[...this.a]}[Symbol.iterator](){return this.a.values()}[Hp](e,t){const i=this.a.length;""+i in this||Object.defineProperty(this,i,{get(){return this.a[i]}}),!this.a.includes(e)&&(this.a.push(e),this.dispatchEvent(new Hn("add",{detail:e,trigger:t})))}[B1](e,t){const i=this.a.indexOf(e);i>=0&&(this[v4]?.(e,t),this.a.splice(i,1),this.dispatchEvent(new Hn("remove",{detail:e,trigger:t})))}[H1](e){for(const t of[...this.a])this[B1](t,e);this.a=[],this[NS](!1,e),this[b4]?.()}[NS](e,t){this[Uf]!==e&&(this[Uf]=e,this.dispatchEvent(new Hn("readonly-change",{detail:e,trigger:t})))}}var ws={fullscreenEnabled:0,fullscreenElement:1,requestFullscreen:2,exitFullscreen:3,fullscreenchange:4,fullscreenerror:5,fullscreen:6},TS=["webkitFullscreenEnabled","webkitFullscreenElement","webkitRequestFullscreen","webkitExitFullscreen","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],MS=["mozFullScreenEnabled","mozFullScreenElement","mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],AS=["msFullscreenEnabled","msFullscreenElement","msRequestFullscreen","msExitFullscreen","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"],rs=typeof window<"u"&&typeof window.document<"u"?window.document:{},Fs="fullscreenEnabled"in rs&&Object.keys(ws)||TS[0]in rs&&TS||MS[0]in rs&&MS||AS[0]in rs&&AS||[],TO={requestFullscreen:function(n){return n[Fs[ws.requestFullscreen]]()},requestFullscreenFunction:function(n){return n[Fs[ws.requestFullscreen]]},get exitFullscreen(){return rs[Fs[ws.exitFullscreen]].bind(rs)},get fullscreenPseudoClass(){return":"+Fs[ws.fullscreen]},addEventListener:function(n,e,t){return rs.addEventListener(Fs[ws[n]],e,t)},removeEventListener:function(n,e,t){return rs.removeEventListener(Fs[ws[n]],e,t)},get fullscreenEnabled(){return!!rs[Fs[ws.fullscreenEnabled]]},set fullscreenEnabled(n){},get fullscreenElement(){return rs[Fs[ws.fullscreenElement]]},set fullscreenElement(n){},get onfullscreenchange(){return rs[("on"+Fs[ws.fullscreenchange]).toLowerCase()]},set onfullscreenchange(n){return rs[("on"+Fs[ws.fullscreenchange]).toLowerCase()]=n},get onfullscreenerror(){return rs[("on"+Fs[ws.fullscreenerror]).toLowerCase()]},set onfullscreenerror(n){return rs[("on"+Fs[ws.fullscreenerror]).toLowerCase()]=n}},al=TO;const Vp=al.fullscreenEnabled;class MO extends ls{b=!1;c=!1;get active(){return this.c}get supported(){return Vp}onConnect(){Rt(al,"fullscreenchange",this.d.bind(this)),Rt(al,"fullscreenerror",this.e.bind(this))}async onDisconnect(){Vp&&await this.exit()}d(e){const t=fx(this.el);t!==this.c&&(t||(this.b=!1),this.c=t,this.dispatch("fullscreen-change",{detail:t,trigger:e}))}e(e){this.b&&(this.dispatch("fullscreen-error",{detail:null,trigger:e}),this.b=!1)}async enter(){try{return this.b=!0,!this.el||fx(this.el)?void 0:(RS(),al.requestFullscreen(this.el))}catch(e){throw this.b=!1,e}}async exit(){if(!(!this.el||!fx(this.el)))return RS(),al.exitFullscreen()}}function AO(){return Vp}function fx(n){if(al.fullscreenElement===n)return!0;try{return n.matches(al.fullscreenPseudoClass)}catch{return!1}}function RS(){if(!Vp)throw Error("[vidstack] no fullscreen API")}const RO=navigator?.userAgent.toLowerCase(),kO=/iphone|ipad|ipod|ios|crios|fxios/i.test(RO),jO=/(iphone|ipod)/gi.test(navigator?.platform),YX=!!window.chrome,w4=!!window.safari||kO;function LO(){return!Xs(screen.orientation)&&as(screen.orientation.lock)&&as(screen.orientation.unlock)}function PO(n){return n||(n=document.createElement("video")),n.canPlayType("application/vnd.apple.mpegurl").length>0}function KX(n){return!!document.pictureInPictureEnabled&&!n.disablePictureInPicture}function ZX(n){return as(n.webkitSupportsPresentationMode)&&as(n.webkitSetPresentationMode)}async function OO(){const n=document.createElement("video");return n.volume=.5,await p4(0),n.volume===.5}function DO(){return window?.MediaSource??window?.WebKitMediaSource}function UO(){return window?.SourceBuffer??window?.WebKitSourceBuffer}function IO(){const n=DO();if(Xs(n))return!1;
vendor: 10,741 bytes, line 66
66const e=n&&as(n.isTypeSupported)&&n.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),t=UO(),i=Xs(t)||!Xs(t.prototype)&&as(t.prototype.appendBuffer)&&as(t.prototype.remove);return!!e&&!!i}const Ad=LO();class S4 extends ls{g=pn(jS());f=pn(!1);h;get type(){return this.g()}get locked(){return this.f()}get portrait(){return this.g().startsWith("portrait")}get landscape(){return this.g().startsWith("landscape")}get supported(){return Ad}onConnect(){if(Ad)Rt(screen.orientation,"change",this.i.bind(this));else{const e=window.matchMedia("(orientation: landscape)");return e.onchange=this.i.bind(this),()=>e.onchange=null}}async onDisconnect(){Ad&&this.f()&&await this.unlock()}i(e){this.g.set(jS()),this.dispatch("orientation-change",{detail:{orientation:gt(this.g),lock:this.h},trigger:e})}async lock(e){gt(this.f)||this.h===e||(kS(),await screen.orientation.lock(e),this.f.set(!0),this.h=e)}async unlock(){gt(this.f)&&(kS(),this.h=void 0,await screen.orientation.unlock(),this.f.set(!1))}}function kS(){if(!Ad)throw Error("[vidstack] no orientation API")}function jS(){return Ad?window.screen.orientation.type:window.innerWidth>=window.innerHeight?"landscape-primary":"portrait-primary"}function Ii(n,e,t){n.hasAttribute(e)||n.setAttribute(e,t)}function bl(n,e){if(n.hasAttribute("aria-label")||n.hasAttribute("aria-describedby"))return;function t(){Xt(n,"aria-label",e())}tt(t)}function E4(n,e,t){for(;e;){if(e===n)return!0;if(e.localName===n.localName||t?.(e))break;e=e.parentElement}return!1}function Ic(n,e){Rt(n,"pointerup",t=>{t.button===0&&e(t)}),Rt(n,"keydown",t=>{Nv(t)&&e(t)})}function th(n){const e=Jd();requestAnimationFrame(()=>Vs(n,e))}const C4=Jc();function kn(){return Br(C4)}const zO=["autoplay","autoplayError","canFullscreen","canPictureInPicture","canLoad","canPlay","canSeek","ended","error","fullscreen","loop","live","liveEdge","mediaType","muted","paused","pictureInPicture","playing","playsinline","seeking","started","streamType","userIdle","viewType","waiting"],$O={togglePaused:"k Space",toggleMuted:"m",toggleFullscreen:"f",togglePictureInPicture:"i",toggleCaptions:"c",seekBackward:"ArrowLeft",seekForward:"ArrowRight",volumeUp:"ArrowUp",volumeDown:"ArrowDown"},LS=new Set(["Shift","Alt","Meta","Control"]),FO='button, [role="button"]',PS='input, textarea, select, [contenteditable], [role^="menuitem"]';class BO extends ls{constructor(e,t){super(e),this.j=t}onConnect(){tt(this.Xa.bind(this))}Xa(){const{keyDisabled:e,keyTarget:t}=this.$props;if(e())return;const i=t()==="player"?this.el:document,r=pn(!1);i===this.el?(this.listen("focusin",()=>r.set(!0)),this.listen("focusout",l=>{this.el.contains(l.target)||r.set(!1)})):(gt(r)||r.set(document.querySelector("media-player")===this.el),Rt(document,"focusin",l=>{const u=l.composedPath().find(h=>h instanceof Element&&h.localName==="media-player");u!==void 0&&r.set(this.el===u)})),tt(()=>{r()&&(Rt(i,"keyup",this.Ya.bind(this)),Rt(i,"keydown",this.Za.bind(this)),Rt(i,"keydown",this._a.bind(this),{capture:!0}))})}Ya(e){const t=document.activeElement,i=t?.hasAttribute("data-media-slider");if(!e.key||!this.$store.canSeek()||i||t?.matches(PS))return;const r=this.Va(e);r?.startsWith("seek")&&(e.preventDefault(),e.stopPropagation(),this.Ta?(this.Wa(e),this.Ta=null):(this.j.remote.seek(this.Ua,e),this.Ua=void 0)),r?.startsWith("volume")&&this.el.querySelector("media-volume-slider")?.dispatchEvent(new Hn("keyup",{trigger:e}))}Za(e){if(!e.key||LS.has(e.key))return;const t=document.activeElement;if(t?.matches(PS)||Nv(e)&&t?.matches(FO))return;const i=t?.hasAttribute("data-media-slider"),r=this.Va(e);if(!r&&!e.metaKey&&/[0-9]/.test(e.key)&&!i){e.preventDefault(),e.stopPropagation(),this.j.remote.seek(this.$store.duration()/10*Number(e.key),e);return}if(!(!r||/volume|seek/.test(r)&&i))switch(e.preventDefault(),e.stopPropagation(),r){case"seekForward":case"seekBackward":this.$a(e,r);break;case"volumeUp":case"volumeDown":const l=this.el.querySelector("media-volume-slider");if(l)l.dispatchEvent(new Hn("keydown",{trigger:e}));else{const u=e.shiftKey?.1:.05;this.j.remote.changeVolume(this.$store.volume()+(r==="volumeUp"?+u:-u),e)}break;case"toggleFullscreen":this.j.remote.toggleFullscreen("prefer-media",e);break;default:this.j.remote[r]?.(e)}}_a(e){gO(e.target)&&this.Va(e)&&e.preventDefault()}Va(e){const t={...this.$props.keyShortcuts(),...this.j.ariaKeys};return Object.keys(t).find(i=>t[i].split(" ").some(r=>VO(r).replace(/Control/g,"Ctrl").split("+").every(l=>LS.has(l)?e[l.toLowerCase()+"Key"]:e.key===l.replace("Space"," "))))}Ua;ab(e,t){const i=e.shiftKey?10:5;return this.Ua=Math.max(0,Math.min((this.Ua??this.$store.currentTime())+(t==="seekForward"?+i:-i),this.$store.duration()))}Ta=null;Wa(e){this.Ta?.dispatchEvent(new Hn(e.type,{trigger:e}))}$a(e,t){this.$store.canSeek()&&(this.Ta||(this.Ta=this.el.querySelector("media-time-slider")),this.Ta?this.Wa(e):this.j.remote.seeking(this.ab(e,t),e))}}const HO=["!","@","#","$","%","^","&","*","(",")"];function VO(n){return n.replace(/Shift\+(\d)/g,(e,t)=>HO[t-1])}const GO={autoplay:!1,aspectRatio:Ca({value:null,type:{from(n){if(!n)return null;if(!n.includes("/"))return+n;const[e,t]=n.split("/").map(Number);return+(e/t).toFixed(4)}}}),controls:!1,currentTime:0,crossorigin:null,fullscreenOrientation:"landscape",load:"visible",logLevel:"silent",loop:!1,muted:!1,paused:!0,playsinline:!1,playbackRate:1,poster:"",preload:"metadata",preferNativeHLS:Ca({value:!1,attribute:"prefer-native-hls"}),src:"",userIdleDelay:2e3,viewType:"unknown",streamType:"unknown",volume:1,liveEdgeTolerance:10,minLiveDVRWindow:60,keyDisabled:!1,keyTarget:"player",keyShortcuts:$O,title:"",thumbnails:null,textTracks:Ca({value:[],attribute:!1}),smallBreakpointX:600,largeBreakpointX:980,smallBreakpointY:380,largeBreakpointY:600};class px{W;get length(){return this.W.length}constructor(e,t){br(e)?this.W=e:!Xs(e)&&!Xs(t)?this.W=[[e,t]]:this.W=[]}start(e){return this.W[e][0]??1/0}end(e){return this.W[e][1]??1/0}}function OS(n){if(!n.length)return null;let e=n.start(0);for(let t=1;t<n.length;t++){const i=n.start(t);i<e&&(e=i)}return e}function DS(n){if(!n.length)return null;let e=n.end(0);for(let t=1;t<n.length;t++){const i=n.end(t);i>e&&(e=i)}return e}const N4=new Y5({audioTracks:[],audioTrack:null,autoplay:!1,autoplayError:void 0,buffered:new px,duration:0,canLoad:!1,canFullscreen:!1,canPictureInPicture:!1,canPlay:!1,controls:!1,crossorigin:null,poster:"",currentTime:0,ended:!1,error:void 0,fullscreen:!1,loop:!1,logLevel:"silent",mediaType:"unknown",muted:!1,paused:!0,played:new px,playing:!1,playsinline:!1,pictureInPicture:!1,preload:"metadata",playbackRate:1,qualities:[],quality:null,autoQuality:!1,canSetQuality:!0,seekable:new px,seeking:!1,source:{src:"",type:""},sources:[],started:!1,title:"",textTracks:[],textTrack:null,thumbnails:null,thumbnailCues:[],volume:1,waiting:!1,get viewType(){return this.providedViewType!=="unknown"?this.providedViewType:this.mediaType},get streamType(){return this.providedStreamType!=="unknown"?this.providedStreamType:this.inferredStreamType},get currentSrc(){return this.source},get bufferedStart(){return OS(this.buffered)??0},get bufferedEnd(){return DS(this.buffered)??0},get seekableStart(){return OS(this.seekable)??0},get seekableEnd(){return this.canPlay?DS(this.seekable)??1/0:0},get seekableWindow(){return Math.max(0,this.seekableEnd-this.seekableStart)},touchPointer:!1,orientation:"landscape",mediaWidth:0,mediaHeight:0,breakpointX:"sm",breakpointY:"sm",userIdle:!1,userBehindLiveEdge:!1,liveEdgeTolerance:10,minLiveDVRWindow:60,get canSeek(){return/unknown|on-demand|:dvr/.test(this.streamType)&&Number.isFinite(this.seekableWindow)&&(!this.live||/:dvr/.test(this.streamType)&&this.seekableWindow>=this.minLiveDVRWindow)},get live(){return this.streamType.includes("live")||!Number.isFinite(this.duration)},get liveEdgeStart(){return this.live&&Number.isFinite(this.seekableEnd)?Math.max(0,(this.liveSyncPosition??this.seekableEnd)-this.liveEdgeTolerance):0},get liveEdge(){return this.live&&(!this.canSeek||!this.userBehindLiveEdge&&this.currentTime>=this.liveEdgeStart)},get liveEdgeWindow(){return this.live&&Number.isFinite(this.seekableEnd)?this.seekableEnd-this.liveEdgeStart:0},autoplaying:!1,providedViewType:"unknown",providedStreamType:"unknown",inferredStreamType:"unknown",liveSyncPosition:null}),qO=new Set(["autoplay","breakpointX","breakpointY","canFullscreen","canLoad","canPictureInPicture","controls","fullscreen","logLevel","loop","mediaHeight","mediaWidth","muted","orientation","pictureInPicture","playsinline","poster","preload","providedStreamType","providedViewType","source","sources","textTrack","textTracks","thumbnailCues","thumbnails","title","touchPointer","volume"]);function WO(n){N4.reset(n,e=>!qO.has(e)),Pr()}const sd=Symbol(0);class T4 extends _4{get selected(){return this.a.find(e=>e.selected)??null}get selectedIndex(){return this.a.findIndex(e=>e.selected)}[v4](e,t){this[hx](e,!1,t)}[Hp](e,t){e[sd]=!1,Object.defineProperty(e,"selected",{get(){return this[sd]},set:i=>{this.readonly||(this[y4]?.(),this[hx](e,i))}}),super[Hp](e,t)}[hx](e,t,i){if(t===e[sd])return;const r=this.selected;e[sd]=t,(t?r!==e:r===e)&&(r&&(r[sd]=!1),this.dispatchEvent(new Hn("change",{detail:{prev:r,current:this.selected},trigger:i})))}}const If=Symbol(0),mx=Symbol(0);class XO extends T4{Sa=!1;switch="current";get auto(){return this.Sa||this.readonly}[mx];[y4](){this[If](!1)}[b4](e){this[If](!1,e)}autoSelect(e){this.readonly||this.Sa||!this[mx]||(this[mx](),this[If](!0,e))}[If](e,t){this.Sa!==e&&(this.Sa=e,this.dispatchEvent(new Hn("auto-change",{detail:e,trigger:t})))}}class YO extends ls{constructor(e,t){super(e),this.jf=t}async onAttach(e){const t=this.$props.load();if(t==="eager")requestAnimationFrame(this.jf);else if(t==="idle"){const{waitIdlePeriod:i}=await xr(async()=>{const{waitIdlePeriod:r}=await Promise.resolve().then(()=>fO);return{waitIdlePeriod:r}},void 0);i(this.jf)}else if(t==="visible"){const i=new IntersectionObserver(r=>{r[0].isIntersecting&&(i.disconnect(),this.jf())});return i.observe(e),i.disconnect.bind(i)}}}class KO{constructor(e,t){this.N=e,this.j=t}p(e,...t){this.N(new Hn(e,t?.[0]))}async lf(e,t){const{$store:i,logger:r}=this.j;gt(i.canPlay)||(this.p("can-play",{detail:e,trigger:t}),Pr(),i.canPlay()&&i.autoplay()&&!i.started()&&await this.kf())}async kf(){const{player:e,$store:t}=this.j;t.autoplaying.set(!0);try{await e.play(),this.p("autoplay",{detail:{muted:t.muted()}})}catch(i){this.p("autoplay-fail",{detail:{muted:t.muted(),error:i}})}finally{t.autoplaying.set(!1)}}}class ZO{Ze=new Map;t(e,t){this.Ze.has(e)||this.Ze.set(e,new Set),this.Ze.get(e).add(t)}cf(e,t){const i=this.Ze.get(e);if(i)for(const r of i)t(r);this.Ze.delete(e)}yf(e){this.Ze.delete(e)}
66df(e){return this.Ze.get(e)?.size??0}gf(){this.Ze.clear()}}function zf(n){return n instanceof Error?n:Error(JSON.stringify(n))}class QO extends ls{da=-2;ba=2e3;ea=!1;ca=null;get idling(){return this.$store.userIdle()}get idleDelay(){return this.ba}set idleDelay(e){this.ba=e}idle(e,t=this.ba,i){this.fa(),this.ea||this.ga(e,t,i)}pauseIdleTracking(e,t){this.ea=e,e&&(this.fa(),this.ga(!1,0,t))}onConnect(){tt(this.C.bind(this)),Rt(this.el,"play",this.ia.bind(this)),Rt(this.el,"pause",this.ja.bind(this))}C(){if(this.$store.paused())return;const e=this.ka.bind(this);for(const t of["pointerup","keydown"])Rt(this.el,t,e);tt(()=>{this.$store.touchPointer()||Rt(this.el,"pointermove",e)})}ia(e){this.idle(!0,this.ba,e)}ja(e){this.idle(!1,0,e)}fa(){window.clearTimeout(this.da),this.da=-1}ka(e){e.MEDIA_GESTURE||(wa(e)&&(e.key==="Escape"?(this.el?.focus(),this.ca=null):this.ca&&(e.preventDefault(),requestAnimationFrame(()=>{this.ca?.focus(),this.ca=null}))),this.idle(!1,0,e),this.idle(!0,this.ba,e))}ga(e,t,i){if(t===0){this.ha(e,i);return}this.da=window.setTimeout(()=>{this.ha(e&&!this.ea,i)},t)}ha(e,t){this.$store.userIdle()!==e&&(this.$store.userIdle.set(e),e&&document.activeElement&&this.el?.contains(document.activeElement)&&(this.ca=document.activeElement,requestAnimationFrame(()=>this.el?.focus())),this.dispatch("user-idle-change",{detail:e,trigger:t}))}}class JO{$a=!1;rf=!1;pf=!1;Ze=new ZO}class eD extends ls{constructor(e,t,i,r){super(e),this.u=t,this.mf=i,this.j=r,this.nf=r.$store,this.q=r.$provider,this.Q=new QO(e),this.of=new MO(e),this.nb=new S4(e)}Q;of;nb;nf;q;onConnect(){tt(this.uf.bind(this)),tt(this.vf.bind(this)),tt(this.wf.bind(this));const e=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),t=this.xf.bind(this);for(const i of e)i.startsWith("media-")&&this.listen(i,t);this.listen("fullscreen-change",this.d.bind(this))}xf(e){e.stopPropagation(),gt(this.q)&&this[e.type]?.(e)}async M(){const{canPlay:e,paused:t,ended:i,autoplaying:r,seekableStart:l}=this.nf;if(gt(t))try{const u=gt(this.q);return gx(u,gt(e)),gt(i)&&(u.currentTime=l()+.1),u.play()}catch(u){const h=this.createEvent("play-fail",{detail:zf(u)});throw h.autoplay=r(),this.u.N(h),u}}async L(){const{canPlay:e,paused:t}=this.nf;if(gt(t))return;const i=gt(this.q);return gx(i,gt(e)),i.pause()}V(){const{canPlay:e,live:t,liveEdge:i,canSeek:r,liveSyncPosition:l,seekableEnd:u,userBehindLiveEdge:h}=this.nf;if(h.set(!1),gt(()=>!t()||i()||!r()))return;const d=gt(this.q);gx(d,gt(e)),d.currentTime=l()??u()-2}qf=!1;async R(e="prefer-media"){const t=gt(this.q),i=e==="prefer-media"&&this.of.supported||e==="media"?this.of:t?.fullscreen;if(US(e,i),!i.active)return gt(this.nf.pictureInPicture)&&(this.qf=!0,await this.U()),i.enter()}async S(e="prefer-media"){const t=gt(this.q),i=e==="prefer-media"&&this.of.supported||e==="media"?this.of:t?.fullscreen;if(US(e,i),!!i.active){this.nb.locked&&await this.nb.unlock();try{const r=await i.exit();return this.qf&>(this.nf.canPictureInPicture)&&await this.T(),r}finally{this.qf=!1}}}async T(){if(this.sf(),!this.nf.pictureInPicture())return await this.q().pictureInPicture.enter()}async U(){if(this.sf(),!!this.nf.pictureInPicture())return await this.q().pictureInPicture.exit()}sf(){if(!this.nf.canPictureInPicture())throw Error("[vidstack] no pip support")}uf(){this.Q.idleDelay=this.$props.userIdleDelay()}vf(){const{canLoad:e,canFullscreen:t}=this.nf,i=this.of.supported||this.q()?.fullscreen?.supported||!1;e()&>(t)===i||t.set(i)}wf(){const{canLoad:e,canPictureInPicture:t}=this.nf,i=this.q()?.pictureInPicture?.supported||!1;e()&>(t)===i||t.set(i)}"media-audio-track-change-request"(e){if(this.j.audioTracks.readonly)return;const t=e.detail,i=this.j.audioTracks[t];i&&(this.mf.Ze.t("audioTrack",e),i.selected=!0)}async"media-enter-fullscreen-request"(e){try{this.mf.Ze.t("fullscreen",e),await this.R(e.detail)}catch(t){this.e(t)}}async"media-exit-fullscreen-request"(e){try{this.mf.Ze.t("fullscreen",e),await this.S(e.detail)}catch(t){this.e(t)}}async d(e){if(e.detail)try{const t=gt(this.$props.fullscreenOrientation);this.nb.supported&&!Xs(t)&&await this.nb.lock(t)}catch{}}e(e){this.u.N(this.createEvent("fullscreen-error",{detail:zf(e)}))}async"media-enter-pip-request"(e){try{this.mf.Ze.t("pip",e),await this.T()}catch(t){this.tf(t)}}async"media-exit-pip-request"(e){try{this.mf.Ze.t("pip",e),await this.U()}catch(t){this.tf(t)}}tf(e){this.u.N(this.createEvent("picture-in-picture-error",{detail:zf(e)}))}"media-live-edge-request"(e){const{live:t,liveEdge:i,canSeek:r}=this.nf;if(!(!t()||i()||!r())){this.mf.Ze.t("seeked",e);try{this.V()}catch{}}}"media-loop-request"(){window.requestAnimationFrame(async()=>{try{this.mf.rf=!0,this.mf.pf=!0,await this.M()}catch{this.mf.rf=!1,this.mf.pf=!1}})}async"media-pause-request"(e){if(!this.nf.paused())try{this.mf.Ze.t("pause",e),await this.q().pause()}catch{this.mf.Ze.yf("pause")}}async"media-play-request"(e){if(this.nf.paused())try{this.mf.Ze.t("play",e),await this.q().play()}catch(t){const i=this.createEvent("play-fail",{detail:zf(t)});this.u.N(i)}}"media-rate-change-request"(e){this.nf.playbackRate()!==e.detail&&(this.mf.Ze.t("rate",e),this.q().playbackRate=e.detail)}"media-quality-change-request"(e){if(this.j.qualities.readonly)return;
vendor: 8,892 bytes, line 66
66this.mf.Ze.t("quality",e);const t=e.detail;if(t<0)this.j.qualities.autoSelect(e);else{const i=this.j.qualities[t];i&&(i.selected=!0)}}"media-resume-user-idle-request"(e){this.mf.Ze.t("userIdle",e),this.Q.pauseIdleTracking(!1,e)}"media-pause-user-idle-request"(e){this.mf.Ze.t("userIdle",e),this.Q.pauseIdleTracking(!0,e)}"media-seek-request"(e){const{seekableStart:t,seekableEnd:i,ended:r,canSeek:l,live:u,userBehindLiveEdge:h}=this.nf;r()&&(this.mf.pf=!0),this.mf.$a=!1,this.mf.Ze.yf("seeking");const d=Math.min(Math.max(t()+.1,e.detail),i()-.1);!Number.isFinite(d)||!l()||(this.mf.Ze.t("seeked",e),this.q().currentTime=d,u()&&e.isOriginTrusted&&Math.abs(i()-d)>=2&&h.set(!0))}"media-seeking-request"(e){this.mf.Ze.t("seeking",e),this.nf.seeking.set(!0),this.mf.$a=!0}"media-start-loading"(e){this.nf.canLoad()||(this.mf.Ze.t("load",e),this.u.N(this.createEvent("can-load")))}"media-text-track-change-request"(e){const{index:t,mode:i}=e.detail,r=this.j.textTracks[t];r&&(this.mf.Ze.t("textTrack",e),r.setMode(i,e))}"media-mute-request"(e){this.nf.muted()||(this.mf.Ze.t("volume",e),this.q().muted=!0)}"media-unmute-request"(e){const{muted:t,volume:i}=this.nf;t()&&(this.mf.Ze.t("volume",e),this.j.$provider().muted=!1,i()===0&&(this.mf.Ze.t("volume",e),this.q().volume=.25))}"media-volume-change-request"(e){const{muted:t,volume:i}=this.nf,r=e.detail;i()!==r&&(this.mf.Ze.t("volume",e),this.q().volume=r,r>0&&t()&&(this.mf.Ze.t("volume",e),this.q().muted=!1))}}function gx(n,e){if(!(n&&e))throw Error("[vidstack] media not ready")}function US(n,e){if(!e?.supported)throw Error("[vidstack] no fullscreen support")}var tD=nD;function nD(n,e,t){var i=null,r=null,l=function(){i&&(clearTimeout(i),r=null,i=null)},u=function(){var d=r;l(),d&&d()},h=function(){if(!e)return n.apply(this,arguments);var d=this,p=arguments,m=t&&!i;if(l(),r=function(){n.apply(d,p)},i=setTimeout(function(){if(i=null,!m){var g=r;return r=null,g()}},e),m)return r()};return h.cancel=l,h.flush=u,h}var bm=iD;function iD(n,e,t){var i=null,r=null,l=t&&t.leading,u=t&&t.trailing;l==null&&(l=!0),u==null&&(u=!l),l==!0&&(u=!1);var h=function(){i&&(clearTimeout(i),i=null)},d=function(){var m=r;h(),m&&m()},p=function(){var m=l&&!i,g=this,b=arguments;if(r=function(){return n.apply(g,b)},i||(i=setTimeout(function(){if(i=null,u)return r()},e)),m)return m=!1,r()};return p.cancel=h,p.flush=d,p}const sD=Symbol(0),Rc=Symbol(0),qo=Symbol(0),Ec=Symbol(0),Rd=Symbol(0),V1=Symbol(0),ya=Symbol(0),rD=Symbol(0),aD=new Set(["autoplay","autoplay-fail","can-load","sources-change","source-change","load-start","abort","error","loaded-metadata","loaded-data","can-play","play","play-fail","pause","playing","seeking","seeked","waiting"]);class oD extends ls{constructor(e,t,i){super(e),this.mf=t,this.j=i,this.nf=i.$store}nf;zf=new Map;Gf=!0;Df=!1;Bf;onAttach(e){e.setAttribute("aria-busy","true")}onConnect(e){this.Mf(),this.Nf(),this.Of(),this.listen("fullscreen-change",this["fullscreen-change"].bind(this)),this.listen("fullscreen-error",this["fullscreen-error"].bind(this))}N(e){const t=e.type;this[e.type]?.(e),aD.has(t)&&this.zf.set(t,e),this.el?.dispatchEvent(e)}Cf(){this.Hf(),this.mf.pf=!1,this.mf.rf=!1,this.Df=!1,this.Bf=void 0,this.zf.clear()}Af(e,t){this.mf.Ze.cf(e,i=>{t.request=i,Pn(t,i)})}Mf(){this.Ef(),this.If();const e=this.j.textTracks;Rt(e,"add",this.Ef.bind(this)),Rt(e,"remove",this.Ef.bind(this)),Rt(e,"mode-change",this.If.bind(this))}Nf(){const e=this.j.qualities;Rt(e,"add",this.Jf.bind(this)),Rt(e,"remove",this.Jf.bind(this)),Rt(e,"change",this.Pf.bind(this)),Rt(e,"auto-change",this.Qf.bind(this)),Rt(e,"readonly-change",this.Rf.bind(this))}Of(){const e=this.j.audioTracks;Rt(e,"add",this.Kf.bind(this)),Rt(e,"remove",this.Kf.bind(this)),Rt(e,"change",this.Sf.bind(this))}Ef(e){const{textTracks:t}=this.nf;t.set(this.j.textTracks.toArray()),this.dispatch("text-tracks-change",{detail:t(),trigger:e})}If(e){e&&this.Af("textTrack",e);const t=this.j.textTracks.selected,{textTrack:i}=this.nf;i()!==t&&(i.set(t),this.dispatch("text-track-change",{detail:t,trigger:e}))}Kf(e){const{audioTracks:t}=this.nf;t.set(this.j.audioTracks.toArray()),this.dispatch("audio-tracks-change",{detail:t(),trigger:e})}Sf(e){const{audioTrack:t}=this.nf;t.set(this.j.audioTracks.selected),this.Af("audioTrack",e),this.dispatch("audio-track-change",{detail:t(),trigger:e})}Jf(e){const{qualities:t}=this.nf;t.set(this.j.qualities.toArray()),this.dispatch("qualities-change",{detail:t(),trigger:e})}Pf(e){const{quality:t}=this.nf;t.set(this.j.qualities.selected),this.Af("quality",e),this.dispatch("quality-change",{detail:t(),trigger:e})}Qf(){this.nf.autoQuality.set(this.j.qualities.auto)}Rf(){this.nf.canSetQuality.set(!this.j.qualities.readonly)}"provider-change"(e){this.j.$provider.set(e.detail)}autoplay(e){Pn(e,this.zf.get("play")),Pn(e,this.zf.get("can-play")),this.nf.autoplayError.set(void 0)}"autoplay-fail"(e){Pn(e,this.zf.get("play-fail")),Pn(e,this.zf.get("can-play")),this.nf.autoplayError.set(e.detail),this.Cf()}"can-load"(e){this.nf.canLoad.set(!0),this.zf.set("can-load",e),this.Af("load",e),this.j.textTracks[Rd]()}"media-type-change"(e){Pn(e,this.zf.get("source-change"));const t=this.nf.viewType();this.nf.mediaType.set(e.detail),t!==this.nf.viewType()&&setTimeout(()=>this.dispatch("view-type-change",{detail:this.nf.viewType(),trigger:e}),0)}"stream-type-change"(e){const{streamType:t,inferredStreamType:i}=this.nf;Pn(e,this.zf.get("source-change")),i.set(e.detail),e.detail=t()}"rate-change"(e){this.nf.playbackRate.set(e.detail),this.Af("rate",e)}"sources-change"(e){this.nf.sources.set(e.detail)}"source-change"(e){if(Pn(e,this.zf.get("sources-change")),this.nf.source.set(e.detail),this.el?.setAttribute("aria-busy","true"),this.Gf){this.Gf=!1;return}this.j.audioTracks[H1](e),this.j.qualities[H1](e),this.Cf(),WO(this.j.$store),this.zf.set(e.type,e)}abort(e){Pn(e,this.zf.get("source-change")),Pn(e,this.zf.get("can-load"))}"load-start"(e){Pn(e,this.zf.get("source-change"))}error(e){this.nf.error.set(e.detail),Pn(e,this.zf.get("abort"))}"loaded-metadata"(e){Pn(e,this.zf.get("load-start"))}"loaded-data"(e){Pn(e,this.zf.get("load-start"))}"can-play"(e){e.trigger?.type!=="loadedmetadata"&&Pn(e,this.zf.get("loaded-metadata")),this.Lf(e.detail),this.el?.setAttribute("aria-busy","false")}"can-play-through"(e){this.Lf(e.detail),Pn(e,this.zf.get("can-play"))}Lf(e){const{seekable:t,seekableEnd:i,buffered:r,duration:l,canPlay:u}=this.nf;t.set(e.seekable),r.set(e.buffered),l.set(i),u.set(!0)}"duration-change"(e){const{live:t,duration:i}=this.nf,r=e.detail;t()||i.set(Number.isNaN(r)?0:r)}progress(e){const{buffered:t,seekable:i,live:r,duration:l,seekableEnd:u}=this.nf,h=e.detail;t.set(h.buffered),i.set(h.seekable),r()&&(l.set(u),this.dispatch("duration-change",{detail:u(),trigger:e}))}play(e){const{paused:t,autoplayError:i,ended:r,autoplaying:l}=this.nf;if(e.autoplay=l(),this.mf.rf||!t()){e.stopImmediatePropagation();return}Pn(e,this.zf.get("waiting")),this.Af("play",e),t.set(!1),i.set(void 0),(r()||this.mf.pf)&&(this.mf.pf=!1,r.set(!1),this.N(this.createEvent("replay",{trigger:e})))}"play-fail"(e){Pn(e,this.zf.get("play")),this.Af("play",e);const{paused:t,playing:i}=this.nf;t.set(!0),i.set(!1),this.Cf()}playing(e){const t=this.zf.get("play");t?(Pn(e,this.zf.get("waiting")),Pn(e,t)):Pn(e,this.zf.get("seeked")),setTimeout(()=>this.Cf(),0);const{paused:i,playing:r,seeking:l,ended:u}=this.nf;if(i.set(!1),r.set(!0),l.set(!1),u.set(!1),this.mf.rf){e.stopImmediatePropagation(),this.mf.rf=!1;return}this.started(e)}started(e){const{started:t,live:i,liveSyncPosition:r,seekableEnd:l}=this.nf;if(!t()){if(i()){const u=r()??l()-2;Number.isFinite(u)&&(this.j.$provider().currentTime=u)}t.set(!0),this.N(this.createEvent("started",{trigger:e}))}}pause(e){if(this.mf.rf){e.stopImmediatePropagation();return}Pn(e,this.zf.get("seeked")),this.Af("pause",e);const{paused:t,playing:i,seeking:r}=this.nf;t.set(!0),i.set(!1),r.set(!1),this.Cf()}"time-update"(e){const{currentTime:t,played:i,waiting:r}=this.nf,l=e.detail;t.set(l.currentTime),i.set(l.played),r.set(!1);for(const u of this.j.textTracks)u[Ec](l.currentTime,e)}"volume-change"(e){const{volume:t,muted:i}=this.nf,r=e.detail;t.set(r.volume),i.set(r.muted||r.volume===0),this.Af("volume",e)}seeking=bm(e=>{const{seeking:t,currentTime:i,paused:r}=this.nf;t.set(!0),i.set(e.detail),this.Af("seeking",e),r()&&(this.Bf=e,this.Ff())},150,{leading:!0});seeked(e){const{seeking:t,currentTime:i,paused:r,duration:l,ended:u}=this.nf;if(this.mf.$a)t.set(!0),e.stopImmediatePropagation();else if(t()){const h=this.zf.get("waiting");Pn(e,h),h?.trigger?.type!=="seeking"&&Pn(e,this.zf.get("seeking")),r()&&this.Hf(),t.set(!1),e.detail!==l()&&u.set(!1),i.set(e.detail),this.Af("seeked",e);const d=e.originEvent;d&&d.isTrusted&&!/seek/.test(d.type)&&this.started(e)}}waiting(e){this.Df||this.mf.$a||(e.stopImmediatePropagation(),this.Bf=e,this.Ff())}Ff=tD(()=>
66{if(!this.Bf)return;this.Df=!0;const{waiting:e,playing:t}=this.nf;e.set(!0),t.set(!1);const i=this.createEvent("waiting",{trigger:this.Bf});this.zf.set("waiting",i),this.el.dispatchEvent(i),this.Bf=void 0,this.Df=!1},300);ended(e){if(this.mf.rf){e.stopImmediatePropagation();return}const{paused:t,playing:i,seeking:r,ended:l}=this.nf;t.set(!0),i.set(!1),r.set(!1),l.set(!0),this.Cf()}Hf(){this.Ff.cancel(),this.nf.waiting.set(!1)}"fullscreen-change"(e){this.nf.fullscreen.set(e.detail),this.Af("fullscreen",e)}"fullscreen-error"(e){this.Af("fullscreen",e)}"picture-in-picture-change"(e){this.nf.pictureInPicture.set(e.detail),this.Af("pip",e)}"picture-in-picture-error"(e){this.Af("pip",e)}}class lD extends ls{onAttach(e){tt(this.Tf.bind(this)),tt(this.Uf.bind(this)),tt(this.Vf.bind(this)),tt(this.Wf.bind(this)),tt(this.Xf.bind(this)),tt(this.Yf.bind(this)),tt(this.Zf.bind(this)),tt(this._f.bind(this)),tt(this.$f.bind(this)),tt(this.ag.bind(this))}bg(){}Tf(){const e=this.$props.autoplay();this.$store.autoplay.set(e),this.dispatch("autoplay-change",{detail:e})}Vf(){const e=this.$props.loop();this.$store.loop.set(e),this.dispatch("loop-change",{detail:e})}Wf(){const e=this.$props.controls();this.$store.controls.set(e),this.dispatch("controls-change",{detail:e})}Uf(){const e=this.$props.poster();this.$store.poster.set(e),this.dispatch("poster-change",{detail:e})}Xf(){this.$store.crossorigin.set(this.$props.crossorigin())}Yf(){const e=this.$props.playsinline();this.$store.playsinline.set(e),this.dispatch("playsinline-change",{detail:e})}_f(){this.dispatch("live-change",{detail:this.$store.live()})}Zf(){this.$store.liveEdgeTolerance.set(this.$props.liveEdgeTolerance()),this.$store.minLiveDVRWindow.set(this.$props.minLiveDVRWindow())}$f(){this.dispatch("live-edge-change",{detail:this.$store.liveEdge()})}ag(){this.$store.thumbnails.set(this.$props.thumbnails())}}function $v(n,e="preconnect"){const t=document.querySelector(`link[href="${n}"]`);if(!xl(t))return!0;const i=document.createElement("link");return i.rel=e,i.href=n,i.crossOrigin="true",document.head.append(i),!0}const $f={};function QX(n){if($f[n])return $f[n].promise;const e=Bp(),t=document.querySelector(`script[src="${n}"]`);if(!xl(t))return e.resolve(),e.promise;const i=document.createElement("script");return i.src=n,i.onload=()=>{e.resolve(),delete $f[n]},i.onerror=()=>{e.reject(),delete $f[n]},setTimeout(()=>document.head.append(i),0),e.promise}function Fv(n){return n==="use-credentials"?"include":Fr(n)?"same-origin":void 0}function cD(n,e){for(let t=0,i=e.length;t<i;t++)if(Gp(e[t],n))return e[t];return null}function Gp(n,e){return e>=n.startTime&&e<n.endTime}function M4(n,e,t){const i=n.toArray().find(r=>r.kind==="chapters"&&r.mode==="showing");if(i!==e){if(!i){t(null);return}i.readyState==2?t(i):(t(null),i.addEventListener("load",()=>t(i),{once:!0}))}}class G1 extends Cv{static createId(e){return`id::${e.type}-${e.kind}-${e.src??e.label}`}src;content;type;encoding;id="";label="";language="";kind;default=!1;Ia=!1;Ea=0;Ga="disabled";Ja={};Ha=[];Da=[];Fa=[];[qo]=0;[Rc];[V1]=null;[ya]=null;get metadata(){return this.Ja}get regions(){return this.Ha}get cues(){return this.Da}get activeCues(){return this.Fa}get readyState(){return this[qo]}get mode(){return this.Ga}set mode(e){this.setMode(e)}constructor(e){super();for(const t of Object.keys(e))this[t]=e[t];
66this.type||(this.type="vtt"),e.content?xr(async()=>{const{parseText:t,VTTCue:i,VTTRegion:r}=await Promise.resolve().then(()=>q1);return{parseText:t,VTTCue:i,VTTRegion:r}},void 0).then(({parseText:t,VTTCue:i,VTTRegion:r})=>{e.type==="json"?this.Ka(e.content,i,r):t(e.content,{type:e.type}).then(({cues:l,regions:u})=>{this.Da=l,this.Ha=u,this.La()})}):e.src||(this[qo]=2)}addCue(e,t){let i=0,r=this.Da.length;for(i=0;i<r&&!(e.endTime<=this.Da[i].startTime);i++);i===r?this.Da.push(e):this.Da.splice(i,0,e),t?.type!=="cuechange"&&this[ya]?.track.addCue(e),this.dispatchEvent(new Hn("add-cue",{detail:e,trigger:t})),Gp(e,this.Ea)&&this[Ec](this.Ea,t)}removeCue(e,t){const i=this.Da.indexOf(e);if(i>=0){const r=this.Fa.includes(e);this.Da.splice(i,1),this[ya]?.track.removeCue(e),this.dispatchEvent(new Hn("remove-cue",{detail:e,trigger:t})),r&&this[Ec](this.Ea,t)}}setMode(e,t){this.Ga!==e&&(this.Ga=e,e==="disabled"?(this.Fa=[],this.Ma()):this.readyState===2?this[Ec](this.Ea,t):this.Na(),this.dispatchEvent(new Hn("mode-change",{detail:this,trigger:t})),this[V1]?.())}[Ec](e,t){if(this.Ea=e,this.mode==="disabled"||!this.Da.length)return;const i=[];for(let l=0,u=this.Da.length;l<u;l++){const h=this.Da[l];Gp(h,e)&&i.push(h)}let r=i.length!==this.Fa.length;if(!r){for(let l=0;l<i.length;l++)if(!this.Fa.includes(i[l])){r=!0;break}}this.Fa=i,r&&this.Ma(t)}[Rd](){this.Ia=!0,this.Ga!=="disabled"&&this.Na()}async Na(){if(!(!this.Ia||!this.src||this[qo]>0)){this[qo]=1,this.dispatchEvent(new Hn("load-start"));try{const{parseResponse:e,VTTCue:t,VTTRegion:i}=await xr(async()=>{const{parseResponse:u,VTTCue:h,VTTRegion:d}=await Promise.resolve().then(()=>q1);return{parseResponse:u,VTTCue:h,VTTRegion:d}},void 0),r=this[Rc]?.(),l=fetch(this.src,{headers:this.type==="json"?{"Content-Type":"application/json"}:void 0,credentials:Fv(r)});if(this.type==="json")this.Ka(await(await l).text(),t,i);else{const{errors:u,metadata:h,regions:d,cues:p}
66=await e(l,{type:this.type,encoding:this.encoding});if(u[0]?.code===0)throw u[0];this.Ja=h,this.Ha=d,this.Da=p}this.La()}catch(e){this.Oa(e)}}}La(){if(this[qo]=2,!this.src||this.type!=="vtt"){const t=this[ya]?.track;if(t)for(const i of this.Da)t.addCue(i)}const e=new Hn("load");this[Ec](this.Ea,e),this.dispatchEvent(e)}Oa(e){this[qo]=3,this.dispatchEvent(new Hn("error",{detail:e}))}Ka(e,t,i){try{e=JSON.parse(e),e.regions&&(this.Ha=e.regions.map(r=>Object.assign(new i,r))),e.cues&&(this.Da=e.cues.filter(r=>Dc(r.startTime)&&Dc(r.endTime)).map(r=>Object.assign(new t(0,0,""),r)))}catch(r){this.Oa(r)}}Ma(e){this.dispatchEvent(new Hn("cue-change",{trigger:e}))}}const uD=/captions|subtitles/;function Wi(n){return uD.test(n.kind)}class dD{constructor(e){this.$=e}Z=null;Y=null;_=-1;setTarget(e){this.Z=e}getPlayer(e){return this.Y?this.Y:((e??this.Z)?.dispatchEvent(new Hn("find-media-player",{detail:t=>{this.Y=t},bubbles:!0,composed:!0})),this.Y)}setPlayer(e){this.Y=e}startLoading(e){this.X("media-start-loading",e)}play(e){this.X("media-play-request",e)}pause(e){this.X("media-pause-request",e)}mute(e){this.X("media-mute-request",e)}unmute(e){this.X("media-unmute-request",e)}enterFullscreen(e,t){this.X("media-enter-fullscreen-request",t,e)}exitFullscreen(e,t){this.X("media-exit-fullscreen-request",t,e)}enterPictureInPicture(e){this.X("media-enter-pip-request",e)}exitPictureInPicture(e){this.X("media-exit-pip-request",e)}seeking(e,t){this.X("media-seeking-request",t,e)}seek(e,t){this.X("media-seek-request",t,e)}seekToLiveEdge(e){this.X("media-live-edge-request",e)}changeVolume(e,t){this.X("media-volume-change-request",t,Math.max(0,Math.min(1,e)))}changeAudioTrack(e,t){this.X("media-audio-track-change-request",t,e)}changeQuality(e,t){this.X("media-quality-change-request",t,e)}changeTextTrackMode(e,t,i){this.X("media-text-track-change-request",i,{index:e,mode:t})}changePlaybackRate(e,t){this.X("media-rate-change-request",t,e)}resumeUserIdle(e){this.X("media-resume-user-idle-request",e)}pauseUserIdle(e){this.X("media-pause-user-idle-request",e)}togglePaused(e){const t=this.getPlayer(e?.target);t&&(t.state.paused?this.play(e):this.pause(e))}toggleUserIdle(e){const t=this.getPlayer(e?.target);t&&t.user.idle(!t.user.idling,0,e)}toggleMuted(e){const t=this.getPlayer(e?.target);t&&(t.state.muted?this.unmute(e):this.mute(e))}toggleFullscreen(e,t){const i=this.getPlayer(t?.target);i&&(i.state.fullscreen?this.exitFullscreen(e,t):this.enterFullscreen(e,t))}togglePictureInPicture(e){const t=this.getPlayer(e?.target);t&&(t.state.pictureInPicture?this.exitPictureInPicture(e):this.enterPictureInPicture(e))}toggleCaptions(e){const t=this.getPlayer(e?.target);if(!t)return;const i=t.state.textTracks,r=t.state.textTrack;if(r){const l=i.indexOf(r);this.changeTextTrackMode(l,"disabled",e),this._=l}else{let l=this._;(!i[l]||!Wi(i[l]))&&(l=-1),l===-1&&(l=i.findIndex(u=>Wi(u)&&u.default)),l===-1&&(l=i.findIndex(u=>Wi(u))),l>=0&&this.changeTextTrackMode(l,"showing",e),this._=-1}}X(e,t,i){const r=new Hn(e,{bubbles:!0,composed:!0,detail:i,trigger:t});(t?.target&&(t.target===document||t.target===window||t.target===document.body||this.Y&&!this.Y.contains(t.target))?this.Z??this.getPlayer():t?.target??this.Z)?.dispatchEvent(r)}aa(e){}}class hD extends ls{j;onConnect(){this.j=kn(),tt(this.cg.bind(this))}cg(){const{canLoad:e,thumbnailCues:t}=this.j.$store;if(!e())return;const i=new AbortController,{crossorigin:r,thumbnails:l}=this.j.$store,u=l();if(u)return xr(async()=>{const{parseResponse:h}=await Promise.resolve().then(()=>q1);return{parseResponse:h}},void 0).then(({parseResponse:h})=>{h(fetch(u,{signal:i.signal,credentials:Fv(r())})).then(({cues:d})=>t.set(d)).catch(hm)}),()=>{i.abort(),t.set([])}}}class fD extends T4{getById(e){return e===""?null:this.a.find(t=>t.id===e)??null}}class pD{priority=0;eg=!0;qa=null;ya=null;dg=new Set;canRender(){return!0}attach(e){this.qa=e,e.textTracks.onchange=this.Hc.bind(this)}addTrack(e){this.dg.add(e),this.gg(e)}removeTrack(e){e[ya]?.remove?.(),e[ya]=null,this.dg.delete(e)}changeTrack(e){const t=e?.[ya];t&&t.track.mode!=="showing"&&(t.track.mode="showing"),this.ya=e}setDisplay(e){this.eg=e,this.Hc()}detach(){this.qa&&(this.qa.textTracks.onchange=null);for(const e of this.dg)this.removeTrack(e);this.dg.clear(),this.qa=null,this.ya=null}gg(e){if(!this.qa)return;const t=e[ya]??=this.hg(e);t instanceof HTMLElement&&(this.qa.append(t),t.track.mode=t.default?"showing":"hidden")}hg(e){const t=document.createElement("track"),i=e.default||e.mode==="showing",r=e.src&&e.type==="vtt";return t.id=e.id,t.src=r?e.src:"https://cdn.jsdelivr.net/npm/[email protected]/empty.vtt",t.label=e.label,t.kind=e.kind,t.default=i,e.language&&(t.srclang=e.language),i&&!r&&this.fg(e,t.track),t}fg(e,t){if(!(e.src&&e.type==="vtt"||t.cues?.length))for(const i of e.cues)t.addCue(i)}Hc(e){for(const t of this.dg){const i=t[ya]?.track;if(!i)continue;if(!this.eg){i.mode="disabled";continue}const r=i.mode==="showing";r&&this.fg(t,i),t.setMode(r?"showing":"disabled",e)}}}class mD{constructor(e){this.j=e;const t=e.textTracks;this.pa=t,tt(this.ua.bind(this)),_r(this.ra.bind(this)),Rt(t,"add",this.va.bind(this)),Rt(t,"remove",this.wa.bind(this)),Rt(t,"mode-change",this.na.bind(this))}qa=null;pa;oa=[];
vendor: 5,226 bytes, line 66
66sa=!1;la=null;ma=null;ua(){const{$store:e,$iosControls:t}=this.j;this.sa=e.controls()||t(),this.na()}add(e){this.oa.push(e),this.na()}remove(e){e.detach(),this.oa.splice(this.oa.indexOf(e),1),this.na()}[sD](e){requestAnimationFrame(()=>{if(this.qa=e,e){this.la=new pD,this.la.attach(e);for(const t of this.pa)this.ta(t)}this.na()})}ta(e){Wi(e)&&this.la?.addTrack(e)}xa(e){Wi(e)&&this.la?.removeTrack(e)}va(e){this.ta(e.detail)}wa(e){this.xa(e.detail)}na(){if(!this.qa){this.ra();return}const e=this.pa.selected;if(this.sa||e?.[rD]){this.ma?.changeTrack(null),this.la.setDisplay(!0),this.la.changeTrack(e);return}if(this.la.setDisplay(!1),this.la.changeTrack(null),!e){this.ma?.changeTrack(null);return}const t=this.oa.sort((i,r)=>i.priority-r.priority).find(i=>i.canRender(e));this.ma!==t&&(this.ma?.detach(),t?.attach(this.qa),this.ma=t??null),t?.changeTrack(e)}ra(){this.la?.detach(),this.la=null,this.ma?.detach(),this.ma=null}}class gD extends _4{Ia=!1;Pa={};[Rc];get selected(){return this.a.find(t=>t.mode==="showing"&&Wi(t))??null}add(e,t){const i=e instanceof G1,r=i?e:new G1(e);return this.Pa[e.kind]&&e.default&&delete e.default,r.addEventListener("mode-change",this.Qa),this[Hp](r,t),r[Rc]=this[Rc],this.Ia&&r[Rd](),e.default&&(this.Pa[e.kind]=r,r.mode="showing"),this}remove(e,t){if(this.a.includes(e))return e===this.Pa[e.kind]&&delete this.Pa[e.kind],e.mode="disabled",e[V1]=null,e.removeEventListener("mode-change",this.Qa),this[B1](e,t),this}clear(e){for(const t of this.a)this.remove(t,e);return this}getById(e){return this.a.find(t=>t.id===e)??null}getByKind(e){const t=Array.isArray(e)?e:[e];return this.a.filter(i=>t.includes(i.kind))}[Rd](){if(!this.Ia){for(const e of this.a)e[Rd]();this.Ia=!0}}Qa=this.Ra.bind(this);Ra(e){const t=e.detail;if(t.mode==="showing"){const i=Wi(t)?["captions","subtitles"]:[t.kind];for(const r of this.a)r.mode==="showing"&&r!=t&&i.includes(r.kind)&&(r.mode="disabled")}this.dispatchEvent(new Hn("mode-change",{detail:e.detail,trigger:e}))}}class xD{constructor(e,t,i){this.l=e,this.j=t,this.k=i;const r=new zv,l=new x4,u=new EO;this.Ie=$i(()=>t.$props.preferNativeHLS()?[l,u,r]:[r,l,u]),tt(this.Ke.bind(this)),tt(this.Le.bind(this)),tt(this.Me.bind(this)),tt(this.Ne.bind(this))}Ie;Ke(){this.j.delegate.p("sources-change",{detail:[...bD(this.j.$props.src()),...this.l()]})}Le(){const{$store:e}=this.j,t=e.sources(),i=gt(e.source),r=this.Je(i,t);if(t[0]?.src&&!r.src&&!r.type){const{crossorigin:u}=e,h=Fv(u()),d=new AbortController;return Promise.all(t.map(p=>Fr(p.src)&&p.type==="?"?fetch(p.src,{method:"HEAD",credentials:h,signal:d.signal}).then(m=>(p.type=m.headers.get("content-type")||"??",p)).catch(()=>p):p)).then(p=>{d.signal.aborted||(this.Je(gt(e.source),p),Pr())}),()=>d.abort()}Pr()}Je(e,t){let i={src:"",type:""},r=null;for(const l of t){const u=gt(this.Ie).find(h=>h.canPlay(l));u&&(i=l,r=u)}return this.Oe(e,i,r),this.Pe(gt(this.k),r),i}Oe(e,t,i){t.src===e.src&&t.type===e.type||(this.j.delegate.p("source-change",{detail:t}),this.j.delegate.p("media-type-change",{detail:i?.mediaType(t)||"unknown"}))}Pe(e,t){t!==e&&(this.j.delegate.p("provider-change",{detail:null}),t&>(()=>t.preconnect?.(this.j)),this.k.set(t),this.j.delegate.p("provider-loader-change",{detail:t}))}Me(){const e=this.j.$provider();if(e){if(this.j.$store.canLoad()){gt(()=>e.setup({...this.j,player:this.j.player}));return}gt(()=>e.preconnect?.(this.j))}}Ne(){const e=this.j.$provider(),t=this.j.$store.source();if(this.j.$store.canLoad()){gt(()=>e?.loadSource(t,gt(this.j.$store.preload)));return}try{Fr(t.src)&&$v(new URL(t.src).origin,"preconnect")}catch{}}}function bD(n){return(br(n)?n:[!Fr(n)&&"src"in n?n:{src:n}]).map(({src:e,type:t})=>({src:e,type:t??(!Fr(e)||e.startsWith("blob:")?"video/object":"?")}))}class vD{constructor(e,t){this.m=e,this.j=t,tt(this.He.bind(this))}Ge=[];He(){const e=[...this.j.$props.textTracks(),...this.m()];for(const t of this.Ge)if(!e.some(i=>i.id===t.id)){const i=t.id&&this.j.textTracks.getById(t.id);i&&this.j.textTracks.remove(i)}for(const t of e){const i=t.id||G1.createId(t);this.j.textTracks.getById(i)||(t.id=i,this.j.textTracks.add(t))}this.Ge=e}}class yD extends Vn{static el=Yt({tagName:"media-outlet"});j;l=pn([]);m=pn([]);k=pn(null);constructor(e){super(e),this.j=kn(),new xD(this.l,this.j,this.k),new vD(this.m,this.j)}onAttach(e){e.setAttribute("keep-alive","")}onConnect(e){const t=new ResizeObserver(hl(this.n.bind(this)));t.observe(e);const i=new MutationObserver(this.o.bind(this));return i.observe(e,{attributes:!0,childList:!0}),w4&&Rt(e,"touchstart",r=>r.preventDefault(),{passive:!1}),th(()=>{this.n(),this.o()}),()=>{t.disconnect(),i.disconnect()}}onDestroy(){this.j.$store.currentTime.set(0)}n(){const e=this.j.player,t=this.el.offsetWidth,i=this.el.offsetHeight;e&&(e.$store.mediaWidth.set(t),e.$store.mediaHeight.set(i),Ms(e,"--media-width",t+"px"),Ms(e,"--media-height",i+"px"))}o(){const e=[],t=[],i=this.el.children;for(const r of i)r instanceof HTMLSourceElement?e.push({src:r.src,type:r.type}):r instanceof HTMLTrackElement&&t.push({id:r.id,src:r.src,kind:r.track.kind,language:r.srclang,label:r.label,default:r.default,type:r.getAttribute("data-type")});this.l.set(e),this.m.set(t),Pr()}render(){let e;return _r(()=>
66e?.destroy?.()),()=>{e?.destroy();const t=this.k();if(!t)return null;const i=t.render(this.j.$store);return gt(()=>{t.load(this.j).then(r=>{gt(this.k)===t&&(this.j.delegate.p("provider-change",{detail:r}),e=r)})}),i}}}class _D extends ls{constructor(e,t){super(e),this.ig=t}onAttach(e){const{$props:t,ariaKeys:i}=kn(),r=e.getAttribute("aria-keyshortcuts");if(r){i[this.ig]=r,_r(()=>{delete i[this.ig]});return}const l=t.keyShortcuts()[this.ig];l&&e.setAttribute("aria-keyshortcuts",l)}}const wD=zt('<!$><svg viewBox="0 0 32 32" fill="none" aria-hidden="true" focusable="false" data-media-icon="true"></svg>');function di({slot:n,part:e,paths:t,rotate:i}){return(()=>{const[r,l]=An(wD);return ln(r,"data-rotate",i),ln(r,"slot",n),ln(r,"part",e),$P||(r.innerHTML=t),r})()}const SD={LoadFail:0,BadSignature:1,BadTimestamp:2,BadSettingValue:3,BadFormat:4,UnknownSetting:5};class ED extends Error{code;line;constructor(e){super(e.reason),this.code=e.code,this.line=e.line}}const A4=/\r?\n|\r/gm;class CD{writable;readable;constructor(e){const t=new ND(e);this.writable=new WritableStream({write(i){t.transform(i)},close(){t.close()}}),this.readable=new ReadableStream({start(i){t.onLine=r=>i.enqueue(r),t.onClose=()=>i.close()}})}}class ND{x="";y;onLine;onClose;constructor(e){this.y=new TextDecoder(e)}transform(e){this.x+=this.y.decode(e,{stream:!0});const t=this.x.split(A4);this.x=t.pop()||"";for(let i=0;i<t.length;i++)this.onLine(t[i].trim())}close(){this.x&&this.onLine(this.x.trim()),this.x="",this.onClose()}}async function TD(n,e){const t=new ReadableStream({start(i){const r=n.split(A4);for(const l of r)i.enqueue(l);i.close()}});return Bv(t,e)}async function Bv(n,e){const t=e?.type??"vtt";let i;if(typeof t=="string")switch(t){case"srt":i=(await xr(async()=>{const{default:p}=await import("./srt-parser-8_nLiFx7.js");return{default:p}},[])).default;break;case"ssa":case"ass":i=(await xr(async()=>{const{default:p}=await import("./ssa-parser-CKsQflvC.js");return{default:p}},[])).default;break;default:i=(await Promise.resolve().then(function(){return WD})).default}else i=t;let r;const l=n.getReader(),u=i(),h=!!e?.strict||!!e?.errors;await u.init({strict:!1,...e,errors:h,type:t,cancel(){l.cancel(),r=u.done(!0)}});let d=1;for(;;){const{value:p,done:m}=await l.read();if(m){u.parse("",d),r=u.done(!1);break}u.parse(p,d),d++}return r}async function MD(n,e){const t=await n;if(!t.ok||!t.body)return{metadata:{},cues:[],regions:[],errors:[void 0]};const i=t.headers.get("content-type")||"",r=i.match(/text\/(.*?)(?:;|$)/)?.[1],l=i.match(/charset=(.*?)(?:;|$)/)?.[1];return R4(t.body,{type:r,encoding:l,...e})}async function R4(n,{encoding:e="utf-8",...t}={}){const i=n.pipeThrough(new CD(e));return Bv(i,t)}class AD extends EventTarget{id="";startTime;endTime;text;pauseOnExit=!1;constructor(e,t,i){super(),this.startTime=e,this.endTime=t,this.text=i}addEventListener(e,t,i){super.addEventListener(e,t,i)}removeEventListener(e,t,i){super.removeEventListener(e,t,i)}}const RD=window.VTTCue;class k4 extends RD{region=null;vertical="";snapToLines=!0;line="auto";lineAlign="start";position="auto";positionAlign="auto";size=100;align="center";style}class j4{id="";width=100;lines=3;regionAnchorX=0;regionAnchorY=100;viewportAnchorX=0;viewportAnchorY=100;scroll=""}const IS=",",kD="%";function jD(n){const e=parseInt(n,10);return Number.isNaN(e)?null:e}function gd(n){const e=parseInt(n.replace(kD,""),10);return!Number.isNaN(e)&&e>=0&&e<=100?e:null}function zS(n){if(!n.includes(IS))return null;const[e,t]=n.split(IS).map(gd);return e!==null&&t!==null?[e,t]:null}function LD(n){const e=parseFloat(n);return Number.isNaN(e)?null:e}const PD="WEBVTT",$S=",",OD="%",rc=/[:=]/,DD=/^[\s\t]*(region|vertical|line|position|size|align)[:=]/,UD="NOTE",ID="REGION",zD=/^REGION:?[\s\t]+/,rd=/[\s\t]+/,$D="-->",FD=/[\s\t]*-->[\s\t]+/,BD=/start|center|end|left|right/,HD=/start|center|end/,VD=/line-(?:left|right)|center|auto/,GD=/^(?:(\d{1,2}):)?(\d{2}):(\d{2})(?:\.(\d{1,3}))?$/;var L4=(n=>(n[n.None=0]="None",n[n.Header=1]="Header",n[n.Cue=2]="Cue",n[n.Region=3]="Region",n[n.Note=4]="Note",n))(L4||{});class P4{f;c=0;g={};h={};j=[];a=null;b=null;k=[];d;l="";
66async init(e){this.f=e,e.strict&&(this.c=1),e.errors&&(this.d=(await xr(async()=>{const{ParseErrorBuilder:t}=await import("./errors-CQwnS1r0.js");return{ParseErrorBuilder:t}},[])).ParseErrorBuilder)}parse(e,t){if(e==="")this.a?(this.j.push(this.a),this.f.onCue?.(this.a),this.a=null):this.b?(this.h[this.b.id]=this.b,this.f.onRegion?.(this.b),this.b=null):this.c===1&&(this.i(e,t),this.f.onHeaderMetadata?.(this.g)),this.c=0;else if(this.c)switch(this.c){case 1:this.i(e,t);break;case 2:if(this.a){const i=this.a.text.length>0;!i&&DD.test(e)?this.m(e.split(rd),t):this.a.text+=(i?` 67`:"")+e}break;case 3:this.n(e.split(rd),t);break}else if(e.startsWith(UD))this.c=4;else if(e.startsWith(ID))this.c=3,this.b=new j4,this.n(e.replace(zD,"").split(rd),t);else if(e.includes($D)){const i=this.o(e,t);i&&(this.a=new k4(i[0],i[1],""),this.a.id=this.l,this.m(i[2],t)),this.c=2}else t===1&&this.i(e,t);this.l=e}done(){return{metadata:this.g,cues:this.j,regions:Object.values(this.h),errors:this.k}}i(e,t){if(t>1){if(rc.test(e)){const[i,r]=e.split(rc);i&&(this.g[i]=(r||"").replace(rd,""))}}else e.startsWith(PD)?this.c=1:this.e(this.d?.p())}
vendor: 12,147 bytes, lines 67-69
67o(e,t){const[i,r=""]=e.split(FD),[l,...u]=r.split(rd),h=Gd(i),d=Gd(l);if(h!==null&&d!==null&&d>h)return[h,d,u];h===null&&this.e(this.d?.q(i,t)),d===null&&this.e(this.d?.r(l,t)),h!=null&&d!==null&&d>h&&this.e(this.d?.s(h,d,t))}n(e,t){let i;for(let r=0;r<e.length;r++)if(rc.test(e[r])){i=!1;const[l,u]=e[r].split(rc);switch(l){case"id":this.b.id=u;break;case"width":const h=gd(u);h!==null?this.b.width=h:i=!0;break;case"lines":const d=jD(u);d!==null?this.b.lines=d:i=!0;break;case"regionanchor":const p=zS(u);p!==null?(this.b.regionAnchorX=p[0],this.b.regionAnchorY=p[1]):i=!0;break;case"viewportanchor":const m=zS(u);m!==null?(this.b.viewportAnchorX=m[0],this.b.viewportAnchorY=m[1]):i=!0;break;case"scroll":u==="up"?this.b.scroll="up":i=!0;break;default:this.e(this.d?.t(l,u,t))}i&&this.e(this.d?.u(l,u,t))}}m(e,t){let i;for(let r=0;r<e.length;r++)if(i=!1,rc.test(e[r])){const[l,u]=e[r].split(rc);switch(l){case"region":const h=this.h[u];h&&(this.a.region=h);break;case"vertical":u==="lr"||u==="rl"?(this.a.vertical=u,this.a.region=null):i=!0;break;case"line":const[d,p]=u.split($S);if(d.includes(OD)){const _=gd(d);_!==null?(this.a.line=_,this.a.snapToLines=!1):i=!0}else{const _=LD(d);_!==null?this.a.line=_:i=!0}HD.test(p)?this.a.lineAlign=p:p&&(i=!0),this.a.line!=="auto"&&(this.a.region=null);break;case"position":const[m,g]=u.split($S),b=gd(m);b!==null?this.a.position=b:i=!0,g&&VD.test(g)?this.a.positionAlign=g:g&&(i=!0);break;case"size":const y=gd(u);y!==null?(this.a.size=y,y<100&&(this.a.region=null)):i=!0;break;case"align":BD.test(u)?this.a.align=u:i=!0;break;default:this.e(this.d?.v(l,u,t))}i&&this.e(this.d?.w(l,u,t))}}e(e){if(e){if(this.k.push(e),this.f.strict)throw this.f.cancel(),e;this.f.onError?.(e)}}}function Gd(n){const e=n.match(GD);if(!e)return null;const t=e[1]?parseInt(e[1],10):0,i=parseInt(e[2],10),r=parseInt(e[3],10),l=e[4]?parseInt(e[4].padEnd(3,"0"),10):0,u=t*3600+i*60+r+l/1e3;return t<0||i<0||r<0||l<0||i>59||r>59?null:u}function qD(){return new P4}var WD=Object.freeze({__proto__:null,VTTBlock:L4,VTTParser:P4,default:qD,parseVTTTimestamp:Gd});const XD=/[0-9]/,YD=/[\s\t]+/,O4={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span",timestamp:"span"},KD={"&":"&","<":"<",">":">",""":'"',"'":"'"," ":"Â ","‎":"â","‏":"â"},ZD=/&(?:amp|lt|gt|quot|#(0+)?39|nbsp|lrm|rlm);/g,QD=new Set(["white","lime","cyan","red","yellow","magenta","blue","black"]),JD=new Set(Object.keys(O4));function D4(n){let e="",t=1,i=[],r=[],l;for(let p=0;p<n.text.length;p++){const m=n.text[p];switch(t){case 1:m==="<"?(d(),t=2):e+=m;break;case 2:switch(m){case` 68`:case" ":case" ":u(),t=4;break;case".":u(),t=3;break;case"/":t=5;break;case">":u(),t=1;break;default:!e&&XD.test(m)&&(t=6),e+=m;break}break;case 3:switch(m){case" ":case" ":case` 69`:h(),l&&l.class?.trim(),t=4;break;case".":h();break;case">":h(),l&&l.class?.trim(),t=1;break;default:e+=m}break;case 4:m===">"?(e=e.replace(YD," "),l?.type==="v"?l.voice=xx(e):l?.type==="lang"&&(l.lang=xx(e)),e="",t=1):e+=m;break;case 5:m===">"&&(e="",l=r.pop(),t=1);break;case 6:if(m===">"){const g=Gd(e);g!==null&&g>=n.startTime&&g<=n.endTime&&(e="timestamp",u(),l.time=g),e="",t=1}else e+=m;break}}function u(){if(JD.has(e)){const p=l;l=eU(e),p?(r[r.length-1]!==p&&r.push(p),p.children.push(l)):i.push(l)}e="",t=1}function h(){if(l&&e){const p=e.replace("bg_","");QD.has(p)?l[e.startsWith("bg_")?"bgColor":"color"]=p:l.class=l.class?l.class+" "+e:e}e=""}function d(){if(!e)return;const p={type:"text",data:xx(e)};l?l.children.push(p):i.push(p),e=""}return t===1&&d(),i}function eU(n){return{tagName:O4[n],type:n,children:[]}}function xx(n){return n.replace(ZD,e=>KD[e]||"'")}function Gi(n,e,t){n.style.setProperty(`--${e}`,t+"")}function fo(n,e,t=!0){n.setAttribute(`data-${e}`,t===!0?"":t+"")}function Ff(n,e){n.setAttribute("part",e)}function tU(n){return parseFloat(getComputedStyle(n).lineHeight)||0}function nU(n){const e=document.createElement("template");return e.innerHTML=vm(n),{cue:n,content:e.content}}function vm(n,e=0){return Hv(D4(n),e)}function Hv(n,e=0){let t,i="";for(const r of n)if(r.type==="text")i+=r.data;else{const l=r.type==="timestamp";t={},t.class=r.class,t.title=r.type==="v"&&r.voice,t.lang=r.type==="lang"&&r.lang,t.part=r.type==="v"&&"voice",l&&(t.part="timed",t["data-time"]=r.time,t["data-future"]=r.time>e,t["data-past"]=r.time<e),t.style=`${r.color?`color: ${r.color};`:""}${r.bgColor?`background-color: ${r.bgColor};`:""}`;const u=Object.entries(t).filter(h=>h[1]).map(h=>`${h[0]}="${h[1]===!0?"":h[1]}"`).join(" ");i+=`<${r.tagName}${u?" "+u:""}>${Hv(r.children)}</${r.tagName}>`}return i}function Vv(n,e){for(const t of n.querySelectorAll('[part="timed"]')){const i=Number(t.getAttribute("data-time"));Number.isNaN(i)||(i>e?fo(t,"future"):t.removeAttribute("data-future"),i<e?fo(t,"past"):t.removeAttribute("data-past"))}}function iU(n,e){let t=null,i;function r(){l(),n(...i),i=void 0}function l(){clearTimeout(t),t=null}function u(){i=[].slice.call(arguments),l(),t=setTimeout(r,e)}return u}const vo=Symbol(0);function Gv(n){return n instanceof HTMLElement?{top:n.offsetTop,width:n.clientWidth,height:n.clientHeight,left:n.offsetLeft,right:n.offsetLeft+n.clientWidth,bottom:n.offsetTop+n.clientHeight}:{...n}}function _p(n,e,t){switch(e){case"+x":n.left+=t,n.right+=t;break;case"-x":n.left-=t,n.right-=t;break;case"+y":n.top+=t,n.bottom+=t;break;case"-y":n.top-=t,n.bottom-=t;break}}function sU(n,e){return n.left<=e.right&&n.right>=e.left&&n.top<=e.bottom&&n.bottom>=e.top}function rU(n,e){for(let t=0;t<e.length;t++)if(sU(n,e[t]))return e[t];return null}function FS(n,e){return e.top>=0&&e.bottom<=n.height&&e.left>=0&&e.right<=n.width}function aU(n,e,t){switch(t){case"+x":return e.left<0;case"-x":return e.right>n.width;case"+y":return e.top<0;case"-y":return e.bottom>n.height}}function oU(n,e){const t=Math.max(0,Math.min(n.width,e.right)-Math.max(0,e.left)),i=Math.max(0,Math.min(n.height,e.bottom)-Math.max(0,e.top));return t*i/(n.height*n.width)}function qv(n,e){return{top:e.top/n.height,left:e.left/n.width,right:(n.width-e.right)/n.width,bottom:(n.height-e.bottom)/n.height}}function U4(n,e){return e.top=e.top*n.height,e.left=e.left*n.width,e.right=n.width-e.right*n.width,e.bottom=n.height-e.bottom*n.height,e}const I4=["top","left","right","bottom"];function z4(n,e,t,i){const r=qv(e,t);for(const l of I4)Gi(n,`${i}-${l}`,r[l]*100+"%")}function $4(n,e,t,i){let r=1,l,u={...e};for(let h=0;h<i.length;h++){for(;aU(n,e,i[h])||FS(n,e)&&rU(e,t);)_p(e,i[h],1);if(FS(n,e))return e;const d=oU(n,e);r>d&&(l={...e},r=d),e={...u}}return l||u}const kd=Symbol(0);function lU(n,e,t,i){let r=t.firstElementChild,l=dU(e),u,h=[];if(t[vo]||(t[vo]=cU(n,t)),u=U4(n,{...t[vo]}),t[kd])h=[t[kd]==="top"?"+y":"-y","+x","-x"];else if(e.snapToLines){let d;switch(e.vertical){case"":h=["+y","-y"],d="height";break;case"rl":h=["+x","-x"],d="width";break;case"lr":h=["-x","+x"],d="width";break}let p=tU(r),m=p*Math.round(l),g=n[d]+p,b=h[0];Math.abs(m)>g&&(m=m<0?-1:1,m*=Math.ceil(g/p)*p),l<0&&(m+=e.vertical===""?n.height:n.width,h=h.reverse()),_p(u,b,m)}else{const d=e.vertical==="",p=d?"+y":"+x",m=d?u.height:u.width;_p(u,p,(d?n.height:n.width)*l/100),_p(u,p,e.lineAlign==="center"?m/2:e.lineAlign==="end"?m:0),h=d?["-y","+y","-x","+x"]:["-x","+x","-y","+y"]}return u=$4(n,u,i,h),z4(t,n,u,"cue"),u}function cU(n,e){const t=Gv(e),i=uU(e);if(e[kd]=!1,i.top&&(t.top=i.top,t.bottom=i.top+t.height,e[kd]="top"),i.bottom){const r=n.height-i.bottom;t.top=r-t.height,t.bottom=r,e[kd]="bottom"}return i.left&&(t.left=i.left),i.right&&(t.right=n.width-i.right),qv(n,t)}function uU(n){const e={};for(const t of I4)e[t]=parseFloat(n.style.getPropertyValue(`--cue-${t}`));return e}function dU(n){return n.line==="auto"?n.snapToLines?-1:100:n.line}function hU(n){if(n.position==="auto")switch(n.align){case"start":case"left":return 0;case"right":case"end":return 100;default:return 50}return n.position}function fU(n,e){if(n.positionAlign==="auto")switch(n.align){case"start":return e==="ltr"?"line-left":"line-right";case"end":return e==="ltr"?"line-right":"line-left";case"center":return"center";default:return`line-${n.align}`}return n.positionAlign}const pU=["-y","+y","-x","+x"];function mU(n,e,t,i){let r=Array.from(t.querySelectorAll('[part="cue-display"]')),l=0,u=Math.max(0,r.length-e.lines);for(let d=r.length-1;d>=u;d--)l+=r[d].offsetHeight;Gi(t,"region-height",l+"px"),t[vo]||(t[vo]=qv(n,Gv(t)));let h={...t[vo]};return h=U4(n,h),h.width=t.clientWidth,h.height=l,h.right=h.left+h.width,h.bottom=h.top+l,h=$4(n,h,i,pU),z4(t,n,h,"region"),h}class F4{overlay;z;A=0;C="ltr";B=[];D=!1;E;h=new Map;j=new Map;get dir(){return this.C}set dir(e){this.C=e,fo(this.overlay,"dir",e)}get currentTime(){return this.A}set currentTime(e){this.A=e,this.update()}constructor(e,t){this.overlay=e,this.dir=t?.dir??"ltr",e.setAttribute("translate","yes"),e.setAttribute("aria-live","off"),e.setAttribute("aria-atomic","true"),Ff(e,"captions"),this.G(),this.E=new ResizeObserver(this.I.bind(this)),this.E.observe(e)}changeTrack({regions:e,cues:t}){this.reset(),this.J(e);for(const i of t)this.j.set(i,null);this.update()}addCue(e){this.j.set(e,null),this.update()}removeCue(e){this.j.delete(e),this.update()}update(e=!1){this.H(e)}reset(){this.j.clear(),this.h.clear(),this.B=[],this.overlay.textContent=""}destroy(){this.reset(),this.E.disconnect()}I(){this.D=!0,this.K()}K=iU(()=>{this.D=!1,this.G();for(const e of this.h.values())e[vo]=null;for(const e of this.j.values())e&&(e[vo]=null);this.H(!0)},50);G(){this.z=Gv(this.overlay),Gi(this.overlay,"overlay-width",this.z.width+"px"),Gi(this.overlay,"overlay-height",this.z.height+"px")}H(e=!1){if(!this.j.size||this.D)return;let t,i=[...this.j.keys()].filter(l=>this.A>=l.startTime&&this.A<=l.endTime).sort((l,u)=>l.startTime!==u.startTime?l.startTime-u.startTime:l.endTime-u.endTime),r=i.map(l=>l.region);for(let l=0;l<this.B.length;l++){if(t=this.B[l],i[l]===t)continue;if(t.region&&!r.includes(t.region)){const h=this.h.get(t.region.id);h&&(h.removeAttribute("data-active"),e=!0)}const u=this.j.get(t);u&&(u.remove(),e=!0)}for(let l=0;l<i.length;l++){t=i[l];let u=this.j.get(t);u||this.j.set(t,u=this.L(t));const h=this.F(t)&&this.h.get(t.region.id);h&&!h.hasAttribute("data-active")&&(requestAnimationFrame(()=>fo(h,"active")),e=!0),u.isConnected||((h||this.overlay).append(u),e=!0)}if(e){const l=[],u=new Set;for(let h=i.length-1;h>=0;h--){if(t=i[h],u.has(t.region||t))continue;const d=this.F(t),p=d?this.h.get(t.region.id):this.j.get(t);d?l.push(mU(this.z,t.region,p,l)):l.push(lU(this.z,t,p,l)),u.add(d?t.region:t)}}Vv(this.overlay,this.A),this.B=i}J(e){if(e)for(const t of e){const i=this.M(t);this.h.set(t.id,i),this.overlay.append(i)}}M(e){const t=document.createElement("div");return Ff(t,"region"),fo(t,"id",e.id),fo(t,"scroll",e.scroll),Gi(t,"region-width",e.width+"%"),Gi(t,"region-anchor-x",e.regionAnchorX),Gi(t,"region-anchor-y",e.regionAnchorY),Gi(t,"region-viewport-anchor-x",e.viewportAnchorX),Gi(t,"region-viewport-anchor-y",e.viewportAnchorY),Gi(t,"region-lines",e.lines),t}L(e){const t=document.createElement("div"),i=hU(e),r=fU(e,this.C);if(Ff(t,"cue-display"),e.vertical!==""&&fo(t,"vertical"),Gi(t,"cue-text-align",e.align),e.style)for(const u of Object.keys(e.style))t.style.setProperty(u,e.style[u]);if(this.F(e))Gi(t,"cue-offset",`${i-(r==="line-right"?100:r==="center"?50:0)}%`);else if(Gi(t,"cue-writing-mode",e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl"),!e.style?.["--cue-width"]){let u=i;r==="line-left"?u=100-i:r==="center"&&i<=50?u=i*2:r==="center"&&i>50&&(u=(100-i)*2);const h=e.size<u?e.size:u;e.vertical===""?Gi(t,"cue-width",h+"%"):Gi(t,"cue-height",h+"%")}const l=document.createElement("div");return Ff(l,"cue"),e.id&&fo(l,"id",e.id),l.innerHTML=vm(e),t.append(l),t}F(e){return e.region&&e.size===100&&e.vertical===""&&e.line==="auto"}}const q1=Object.freeze(Object.defineProperty({__proto__:null,CaptionsRenderer:F4,ParseError:ED,ParseErrorCode:SD,TextCue:AD,VTTCue:k4,VTTRegion:j4,createVTTCueTemplate:nU,parseByteStream:R4,parseResponse:MD,parseText:TD,parseTextStream:Bv,parseVTTTimestamp:Gd,renderVTTCueStr
69ing:vm,renderVTTTokensString:Hv,tokenizeVTTCue:D4,updateTimedVTTCueNodes:Vv},Symbol.toStringTag,{value:"Module"}));function As(n,e=2){return Number(n.toFixed(e))}function gU(n){return String(n).split(".")[1]?.length??0}function Wv(n,e,t){return Math.max(n,Math.min(t,e))}let W1=pn(!1);Rt(document,"pointerdown",()=>{W1.set(!1)}),Rt(document,"keydown",n=>{n.metaKey||n.altKey||n.ctrlKey||W1.set(!0)});class Co extends ls{Qe=pn(!1);onConnect(e){tt(()=>{if(!W1()){this.Qe.set(!1),Bf(e,!1),this.listen("pointerenter",this.Re.bind(this)),this.listen("pointerleave",this.Se.bind(this));return}const t=document.activeElement===e;this.Qe.set(t),Bf(e,t),this.listen("focus",this.Te.bind(this)),this.listen("blur",this.Ue.bind(this))})}focused(){return this.Qe()}Te(){this.Qe.set(!0),Bf(this.el,!0)}Ue(){this.Qe.set(!1),Bf(this.el,!1)}Re(){BS(this.el,!0)}Se(){BS(this.el,!1)}}function Bf(n,e){Xt(n,"data-focus",e),Xt(n,"data-hocus",e)}function BS(n,e){Xt(n,"data-hocus",e),Xt(n,"data-hover",e)}const X1=Jc();class xU extends Vn{static el=Yt({tagName:"media-tooltip",props:{position:"top center"}});onAttach(e){fm(X1)&&th(()=>{if(!e.isConnected)return;Br(X1).bb(e)}),this.setAttributes({position:this.$props.position})}}let bU=0;class Xv extends ls{constructor(e){super(e),Pa(X1,{bb:this.bb.bind(this)})}bb(e){const t=`media-tooltip-${++bU}`;Xt(this.el,"aria-describedby",t),Xt(e,"id",t),Xt(e,"role","tooltip"),this.el.removeAttribute("aria-label")}}var vU=Object.defineProperty,yU=Object.getOwnPropertyDescriptor,_U=(n,e,t,i)=>{for(var r=yU(e,t),l=n.length-1,u;l>=0;l--)(u=n[l])&&(r=u(e,t,r)||r);return r&&vU(e,t,r),r};const eu={disabled:!1,defaultPressed:!1,defaultAppearance:!1};class vl extends Vn{static el=Yt({tagName:"media-toggle-button",props:eu});cb=pn(!1);db;constructor(e){super(e),new Co(e),new Xv(e),this.db&&new _D(e,this.db)}get pressed(){return gt(this.cb)}onAttach(e){CS(this.cb)&&this.cb.set(this.$props.defaultPressed()),Ii(e,"tabindex","0"),Ii(e,"role","button");const{disabled:t,defaultAppearance:i}=this.$props;this.setAttributes({disabled:t,"default-appearance":i,"data-pressed":this.cb,"aria-pressed":this.eb.bind(this),"data-media-button":!0})}onConnect(e){Ic(e,this.fb.bind(this))}eb(){return xm(this.cb())}gb(e){CS(this.cb)&&this.cb.set(t=>!t)}fb(e){const t=this.$props.disabled();if(t){t&&e.stopImmediatePropagation();return}e.preventDefault(),this.gb(e)}}_U([ki],vl.prototype,"pressed");var wU='<path d="M8.66667 6.66667C8.29848 6.66667 8 6.96514 8 7.33333V24.6667C8 25.0349 8.29848 25.3333 8.66667 25.3333H12.6667C13.0349 25.3333 13.3333 25.0349 13.3333 24.6667V7.33333C13.3333 6.96514 13.0349 6.66667 12.6667 6.66667H8.66667Z" fill="currentColor"/> <path d="M19.3333 6.66667C18.9651 6.66667 18.6667 6.96514 18.6667 7.33333V24.6667C18.6667 25.0349 18.9651 25.3333 19.3333 25.3333H23.3333C23.7015 25.3333 24 25.0349 24 24.6667V7.33333C24 6.96514 23.7015 6.66667 23.3333 6.66667H19.3333Z" fill="currentColor"/>',SU='<path d="M10.6667 6.6548C10.6667 6.10764 11.2894 5.79346 11.7295 6.11862L24.377 15.4634C24.7377 15.7298 24.7377 16.2692 24.3771 16.5357L11.7295 25.8813C11.2895 26.2065 10.6667 25.8923 10.6667 25.3451L10.6667 6.6548Z" fill="currentColor"/>',EU='<path d="M15.6038 12.2147C16.0439 12.5399 16.6667 12.2257 16.6667 11.6786V10.1789C16.6667 10.1001 16.7351 10.0384 16.8134 10.0479C20.1116 10.4494 22.6667 13.2593 22.6667 16.6659C22.6667 20.3481 19.6817 23.3332 15.9995 23.3332C12.542 23.3332 9.69927 20.7014 9.36509 17.332C9.32875 16.9655 9.03371 16.6662 8.66548 16.6662L6.66655 16.6666C6.29841 16.6666 5.99769 16.966 6.02187 17.3334C6.36494 22.5454 10.7012 26.6667 16 26.6667C21.5228 26.6667 26 22.1895 26 16.6667C26 11.4103 21.9444 7.10112 16.7916 6.69757C16.7216 6.69209 16.6667 6.63396 16.6667 6.56372V4.98824C16.6667 4.44106 16.0439 4.12689 15.6038 4.45206L11.0765 7.79738C10.7159 8.06387 10.7159 8.60326 11.0766 8.86973L15.6038 12.2147Z" fill="currentColor"/>';let CU=class extends vl{static el=Yt({tagName:"media-play-button",props:eu});j;db="togglePaused";onAttach(e){this.j=kn(),this.cb=this.hb.bind(this),super.onAttach(e),bl(e,this.ib.bind(this));const{paused:t,ended:i}=this.j.$store;this.setAttributes({"data-paused":t,"data-ended":i})}gb(e){const t=this.j.remote;this.cb()?t.pause(e):t.play(e)}hb(){const{paused:e}=this.j.$store;return!e()}ib(){const{paused:e}=this.j.$store;return e()?"Play":"Pause"}render(){return[xt(di,{paths:SU,slot:"play"}),xt(di,{paths:EU,slot:"replay"}),xt(di,{paths:wU,slot:"pause"})]}};var NU='<path d="M8 28.0003C8 27.6321 8.29848 27.3336 8.66667 27.3336H23.3333C23.7015 27.3336 24 27.
696321 24 28.0003V29.3336C24 29.7018 23.7015 30.0003 23.3333 30.0003H8.66667C8.29848 30.0003 8 29.7018 8 29.3336V28.0003Z" fill="currentColor"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M4.66602 6.66699C4.29783 6.66699 3.99935 6.96547 3.99935 7.33366V24.667C3.99935 25.0352 4.29783 25.3337 4.66602 25.3337H27.3327C27.7009 25.3337 27.9994 25.0352 27.9994 24.667V7.33366C27.9994 6.96547 27.7009 6.66699 27.3327 6.66699H4.66602ZM8.66659 21.3333C8.2984 21.3333 7.99992 21.0349 7.99992 20.6667V11.3333C7.99992 10.9651 8.2984 10.6667 8.66659 10.6667H13.9999C14.3681 10.6667 14.6666 10.9651 14.6666 11.3333V12.6667C14.6666 13.0349 14.3681 13.3333 13.9999 13.3333H10.7999C10.7263 13.3333 10.6666 13.393 10.6666 13.4667V18.5333C10.6666 18.607 10.7263 18.6667 10.7999 18.6667H13.9999C14.3681 18.6667 14.6666 18.9651 14.6666 19.3333V20.6667C14.6666 21.0349 14.3681 21.3333 13.9999 21.3333H8.66659ZM17.9999 21.3333C17.6317 21.3333 17.3333 21.0349 17.3333 20.6667V11.3333C17.3333 10.9651 17.6317 10.6667 17.9999 10.6667H23.3333C23.7014 10.6667 23.9999 10.9651 23.9999 11.3333V12.6667C23.9999 13.0349 23.7014 13.3333 23.3333 13.3333H20.1333C20.0596 13.3333 19.9999 13.393 19.9999 13.4667V18.5333C19.9999 18.607 20.0596 18.6667 20.1333 18.6667H23.3333C23.7014 18.6667 23.9999 18.9651 23.9999 19.3333V20.6667C23.9999 21.0349 23.7014 21.3333 23.3333 21.3333H17.9999Z" fill="currentColor"/>',B4='<path fill-rule="evenodd" clip-rule="evenodd" d="M4.6661 6.66699C4.29791 6.66699 3.99943 6.96547 3.99943 7.33366V24.667C3.99943 25.0352 4.29791 25.3337 4.6661 25.3337H27.3328C27.701 25.3337 27.9994 25.0352 27.9994 24.667V7.33366C27.9994 6.96547 27.701 6.66699 27.3328 6.66699H4.6661ZM8.66667 21.3333C8.29848 21.3333 8 21.0349 8 20.6667V11.3333C8 10.9651 8.29848 10.6667 8.66667 10.6667H14C14.3682 10.6667 14.6667 10.9651 14.6667 11.3333V12.6667C14.6667 13.0349 14.3682 13.3333 14 13.3333H10.8C10.7264 13.3333 10.6667 13.393 10.6667 13.4667V18.5333C10.6667 18.607 10.7264 18.6667 10.8 18.6667H14C14.3682 18.6667 14.6667 18.9651 14.6667 19.3333V20.6667C14.6667 21.0349 14.3682 21.3333 14 21.3333H8.66667ZM18 21.3333C17.6318 21.3333 17.3333 21.0349 17.3333 20.6667V11.3333C17.3333 10.9651 17.6318 10.6667 18 10.6667H23.3333C23.7015 10.6667 24 10.9651 24 11.3333V12.6667C24 13.0349 23.7015 13.3333 23.3333 13.3333H20.1333C20.0597 13.3333 20 13.393 20 13.4667V18.5333C20 18.607 20.0597 18.6667 20.1333 18.6667H23.3333C23.7015 18.6667 24 18.9651 24 19.3333V20.6667C24 21.0349 23.7015 21.3333 23.3333 21.3333H18Z" fill="currentColor"/>';function TU(n){return n?"true":"false"}function vr(n){return()=>TU(n())}let MU=class extends vl{static el=Yt({tagName:"media-caption-button",props:eu});j;db="toggleCaptions";onAttach(e){this.j=kn(),this.cb=this.hb.bind(this),super.onAttach(e),bl(e,this.ib.bind(this)),this.setAttributes({"aria-hidden":vr(this.jb.bind(this))})}gb(e){this.j.remote.toggleCaptions(e)}hb(){const{textTrack:e}=this.j.$store,t=e();return!!t&&Wi(t)}jb(){const{textTracks:e}=this.j.$store;return e().filter(Wi).length==0}ib(){const{textTrack:e}=this.j.$store;return e()?"Closed-Captions Off":"Closed-Captions On"}render(){return[xt(di,{paths:NU,slot:"on"}),xt(di,{paths:B4,slot:"off"})]}};var AU='<path d="M19.3334 13.3333C18.9652 13.3333 18.6667 13.0349 18.6667 12.6667L18.6667 7.33333C18.6667 6.96514 18.9652 6.66666 19.3334 6.66666H21.3334C21.7015 6.66666 22 6.96514 22 7.33333V9.86666C22 9.9403 22.0597 10 22.1334 10L24.6667 10C25.0349 10 25.3334 10.2985 25.3334 10.6667V12.6667C25.3334 13.0349 25.0349 13.3333 24.6667 13.3333L19.3334 13.3333Z" fill="currentColor"/> <path d="M13.3334 19.3333C13.3334 18.9651 13.0349 18.6667 12.6667 18.6667H7.33335C6.96516 18.6667 6.66669 18.9651 6.66669 19.3333V21.3333C6.66669 21.7015 6.96516 22 7.33335 22H9.86669C9.94032 22 10 22.0597 10 22.1333L10 24.6667C10 25.0349 10.2985 25.3333 10.6667 25.3333H12.6667C13.0349 25.3333 13.3334 25.0349 13.3334 24.6667L13.3334 19.3333Z" fill="currentColor"/> <path d="M18.6667 24.6667C18.6667 25.0349 18.9652 25.3333 19.3334 25.3333H21.3334C21.7015 25.3333 22 25.0349 22 24.6667V22.1333C22 22.0597 22.0597 22 22.1334 22H24.6667C25.0349 22 25.3334 21.7015 25.3334 21.3333V19.3333C25.3334 18.9651 25.0349 18.6667 24.6667 18.6667L19.3334 18.6667C18.9652 18.6667 18.6667 18.9651 18.6667 19.3333L18.6667 24.6667Z" fill="currentColor"/> <path d="M10.6667 13.3333H12.6667C13.0349 13.3333 13.3334 13.0349 13.3334 12.6667L13.3334 10.6667V7.33333C13.3334 6.96514 13.0349 6.66666 12.6667 6.66666H10.6667C10.2985 6.66666 10 6.96514 10 7.33333L10 9.86666C10 9.9403 9.94033 10 9.86669 10L7.33335 10C6.96516 10 6.66669 10.2985 6.66669 10.6667V12.6667C6.66669 13.0349 6.96516 13.3333 7.33335 13.3333L10.
696667 13.3333Z" fill="currentColor"/>',RU='<path d="M25.3299 7.26517C25.2958 6.929 25.0119 6.66666 24.6667 6.66666H19.3334C18.9652 6.66666 18.6667 6.96514 18.6667 7.33333V9.33333C18.6667 9.70152 18.9652 10 19.3334 10L21.8667 10C21.9403 10 22 10.0597 22 10.1333V12.6667C22 13.0349 22.2985 13.3333 22.6667 13.3333H24.6667C25.0349 13.3333 25.3334 13.0349 25.3334 12.6667V7.33333C25.3334 7.31032 25.3322 7.28758 25.3299 7.26517Z" fill="currentColor"/> <path d="M22 21.8667C22 21.9403 21.9403 22 21.8667 22L19.3334 22C18.9652 22 18.6667 22.2985 18.6667 22.6667V24.6667C18.6667 25.0349 18.9652 25.3333 19.3334 25.3333L24.6667 25.3333C25.0349 25.3333 25.3334 25.0349 25.3334 24.6667V19.3333C25.3334 18.9651 25.0349 18.6667 24.6667 18.6667H22.6667C22.2985 18.6667 22 18.9651 22 19.3333V21.8667Z" fill="currentColor"/> <path d="M12.6667 22H10.1334C10.0597 22 10 21.9403 10 21.8667V19.3333C10 18.9651 9.70154 18.6667 9.33335 18.6667H7.33335C6.96516 18.6667 6.66669 18.9651 6.66669 19.3333V24.6667C6.66669 25.0349 6.96516 25.3333 7.33335 25.3333H12.6667C13.0349 25.3333 13.3334 25.0349 13.3334 24.6667V22.6667C13.3334 22.2985 13.0349 22 12.6667 22Z" fill="currentColor"/> <path d="M10 12.6667V10.1333C10 10.0597 10.0597 10 10.1334 10L12.6667 10C13.0349 10 13.3334 9.70152 13.3334 9.33333V7.33333C13.3334 6.96514 13.0349 6.66666 12.6667 6.66666H7.33335C6.96516 6.66666 6.66669 6.96514 6.66669 7.33333V12.6667C6.66669 13.0349 6.96516 13.3333 7.33335 13.3333H9.33335C9.70154 13.3333 10 13.0349 10 12.6667Z" fill="currentColor"/>';let kU=class extends vl{static el=Yt({tagName:"media-fullscreen-button",props:{...eu,target:"prefer-media"}});j;db="toggleFullscreen";onAttach(e){this.j=kn(),this.cb=this.hb.bind(this),super.onAttach(e),bl(e,this.ib.bind(this));const{fullscreen:t}=this.j.$store;this.setAttributes({"aria-hidden":vr(this.jb.bind(this)),"data-fullscreen":t})}gb(e){const t=this.j.remote,i=this.$props.target();this.cb()?t.exitFullscreen(i,e):t.enterFullscreen(i,e)}hb(){const{fullscreen:e}=this.j.$store;return e()}jb(){const{canFullscreen:e}=this.j.$store;return!e()}ib(){const{fullscreen:e}=this.j.$store;return e()?"Exit Fullscreen":"Enter Fullscreen"}render(){return[xt(di,{paths:RU,slot:"enter"}),xt(di,{paths:AU,slot:"exit"})]}};var jU='<path d="M17.5091 24.6594C17.5091 25.2066 16.8864 25.5208 16.4463 25.1956L9.44847 20.0252C9.42553 20.0083 9.39776 19.9991 9.36923 19.9991H4.66667C4.29848 19.9991 4 19.7006 4 19.3325V12.6658C4 12.2976 4.29848 11.9991 4.66667 11.9991H9.37115C9.39967 11.9991 9.42745 11.99 9.45039 11.973L16.4463 6.8036C16.8863 6.47842 17.5091 6.79259 17.5091 7.33977L17.5091 24.6594Z" fill="currentColor"/> <path d="M28.8621 13.6422C29.1225 13.3818 29.1225 12.9597 28.8621 12.6994L27.9193 11.7566C27.659 11.4962 27.2368 11.4962 26.9765 11.7566L24.7134 14.0197C24.6613 14.0717 24.5769 14.0717 24.5248 14.0197L22.262 11.7568C22.0016 11.4964 21.5795 11.4964 21.3191 11.7568L20.3763 12.6996C20.116 12.9599 20.116 13.382 20.3763 13.6424L22.6392 15.9053C22.6913 15.9573 22.6913 16.0418 22.6392 16.0938L20.3768 18.3562C20.1165 18.6166 20.1165 19.0387 20.3768 19.299L21.3196 20.2419C21.58 20.5022 22.0021 20.5022 22.2624 20.2418L24.5248 17.9795C24.5769 17.9274 24.6613 17.9274 24.7134 17.9795L26.976 20.2421C27.2363 20.5024 27.6585 20.5024 27.9188 20.2421L28.8616 19.2992C29.122 19.0389 29.122 18.6168 28.8616 18.3564L26.599 16.0938C26.547 16.0418 26.547 15.9573 26.599 15.9053L28.8621 13.6422Z" fill="currentColor"/>',LU='<path d="M17.5091 24.6595C17.5091 25.2066 16.8864 25.5208 16.4463 25.1956L9.44847 20.0252C9.42553 20.0083 9.39776 19.9992 9.36923 19.9992H4.66667C4.29848 19.9992 4 19.7007 4 19.3325V12.6658C4 12.2976 4.29848 11.9992 4.66667 11.9992H9.37115C9.39967 11.9992 9.42745 11.99 9.45039 11.9731L16.4463 6.80363C16.8863 6.47845 17.5091 6.79262 17.5091 7.3398L17.5091 24.6595Z" fill="currentColor"/> <path d="M27.5091 9.33336C27.8773 9.33336 28.1758 9.63184 28.1758 10V22C28.1758 22.3682 27.8773 22.6667 27.5091 22.6667H26.1758C25.8076 22.6667 25.5091 22.3682 25.5091 22V10C25.5091 9.63184 25.8076 9.33336 26.1758 9.33336L27.5091 9.33336Z" fill="currentColor"/> <path d="M22.1758 12C22.544 12 22.8424 12.2985 22.8424 12.6667V19.3334C22.8424 19.7016 22.544 20 22.1758 20H20.8424C20.4743 20 20.1758 19.7016 20.1758 19.3334V12.6667C20.1758 12.2985 20.4743 12 20.8424 12H22.1758Z" fill="currentColor"/>',PU='<path d="M17.5091 24.6594C17.5091 25.2066 16.8864 25.5207 16.4463 25.1956L9.44847 20.0252C9.42553 20.0083 9.39776 19.9991 9.36923 19.9991H4.66667C4.29848 19.9991 4 19.7006 4 19.3324V12.6658C4 12.2976 4.29848 11.9991 4.66667 11.9991H9.37115C9.39967 11.9991 9.42745 11.99 9.45039 11.973L16.4463 6.80358C16.8863 6.4784 17.5091 6.79258 17.5091 7.33975L17.5091 24.6594Z" fill="currentColor"/> <path d="M22.8424 12.6667C22.8424 12.2985 22.544 12 22.1758 12H20.8424C20.4743 12 20.1758 12.2985 20.1758 12.6667V19.3333C20.1758 19.7015 20.4743 20 20.8424 20H22.1758C22.544 20 22.8424 19.7015 22.8424 19.3333V12.6667Z" fill="currentColor"/>';let OU=class extends vl{static el=Yt({tagName:"media-mute-button",props:eu});j;db="toggleMuted";onAttach(e){this.j=kn(),this.cb=this.hb.bind(this),bl(e,this.ib.bind(this)),this.setAttributes({"data-muted":this.cb,"data-volume":this.kb.bind(this)}),super.onAttach(e)}gb(e){const t=this.j.remote;this.cb()?t.unmute(e):t.mute(e)}hb(){const{muted:e,volume:t}=this.j.$store;return e()||t()===0}ib(){return this.cb()?"Unmute":"Mute"}kb(){const{muted:e,volume:t}=this.j.$store,i=t();if(e()||i===0)return"muted";if(i>=.5)return"high";if(i<.5)return"low"}render(){return[xt(di,{paths:LU,slot:"volume-high"}),xt(di,{paths:PU,slot:"volume-low"}),xt(di,{paths:jU,slot:"volume-muted"})]}};var DU='<path d="M5.33334 26V19.4667C5.33334 19.393 5.39304 19.3333 5.46668 19.3333H7.86668C7.94031 19.3333 8.00001 19.393 8.00001 19.4667V23.3333C8.00001 23.7015 8.29849 24 8.66668 24H23.3333C23.7015 24 24 23.7015 24 23.3333V8.66666C24 8.29847 23.7015 7.99999 23.3333 7.99999H19.4667C19.393 7.99999 19.3333 7.9403 19.3333 7.86666V5.46666C19.3333 5.39302 19.393 5.33333 19.4667 5.33333H26C26.3682 5.33333 26.6667 5.63181 26.6667 5.99999V26C26.6667 26.3682 26.3682 26.6667 26 26.6667H6.00001C5.63182 26.6667 5.33334 26.3682 5.33334 26Z" fill="currentColor"/> <path d="M14.0098 8.42359H10.806C10.6872 8.42359 10.6277 8.56721 10.7117 8.6512L16.5491 14.4886C16.8094 14.7489 16.8094 15.171 16.5491 15.4314L15.3234 16.657C15.0631 16.9174 14.641 16.9174 14.3806 16.657L8.63739 10.9138C8.55339 10.8298 8.40978 10.8893 8.40978 11.0081V14.0236C8.40978 14.3918 8.1113 14.6903 7.74311 14.6903H6.00978C5.64159 14.6903 5.34311 14.3918 5.34311 14.0236L5.34311 6.02359C5.34311 5.6554 5.64159 5.35692 6.00978 5.35692L14.0098 5.35692C14.378 5.35692 14.6764 5.6554 14.6764 6.02359V7.75692C14.6764 8.12511 14.378 8.42359 14.0098 8.42359Z" fill="currentColor"/>',UU='<path d="M16 15.3333C15.6318 15.3333 15.3333 15.6318 15.3333 16V20C15.3333 20.3682 15.6318 20.6667 16 20.6667H21.3333C21.7015 20.6667 22 20.3682 22 20V16C22
6915.6318 21.7015 15.3333 21.3333 15.3333H16Z" fill="currentColor"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M5.33333 7.33334C5.33333 6.96515 5.63181 6.66667 5.99999 6.66667H26C26.3682 6.66667 26.6667 6.96515 26.6667 7.33334V24.6667C26.6667 25.0349 26.3682 25.3333 26 25.3333H5.99999C5.63181 25.3333 5.33333 25.0349 5.33333 24.6667V7.33334ZM7.99999 10C7.99999 9.63182 8.29847 9.33334 8.66666 9.33334H23.3333C23.7015 9.33334 24 9.63182 24 10V22C24 22.3682 23.7015 22.6667 23.3333 22.6667H8.66666C8.29847 22.6667 7.99999 22.3682 7.99999 22V10Z" fill="currentColor"/>';class IU extends vl{static el=Yt({tagName:"media-pip-button",props:eu});j;db="togglePictureInPicture";onAttach(e){this.j=kn(),this.cb=this.hb.bind(this),super.onAttach(e),bl(e,this.ib.bind(this));const{pictureInPicture:t}=this.j.$store;this.setAttributes({"aria-hidden":vr(this.jb.bind(this)),"data-pip":t})}gb(e){const t=this.j.remote;this.cb()?t.exitPictureInPicture(e):t.enterPictureInPicture(e)}hb(){const{pictureInPicture:e}=this.j.$store;return e()}jb(){const{canPictureInPicture:e}=this.j.$store;return!e()}ib(){const{pictureInPicture:e}=this.j.$store;return e()?"Exit Picture In Picture":"Enter Picture In Picture"}render(){return[xt(di,{paths:UU,slot:"enter"}),xt(di,{paths:DU,slot:"exit"})]}}var zU='<path d="M15.6038 12.2148C16.0439 12.5399 16.6667 12.2257 16.6667 11.6786V10.1789C16.6667 10.1001 16.7351 10.0384 16.8134 10.0479C20.1116 10.4494 22.6667 13.2593 22.6667 16.6659C22.6667 20.3481 19.6817 23.3332 15.9995 23.3332C12.542 23.3332 9.69927 20.7015 9.36509 17.332C9.32875 16.9655 9.03371 16.6662 8.66548 16.6662L6.66655 16.6666C6.29841 16.6666 5.99769 16.966 6.02187 17.3334C6.36494 22.5454 10.7012 26.6667 16 26.6667C21.5228 26.6667 26 22.1895 26 16.6667C26 11.4103 21.9444 7.10112 16.7916 6.69758C16.7216 6.69209 16.6667 6.63396 16.6667 6.56372V4.98824C16.6667 4.44106 16.0439 4.12689 15.6038 4.45207L11.0765 7.79738C10.7159 8.06387 10.7159 8.60327 11.0766 8.86974L15.6038 12.2148Z" fill="currentColor"/>',$U='<path d="M16.4167 12.2148C15.9766 12.5399 15.3538 12.2257 15.3538 11.6786V10.1789C15.3538 10.1001 15.2854 10.0384 15.2072 10.0479C11.9089 10.4494 9.35384 13.2593 9.35384 16.6659C9.35384 20.3481 12.3389 23.3332 16.0211 23.3332C19.4785 23.3332 22.3212 20.7015 22.6554 17.332C22.6918 16.9655 22.9868 16.6662 23.355 16.6662L25.354 16.6666C25.7221 16.6666 26.0228 16.966 25.9986 17.3334C25.6556 22.5454 21.3193 26.6667 16.0205 26.6667C10.4977 26.6667 6.02051 22.1895 6.02051 16.6667C6.02051 11.4103 10.0761 7.10112 15.2289 6.69758C15.2989 6.69209 15.3538 6.63396 15.3538 6.56372V4.98824C15.3538 4.44106 15.9766 4.12689 16.4167 4.45207L20.944 7.79738C21.3046 8.06387 21.3046 8.60327 20.9439 8.86974L16.4167 12.2148Z" fill="currentColor"/>';let FU=class extends Vn{static el=Yt({tagName:"media-seek-button",props:{disabled:!1,defaultAppearance:!1,seconds:30}});j;constructor(e){super(e),this.j=kn(),new Co(e),new Xv(e)}onAttach(e){Ii(e,"tabindex","0"),Ii(e,"role","button"),bl(e,this.ib.bind(this));const{seconds:t,defaultAppearance:i}=this.$props;this.setAttributes({seconds:t,"default-appearance":i,"aria-hidden":vr(this.jb.bind(this)),"data-media-button":!0})}onConnect(e){Ic(e,this.gb.bind(this))}jb(){const{canSeek:e}=this.j.$store;return!e()}ib(){const{seconds:e}=this.$props;return`Seek ${e()>0?"forward":"backward"} ${e()} seconds`}gb(e){const{seconds:t,disabled:i}=this.$props;if(i())return;const{currentTime:r}=this.j.$store,l=r()+t();this.j.remote.seek(l,e)}render(){return[xt(di,{paths:zU,slot:"backward"}),xt(di,{paths:$U,slot:"forward"})]}};const tu=new Y5({min:0,max:100,value:50,pointerValue:0,focused:!1,dragging:!1,pointing:!1,get interactive(){return this.dragging||this.focused||this.pointing},get fillRate(){return HS(this.min,this.max,this.value)},get fillPercent(){return this.fillRate*100},get pointerRate(){return HS(this.min,this.max,this.pointerValue)},get pointerPercent(){return this.pointerRate*100}});function HS(n,e,t){const i=e-n,r=t-n;return i>0?r/i:0}const Yv={min:0,max:100,disabled:!1,value:100,step:1,keyStep:1,shiftKeyMultiplier:5,trackClass:null,trackFillClass:null,trackProgressClass:null,thumbContainerClass:null,thumbClass:null};function BU(n,e,t,i){return Wv(n,As(t,gU(i)),e)}function HU(n,e,t,i){const r=Wv(0,t,1),l=e-n,u=l*r,h=u/i,d=i*h;return n+d}const VS={Left:-1,ArrowLeft:-1,Up:1,ArrowUp:1,Right:1,ArrowRight:1,Down:-1,ArrowDown:-1};class VU extends ls{constructor(e,t,i){super(e),this.jg=t,this.j=i}onConnect(){tt(this.vg.bind(this)),tt(this.wg.bind(this)),this.jg.tc&&th(()=>{const e=this.j.player?.querySelector("media-outlet");e&&(this.Id=e,Rt(e,"touchstart",this.xg.bind(this)),Rt(e,"touchmove",this.yg.bind(this)))})}Id=null;lg=null;ng=null;xg(e){this.lg=e.touches[0].clientX}yg(e){if(xl(this.lg)||(e.preventDefault(),this.$store.dragging()))return;const t=e.touches[0].clientX-this.lg;Math.abs(t)>20&&(this.lg=e.touches[0].clientX,this.ng=this.$store.value(),this.qg(this.ng,e))}vg(){this.jg.mb()||(this.listen("focus",this.Te.bind(this)),this.listen("pointerenter",this.Re.bind(this)),this.listen("pointermove",this.zg.bind(this)),this.listen("pointerleave",this.Se.bind(this)),this.listen("pointerdown",this.Ag.bind(this)),this.listen("keydown",this.Za.bind(this)),this.listen("keyup",this.Ya.bind(this)))}wg(){this.jg.mb()||!this.$store.dragging()||(Rt(document,"pointerup",this.Bg.bind(this)),Rt(document,"pointermove",this.Cg.bind(this)),w4&&Rt(document,"touchmove",this.Dg.bind(this),{passive:!1}))}Te(){this.kg(this.$store.value())}rg(e,t){const{value:i,min:r,max:l,dragging:u}=this.$store,h=Math.max(r(),Math.min(e,l()));i.set(h);const d=this.createEvent("value-change",{detail:h,trigger:t});if(this.el.dispatchEvent(d),this.jg.Hb(d),u()){const p=this.createEvent("drag-value-change",{detail:h,trigger:t});this.el.dispatchEvent(p),this.jg.Kb(p)}}kg(e,t){const{pointerValue:i,dragging:r}=this.$store;if(i.set(e),this.dispatch("pointer-value-change",{detail:e,trigger:t}),r()){const l=this.jg.nb==="vertical"?"bottom":"left",u=this.jg.nb==="vertical"?"height":"width";this.og&&!this.el?.hasAttribute("data-chapters")&&(this.og.style[u]=e+"%"),this.mg&&(this.mg.style[l]=e+"%"),this.rg(e,t)}}pg(e){let t,i=this.el.getBoundingClientRect(),{min:r,max:l}=this.$store;if(this.jg.nb==="vertical"){const{bottom:u,height:h}=i;t=(u-e.clientY)/h}else if(this.lg&&Dc(this.ng)){const{width:u}=this.Id.getBoundingClientRect(),h=(e.clientX-this.lg)/u,d=l()-r(),p=d*Math.abs(h);t=(h<0?this.ng-p:this.ng+p)/d}else{const{left:u,width:h}=i;t=(e.clientX-u)/h}return Math.max(r(),Math.min(l(),this.jg.Gb(HU(r(),l(),t,this.jg.vb()))))}Re(e){this.$store.pointing.set(!0)}zg(e){const{dragging:t}=this.$store;t()||this.kg(this.pg(e),e)}Se(e){this.$store.pointing.set(!1)}Ag(e){if(e.button!==0)return;const t=this.pg(e);this.qg(t,e),this.kg(t,e)}mg=null;og=null;qg(e,t){const{dragging:i}=this.$store;if(i())return;i.set(!0),this.mg=this.el.querySelector('shadow-root > div[part="thumb-container"]'),this.og=this.el.querySelector('shadow-root > div[part~="track-fill"]'),this.j.remote.pauseUserIdle(t);const r=this.createEvent("drag-start",{detail:e,trigger:t});this.el.dispatchEvent(r),this.jg.Ib(r)}tg(e,t){const{dragging:i}=this.$store;if(!i())return;i.set(!1),this.og&&(Ms(this.og,"width",null),this.og=null),this.mg&&(Ms(this.mg,"left",null),Ms(this.mg,"bottom",null),this.mg=null),this.j.remote.resumeUserIdle(t);const r=this.createEvent("drag-end",{detail:e,trigger:t});this.el.dispatchEvent(r),this.jg.Jb(r),this.lg=null,this.ng=null}sg;Za(e){if(D1(e)){const d=e.trigger;if(wa(d))e=d;else return}const{key:t}=e,{min:i,max:r}=this.$store;let l;if(t==="Home"||t==="PageUp"?l=i():t==="End"||t==="PageDown"?l=r():!e.metaKey&&/[0-9]/.test(t)&&(l=(r()-i())/10*Number(t)),!Xs(l)){this.kg(l,e),this.rg(l,e);return}const u=this.ug(e);if(!u)return;const h=t===this.sg;!this.$store.dragging()&&h&&this.qg(u,e),this.kg(u,e),h||this.rg(u,e),this.sg=t}Ya(e){if(D1(e)){const l=e.trigger;if(wa(l))e=l;else return}this.sg="";const{dragging:t,value:i}=this.$store;if(!t())return;const r=this.ug(e)??i();this.kg(r),this.tg(r,e)}ug(e){const{key:t,shiftKey:i}=e;if(!Object.keys(VS).includes(t))return;const{shiftKeyMultiplier:l}=this.$props,{value:u}=this.$store,h=this.jg.vb(),d=this.jg.Fb(),p=i?d*l():d,m=Number(VS[t]),g=p*m,b=(u()+g)/h;return Number((h*b).toFixed(3))}Bg(e){if(e.button!==0)return;const t=this.pg(e);this.kg(t,e),this.tg(t,e)}Dg(e){e.preventDefault()}Cg=bm(e=>{this.kg(this.pg(e),e)},20,{leading:!0})}const Kv=Jc(()=>({})),GU=zt('<!$><div part="track"></div>'),qU=zt('<!$><div part="track track-fill"></div>'),WU=zt('<!$><div part="track track-progress"></div>'),XU=zt('<!$><div part="thumb-container"><!$><div part="thumb"></div></div>');class Zv extends Vn{static el=Yt({tagName:"media-slider",props:Yv,store:tu});j;pb=!1;nb="";constructor(e){super(e),Pa(Kv),this.j=kn(),new VU(e,this,this.j);const t=new Co(e);this.$store.focused=t.focused.bind(t)}onAttach(e){Ii(e,"role","slider"),Ii(e,"tabindex","0"),Ii(e,"aria-orientation","horizontal"),Ii(e,"autocomplete","off"),this.nb=e.getAttribute("aria-orientation")||"",this.pb||(tt(this.qb.bind(this)),tt(this.rb.bind(this))),tt(this.sb.bind(this)),this.tb()}onConnect(e){this.ub()}render(){const{trackClass:e,trackFillClass:t,trackProgressClass:i,thumbContainerClass:r,thumbClass:l}=this.$props;return[(()=>{const[u,h]=An(GU);return ci(()=>ln(u,"class",e())),u})(),(()=>{const[u,h]=An(qU);return ci(()=>ln(u,"class",t())),u})(),(()=>{const[u,h]=An(WU);return ci(()=>ln(u,"class",i())),u})(),(()=>{const[u,h]=An(XU),d=u4(h);return ci(()=>ln(u,"class",r())),ci(()=>ln(d,"class",l())),u})()]}vb(){return this.$props.step()}Fb(){return this.$props.keyStep()}Gb(e){return Math.round(e)}mb(){return this.$props.disabled()}qb(){const{min:e,max:t}=this.$props;this.$store.min.set(e()),this.$store.max.set(t())}
69rb(){if(!this.mb())return;const{dragging:e,pointing:t}=this.$store;e.set(!1),t.set(!1)}sb(){const{dragging:e,value:t,min:i,max:r}=this.$store;gt(e)||t.set(BU(i(),r(),t(),this.vb()))}wb(){return xm(this.mb())}xb(){return this.$props.min()}yb(){return this.$props.max()}zb(){const{value:e}=this.$store;return Math.round(e())}Ab(){const{value:e,max:t}=this.$store;return As(e()/t()*100,2)+"%"}tb(){const{disabled:e}=this.$props,{dragging:t,interactive:i,pointing:r}=this.$store;this.setAttributes({disabled:e,"data-dragging":t,"data-pointing":r,"data-interactive":i,"aria-disabled":this.wb.bind(this),"aria-valuemin":this.xb.bind(this),"aria-valuemax":this.yb.bind(this),"aria-valuenow":this.zb.bind(this),"aria-valuetext":this.Ab.bind(this),"data-styled":this.Bb.bind(this),"data-media-slider":!0}),tt(this.Cb.bind(this))}Bb(){return!!this.$props.trackClass()}Cb(){const{fillPercent:e,pointerPercent:t}=this.$store;this.Db(As(e(),3),As(t(),3))}Db=hl((e,t)=>{this.el?.style.setProperty("--slider-fill-percent",e+"%"),this.el?.style.setProperty("--slider-pointer-percent",t+"%")});lb=null;ub(){this.lb=this.el.querySelector('[slot="preview"]'),this.lb&&(tt(this.Eb.bind(this)),Promise.resolve().then(function(){return iz}).then(({setupPreviewStyles:e})=>{e(this.lb,this.nb)}))}Eb(){if(this.mb()||!this.lb)return;window.requestAnimationFrame(this.ob);const e=new ResizeObserver(this.ob);return e.observe(this.lb),()=>e.disconnect()}ob=hl(()=>{if(!this.lb)return;const e=this.lb.getBoundingClientRect();Ms(this.lb,"--computed-width",e.width+"px"),Ms(this.lb,"--computed-height",e.height+"px")});Hb(e){}Ib(e){}Jb(e){}Kb(e){}}const YU=zt('<!$><img part="img" loading="eager" decoding="async" aria-hidden="true" />');class Qv extends Vn{static el=Yt({tagName:"media-thumbnail",props:{time:0}});j;ke=null;me=null;ne=[];Pb=pn("");oe=pn(!1);pe=pn(null);constructor(e){super(e),this.j=kn()}onAttach(){this.setAttributes({"data-loading":this.Tb.bind(this),"aria-hidden":vr(this.jb.bind(this))})}onConnect(){tt(this.ge.bind(this)),tt(this.se.bind(this)),tt(this.te.bind(this))}ge(){this.Pb(),this.j.$store.thumbnails(),this.oe.set(!1)}ue(){this.oe.set(!0),this.qe()}Tb(){return!this.jb()&&!this.oe()}jb(){const{duration:e,thumbnailCues:t}=this.j.$store;return!Number.isFinite(e())||t().length===0}se(){const{time:e}=this.$props,{duration:t,thumbnailCues:i}=this.j.$store,r=i(),l=e();if(!r||!Number.isFinite(t())){this.pe.set(null);return}this.pe.set(cD(l,r))}ve(e){this.ke=e}te(){const e=this.pe(),t=gt(this.j.$store.thumbnails);if(!t||!e){this.Pb.set(""),this.re();return}const[i,r=""]=(e.text||"").split("#");if(this.me=this.we(r),!this.me){this.re();return}this.Pb.set(this.xe(t,i)),this.qe()}xe(e,t){return/https?:/.test(t)?t:`${e.split("/").slice(0,-1).join("/")}${t.replace(/^\/?/,"/")}`.replace(/^\/\//,"/")}we(e){const[t,i]=e.split("="),r={},l=i?.split(",");if(!t||!i)return null;for(let u=0;u<t.length;u++)r[t[u]]=+l[u];return r}qe=hl(this.ye.bind(this));ye(){if(!this.ke||!this.me||!this.el)return;const{w:e,h:t,x:i,y:r}=this.me,{maxWidth:l,maxHeight:u,minWidth:h,minHeight:d}=getComputedStyle(this.el),p=Math.max(parseInt(h)/e,parseInt(d)/t),m=Math.min(parseInt(l)/e,parseInt(u)/t),g=m<1?m:p>1?p:1;this.le(this.el,"--thumbnail-width",`${e*g}px`),this.le(this.el,"--thumbnail-height",`${t*g}px`),this.le(this.ke,"width",`${this.ke.naturalWidth*g}px`),this.le(this.ke,"height",`${this.ke.naturalHeight*g}px`),this.le(this.ke,"transform",`translate(-${i*g}px, -${r*g}px)`)}le(e,t,i){e.style.setProperty(t,i),this.ne.push(()=>e.style.removeProperty(t))}re(){for(const e of this.ne)e();this.ne=[]}render(){const{crossorigin:e}=this.j.$store;return(()=>{const[t,i]=An(YU);return ci(()=>ln(t,"src",this.Pb())),ci(()=>ln(t,"crossorigin",e())),Uc(t,"load",this.ue.bind(this)),gm(t,this.ve.bind(this)),t})()}}const KU=zt('<!$>
69<media-thumbnail part="thumbnail" mk-d></media-thumbnail>');class ZU extends Vn{static el=Yt({tagName:"media-slider-thumbnail"});static register=[Qv];j;Lb;constructor(e){super(e),this.j=kn(),this.Lb=Ev(tu)}Mb(){const{duration:e}=this.j.$store;return this.Lb.pointerRate()*e()}render(){const e=this.Mb.bind(this);return(()=>{const[t,i]=An(KU);return ci(()=>ln(t,"time",e())),St(t),t})()}}const QU=zt('<!$><video muted="" playsinline="" preload="auto" part="video" style="max-width: unset"></video>');class JU extends Vn{static el=Yt({tagName:"media-slider-video",props:{src:void 0}});j;Lb;qa=null;Nb=pn(!1);Ob=pn(!1);Pb;Qb;onAttach(){this.j=kn(),this.Lb=Ev(tu),this.Pb=$i(this.Sb.bind(this)),this.Qb=$i(this.jb.bind(this)),this.setAttributes({"data-loading":this.Tb.bind(this),"aria-hidden":vr(this.Qb)}),tt(this.Ub.bind(this)),tt(this.Vb.bind(this))}onConnect(){this.qa.readyState>=2&&this.Rb()}render(){const{crossorigin:e}=this.j.$store;return(()=>{const[t,i]=An(QU);return ci(()=>ln(t,"src",this.Pb())),ci(()=>ln(t,"crossorigin",e())),Uc(t,"canplay",this.Rb.bind(this)),Uc(t,"error",this.Wb.bind(this)),gm(t,this.Xb.bind(this)),t})()}Sb(){const{canLoad:e}=this.j.$store;return e()?this.$props.src():null}Tb(){return!this.Nb()&&!this.Qb()}jb(){const{duration:e}=this.j.$store;return!!this.Ob()||!this.Nb()||!Number.isFinite(e())}Ub(){this.Pb(),this.Nb.set(!1),this.Ob.set(!1)}Rb(e){this.Nb.set(!0),this.dispatch("can-play",{trigger:e})}Wb(e){this.Ob.set(!0),this.dispatch("error",{trigger:e})}Vb(){const{duration:e}=this.j.$store,{pointerRate:t}=this.Lb;this.Nb()&&this.qa&&Number.isFinite(e())&&Number.isFinite(t())&&(this.qa.currentTime=t()*e())}Xb(e){this.qa=e}}function bx(n,e){const t=String(n),i=t.length;if(i<e){const l=e-i;return`${"0".repeat(l)}${n}`}return t}function H4(n){const e=Math.trunc(n/3600),t=Math.trunc(n%3600/60),i=Math.trunc(n%60),r=Number((n-Math.trunc(n)).toPrecision(3));return{hours:e,minutes:t,seconds:i,fraction:r}}function ym(n,e=!1,t=!1,i=!1){const{hours:r,minutes:l,seconds:u}=H4(n),h=e?bx(r,2):r,d=t?bx(l,2):l,p=bx(u,2);return r>0||i?`${h}:${d}:${p}`:`${d}:${p}`}function Y1(n){const e=[],{hours:t,minutes:i,seconds:r}=H4(n);return t>0&&e.push(`${t} hour`),i>0&&e.push(`${i} min`),(r>0||e.length===0)&&e.push(`${r} sec`),e.join(" ")}const eI=zt("<!$><span><!$></span>");class tI extends Vn{static el=Yt({tagName:"media-slider-value",props:{type:"current",format:void 0,showHours:!1,padHours:!1,padMinutes:!1,decimalPlaces:2}});Yb;Zb;Lb;onAttach(){this.Lb=Ev(tu),this.Yb=Br(Kv),this.Zb=$i(this._b.bind(this))}_b(){const{type:e,format:t,decimalPlaces:i,padHours:r,padMinutes:l,showHours:u}=this.$props,{value:h,pointerValue:d,min:p,max:m}=this.Lb,g=e()==="current"?h():d();if(t()==="percent"){const b=m()-p(),y=g/b*100;return(this.Yb.percent??As)(y,i())+"﹪"}else return t()==="time"?(this.Yb.time??ym)(g,r(),l(),u()):this.Yb.value?.(g)??g.toFixed(2)}render(){return(()=>{const[e,t]=An(eI),i=t.nextNode();return Xi(i,this.Zb),e})()}}let nI=class extends Zv{static el=Yt({tagName:"media-volume-slider",props:{...Yv,min:Ca({value:0,attribute:!1}),max:Ca({value:100,attribute:!1}),value:Ca({value:100,attribute:!1})},store:tu});pb=!0;onAttach(e){Ii(e,"aria-label","Media volume"),super.onAttach(e),OO().then(t=>{t||Xt(e,"aria-hidden","true")}),tt(this.D.bind(this))}D(){const{muted:e,volume:t}=this.j.$store,i=e()?0:t()*100;this.$store.value.set(i),this.dispatch("value-change",{detail:i})}$b=bm(this.ac.bind(this),25);ac(e){if(!e.trigger)return;const t=As(e.detail/100,3);this.j.remote.changeVolume(t,e)}Hb(e){this.$b(e)}Kb(e){this.$b(e)}xb(){return 0}yb(){return 100}};class nu{Fg;Gg;Eg=new Map;Hg=pn([]);constructor(e){this.Fg=e.firstChild,this.Gg=new MutationObserver(this.o.bind(this)),this.Gg.observe(this.Fg,{subtree:!0,childList:!0}),tt(this.Ig.bind(this)),_r(this.Jg.bind(this))}o(e){const t=Array.from(this.Eg.keys()).join(",");for(const i of e)for(const r of i.addedNodes)Tv(r)&&r.matches(t)&&this.uc()}dc(e,t){return this.Eg.set(e,t),this.Hg.set(i=>[...i,t]),this}uc=hl(this.na.bind(this));na(){for(const[e,t]of this.Eg){const i=gt(t);for(const r of this.Fg.querySelectorAll(e))Xt(r,"class",i)}}Ig(){for(const e of this.Hg())e();this.uc()}Jg(){this.Hg.set([]),this.Eg.clear(),this.Gg.disconnect()}}const iI=zt('<div part="chapters"></div>'),sI=zt('<div part="chapter-container"><div part="chapter"><div part="track"></div><div part="track track-fill" style="width: 0%"></div><div part="track track-progress" style="width: 0%"></div></div></div>');class rI{constructor(e,t,i){this.j=e,this.Lb=t,this.Hc=i}Kg=[];Mg=[];Lg=0;Ng=0;render(e,t){return e?.length?VP(()=>(()=>{const i=mi(iI);return ci(()=>ln(i,"class",t())),_t(i,()=>this.Sg(e)),i})()):null}Sg(e){this.Kg=this.Tg(e);const t=this.Kg[0];this.Hc(t.startTime===0?t.text:"");for(let i=0;i<this.Kg.length;i++)this.Mg.push(this.Ug());return this.Vg(),tt(this.Wg.bind(this)),tt(this.Xg.bind(this)),tt(this.Yg.bind(this)),_r(()=>{this.Mg=[],this.Lg=0,this.Ng=0}),this.Mg}Ug(){return mi(sI)}Pg(e){return e.firstChild.firstChild.nextSibling}Zg(e){return e.firstChild.lastChild}_g(){return this.Kg[this.Kg.length-1].endTime}Vg(){let e,t=this._g();for(let i=0;i<this.Kg.length;i++)e=this.Kg[i],this.Mg[i].style.width=As((e.endTime-e.startTime)/t*100,3)+"%"}Wg(){let{fillPercent:e,value:t,pointing:i}=this.Lb,r=this.Kg[this.Lg],l=this.Qg(r.startTime<=gt(t)?this.Lg:0,e());l>this.Lg?this.Rg(this.Lg,l,"100%"):l<this.Lg&&this.Rg(l+1,this.Lg+1,"0%"),!gt(i)&&this.Lg!==l&&this.Hc(this.Kg[l].text);let u=this.Pg(this.Mg[l]),h=this.Og(this.Kg[l],e())+"%";u.style.width!==h&&(u.style.width=h),this.Lg=l}Xg(){let{pointing:e,pointerPercent:t}=this.Lb;if(!e())return;const i=this.Qg(0,t());this.Hc(this.Kg[i].text)}Rg(e,t,i){for(let r=e;r<t;r++)this.Pg(this.Mg[r]).style.width=i}Qg(e,t){let i=0;for(let r=e;r<this.Kg.length;r++)if(i=this.Og(this.Kg[r],t),i>=0&&i<100)return r;return 0}Yg(){this.$g(this.ah())}$g=hl(e=>{let t;for(let i=this.Ng;i<this.Mg.length;i++)if(t=this.Og(this.Kg[i],e),this.Zg(this.Mg[i]).style.width=t+"%",t<100){this.Ng=i;break}});ah=$i(this.bh.bind(this));bh(){const{bufferedEnd:e,duration:t}=this.j;return As(Math.min(e()/Math.max(t(),1),1),3)*100}Og(e,t){const i=this.Kg[this.Kg.length-1],r=e.startTime/i.endTime*100,l=e.endTime/i.endTime*100;return Math.max(0,As(t>=l?100:(t-r)/(l-r)*100,3))}Tg(e){const t=[];for(let i=0;i<e.length-1;i++){const r=e[i],l=e[i+1];if(t.push(r),l){const u=l.startTime-r.endTime;u>0&&t.push(new window.VTTCue(r.endTime,r.endTime+u,""))}}return t.push(e[e.length-1]),t}}
69let aI=class extends Zv{static el=Yt({tagName:"media-time-slider",props:{...Yv,min:Ca({value:0,attribute:!1}),max:Ca({value:100,attribute:!1}),value:Ca({value:0,attribute:!1}),pauseWhileDragging:!1,seekingRequestThrottle:100,chaptersClass:null,chapterContainerClass:null,chapterClass:null},store:tu});pb=!0;tc=!0;ec;ya=pn(null);gc;hc;constructor(e){super(e),Pa(Kv,{value:this.jc.bind(this),time:this.kc.bind(this)})}onAttach(e){Ii(e,"aria-label","Media time"),super.onAttach(e),this.gc=new rI(this.j.$store,this.$store,this.ic.set),this.setAttributes({"data-chapters":this.lc.bind(this)}),this.setStyles({"--media-buffered-percent":this.mc.bind(this)}),tt(this.E.bind(this)),tt(this.nc.bind(this)),tt(this.oc.bind(this)),th(()=>{tt(this.pc.bind(this))})}mc(){const{bufferedEnd:e,duration:t}=this.j.$store;return As(Math.min(e()/Math.max(t(),1),1)*100,3)+"%"}lc(){const{duration:e}=this.j.$store;return this.hc?.uc(),this.ya()?.cues.length&&Number.isFinite(e())&&e()>0}onConnect(e){super.onConnect(e),this.Ra(),Rt(this.j.textTracks,"mode-change",this.Ra.bind(this));const{chapterContainerClass:t,chapterClass:i,trackClass:r,trackFillClass:l,trackProgressClass:u}=this.$props;this.hc=new nu(e).dc('[part="chapter-container"]',t).dc('[part="chapter"]',i).dc('[part="track"]',r).dc('[part~="track-fill"]',l).dc('[part~="track-progress"]',u)}
69render(){const e=super.render(),{chaptersClass:t}=this.$props;return[Pv(()=>this.gc.render(this.ya()?.cues,t)),e]}nc(){this.ec=bm(this.$a.bind(this),this.$props.seekingRequestThrottle())}E(){const{currentTime:e}=this.j.$store,{value:t,dragging:i}=this.$store,r=this.qc(e());gt(i)||(t.set(r),this.dispatch("value-change",{detail:r}))}pc(){const e=this.j.player;e&&this.lb&&Xt(e,"data-preview",this.$store.interactive())}$a(e,t){this.j.remote.seeking(e,t)}rc(e,t,i){this.ec.cancel();const{live:r}=this.j.$store;if(r()&&t>=99){this.j.remote.seekToLiveEdge(i);return}this.j.remote.seek(e,i)}fc=!1;Ib(e){const{pauseWhileDragging:t}=this.$props;if(t()){const{paused:i}=this.j.$store;this.fc=!i(),this.j.remote.pause(e)}}Kb(e){this.ec(this.bc(e.detail),e)}Jb(e){const t=e.detail;this.rc(this.bc(t),t,e);const{pauseWhileDragging:i}=this.$props;i()&&this.fc&&(this.j.remote.play(e),this.fc=!1)}Hb(e){const{dragging:t}=this.$store;t()||!e.trigger||this.Jb(e)}vb(){const e=this.$props.step()/this.j.$store.duration()*100;return Number.isFinite(e)?e:1}Fb(){const e=this.$props.keyStep()/this.j.$store.duration()*100;return Number.isFinite(e)?e:1}Gb(e){return As(e,3)}mb(){const{canSeek:e}=this.j.$store;return super.mb()||!e()}xb(){return 0}yb(){return 100}Ab(){const e=this.bc(this.$store.value()),{duration:t}=this.j.$store;return Number.isFinite(e)?`${Y1(e)} out of ${Y1(t())}`:"live"}bc(e){const{duration:t}=this.j.$store;return Math.round(e/100*t())}qc(e){const{liveEdge:t,duration:i}=this.j.$store,r=Math.max(0,Math.min(1,t()?1:Math.min(e,i())/i()));return Number.isNaN(r)?0:Number.isFinite(r)?r*100:100}jc(e){const t=this.bc(e),{live:i,duration:r}=this.j.$store;return Number.isFinite(t)?(i()?t-r():t).toFixed(0):"LIVE"}kc(e,t,i,r){const l=this.bc(e),{live:u,duration:h}=this.j.$store,d=u()?l-h():l;return Number.isFinite(l)?`${d<0?"-":""}${ym(Math.abs(d),t,xl(i)?Math.abs(d)>=3600:i,r)}`:"LIVE"}cc=null;ic=pn("");Ra(){M4(this.j.textTracks,gt(this.ya),this.ya.set)}oc(){if(this.ya(),this.cc=this.el?.querySelector('[part="chapter-title"]')??null,!!this.cc)return tt(this.sc.bind(this)),()=>{this.cc.textContent="",this.cc=null}}sc(){this.cc.textContent=this.ic()}};const cl=Jc(),oI=["a[href]","[tabindex]","input","select","button"].map(n=>`${n}:not([aria-hidden])`).join(","),GS=new Set(["Escape","Tab","ArrowUp","ArrowDown","Home","PageUp","End","PageDown","Enter"," "]);class lI{constructor(e){this.jg=e}zd=0;dh=null;ch=[];get a(){return this.ch}hd(e){Rt(e,"focus",this.Te.bind(this)),this.dh=e}gd(){this.dh&&(this.na(),Rt(this.dh,"keyup",this.Ya.bind(this)),Rt(this.dh,"keydown",this.Za.bind(this)),_r(()=>{this.zd=0,this.ch=[]}))}na(){this.zd=0,this.ch=this.hh()}kd(e=this.gh()){const t=this.ch[e],i=this.jg.dd();t&&i&&requestAnimationFrame(()=>{i.scrollTop=t.offsetTop-i.offsetHeight/2+t.offsetHeight/2})}eh(e){this.zd=e,this.ch[e]?.focus(),this.kd(e)}gh(){return this.ch.findIndex(e=>e.getAttribute("aria-checked")==="true")}Te(){setTimeout(()=>{const e=this.gh();this.eh(e>=0?e:0)},100)}Ya(e){GS.has(e.key)&&(e.stopPropagation(),e.preventDefault())}Za(e){if(GS.has(e.key))switch(e.stopPropagation(),e.preventDefault(),e.key){case"Escape":this.jg.ed(e);break;case"Tab":this.eh(this.fh(e.shiftKey?-1:1));break;case"ArrowUp":this.eh(this.fh(-1));break;case"ArrowDown":this.eh(this.fh(1));break;case"Home":case"PageUp":this.eh(0);break;case"End":case"PageDown":this.eh(this.ch.length-1);break}}fh(e){let t=this.zd;do t=(t+e+this.ch.length)%this.ch.length;while(this.ch[t].offsetParent===null);return t}hh(){if(!this.dh)return[];const e=this.dh.querySelectorAll(oI),t=[],i=r=>r.hasAttribute("data-media-menu-items");for(const r of e)r instanceof HTMLElement&&r.offsetParent!==null&&E4(this.dh,r,i)&&t.push(r);return t}}var cI=Object.defineProperty,uI=Object.getOwnPropertyDescriptor,V4=(n,e,t,i)=>{for(var r=uI(e,t),l=n.length-1,u;l>=0;l--)(u=n[l])&&(r=u(e,t,r)||r);return r&&cI(e,t,r),r};let dI=0;class Jv extends Vn{static el=Yt({tagName:"media-menu",props:{position:null}});j;Bc;Cc;wc=pn(!1);Ic=pn(!1);Jc=pn(!1);xc;yc=new Set;Dc=null;vc=null;Ac=null;zc;constructor(e){super(e),this.j=kn();const t=++dI;this.Bc=`media-menu-${t}`,this.Cc=`media-menu-button-${t}`,fm(cl)&&(this.xc=Br(cl)),this.zc=new lI({dd:this.Sc.bind(this),ed:this.close.bind(this)}),Pa(cl,{wc:this.wc,fd:pn(""),Ec:this.Ec.bind(this),Kc:this.Kc.bind(this),Lc:this.Lc.bind(this),Mc:this.Mc.bind(this),Nc:this.Nc.bind(this),Fc:this.Fc.bind(this)})}onAttach(e){const{position:t}=this.$props;this.setAttributes({position:t,"data-open":this.wc,"data-submenu":!!this.xc,"data-disabled":this.mb.bind(this),"data-media-menu":!0})}onConnect(e){this.xc||tt(this.Oc.bind(this)),tt(this.Tc.bind(this)),this.xc?.Fc(e),requestAnimationFrame(()=>this.n())}onDestroy(){this.Pc(),this.Dc=null,this.vc=null,this.Ac=null}Pc(){if(!this.vc||this.el?.contains(this.vc))return;const e=this.vc?.parentElement;this.el.append(this.vc),e?.localName==="media-menu"&&(e.destroy(),e.remove())}Oc(){if(!this.el)return;const{breakpointX:e,breakpointY:t,viewType:i,orientation:r,fullscreen:l}=this.j.$store,u=i()==="audio"?e()==="sm":t()==="sm";
69if(!(!this.vc||this.xc)){if(Xt(this.el,"data-popup",u),Xt(this.el,"data-popup-wide",u&&r()==="landscape"),u&&!l()&&this.el.contains?.(this.vc)){const h=this.el.cloneNode();h.appendChild(this.vc),requestAnimationFrame(()=>{if(!this.el)return;const d="--media-focus-ring",p=getComputedStyle(this.el).getPropertyValue(d);p&&Ms(h,d,p)}),Vs(()=>{document.body.append(h)},this.j.scope)}return this.n(),()=>this.Pc()}}Tc(){const e=this.Qc();if(this.n(),this.Rc(e),!e)return;this.zc.gd();const t=this.Uc();t&&Ic(t,this.Vc.bind(this)),this.listen("pointerup",this.Wc.bind(this)),Rt(window,"pointerup",this.Xc.bind(this))}Kc(e){const t=!!this.xc,i=this.Qc.bind(this),r=vr(i),l=vr(this.mb.bind(this));Ii(e,"tabindex",t?"-1":"0"),Ii(e,"role",t?"menuitem":"button"),Xt(e,"id",this.Cc),Xt(e,"aria-controls",this.Bc),Xt(e,"aria-haspopup","true"),tt(()=>{Xt(e,"aria-disabled",l()),Xt(e,"aria-expanded",r()),t||Xt(e,"aria-pressed",r()),Xt(e,"data-pressed",i())}),Xt(e,"data-media-button",!t),Xt(e,"data-media-menu-button",""),Ic(e,this.Yc.bind(this)),this.Dc=e}Lc(e){Ii(e,"role","menu"),Ii(e,"tabindex","-1"),Xt(e,"id",this.Bc),Xt(e,"aria-describedby",this.Cc),Xt(e,"data-media-menu-items",""),this.vc=e,this.zc.hd(e),this.Oc(),this.Rc(gt(this.wc))}Mc(e){this.Ac=e}Rc(e){this.vc&&Xt(this.vc,"aria-hidden",xm(!e))}Nc(e){this.Jc.set(e)}Yc(e){this.xc&&e.stopPropagation(),!this.mb()&&(this.wc.set(t=>!t),this.Gc(),Pr(),wa(e)&&this.vc?.focus(),this.Hc(e))}Hc(e){const t=gt(this.wc);this.dispatch(t?"open":"close",{trigger:e}),t?(this.xc||(this.j.activeMenu?.close(e),this.j.activeMenu=this),this.Ac?.id?.(e)):(this.xc||(setTimeout(()=>{for(const i of this.yc)i.close(e)},300),this.j.activeMenu=null),this.Ac?.jd?.(e)),t&&!wa(e)&&requestAnimationFrame(()=>{this.zc.na(),setTimeout(()=>{this.zc.kd()},100)})}Qc(){return!this.mb()&&this.wc()}mb(){return this.Ic()||this.Jc()}ld=this.Ec.bind(this);Ec(e){this.Ic.set(e)}Wc(e){e.stopPropagation()}Xc(){if(this.xc)return setTimeout(this.close.bind(this),800);this.close()}Vc(e){e.stopPropagation(),this.close(e)}Uc(){const e=this.el.querySelector('[slot="close-target"]');return E4(this.el,e)?e:null}Sc(){if(this.xc){let e=this.el;for(;e&&e.tagName!=="media-menu"&&e.hasAttribute("data-submenu");)e=e.parentNode;return e}else return this.vc}Gc(e){this.xc||(this.wc()?this.j.remote.pauseUserIdle(e):this.j.remote.resumeUserIdle(e))}Fc(e){this.yc.add(e),Rt(e,"open",this.Zc),Rt(e,"close",this._c),_r(this.$c)}$c=this.ad.bind(this);ad(e){this.yc.delete(e)}Zc=this.bd.bind(this);bd(e){for(const t of this.yc)t!==e.target&&t.setAttribute("aria-hidden","true");this.n()}_c=this.cd.bind(this);cd(){for(const e of this.yc)e.removeAttribute("aria-hidden");this.n()}n(){if(!this.vc)return;let e=getComputedStyle(this.vc),t=parseFloat(e.paddingTop)+parseFloat(e.paddingBottom),i=[...this.vc.children];i[0]?.localName==="shadow-root"&&i.push(...i[0].children);for(const r of i)t+=r.offsetHeight;requestAnimationFrame(()=>{this.vc&&(Xt(this.vc,"data-resizing",""),setTimeout(()=>{this.vc&&Xt(this.vc,"data-resizing",!1)},250),Ms(this.vc,"--menu-height",t+"px"))})}open(e){gt(this.wc)||(this.wc.set(!0),Pr(),this.Hc(e),wa(e)&&this.vc?.focus(),this.Gc(e))}close(e){gt(this.wc)&&(this.wc.set(!1),Pr(),wa(e)&&requestAnimationFrame(()=>{this.Dc?.focus()}),this.Hc(e),this.Gc(e))}}V4([Wr],Jv.prototype,"open");V4([Wr],Jv.prototype,"close");class nh extends Vn{static el=Yt({tagName:"media-menu-button",props:{disabled:!1}});md;constructor(e){super(e),this.md=Br(cl),new Co(e),new Xv(e)}onAttach(e){this.md.Kc(e),tt(this.rb.bind(this))}onConnect(e){const t=Array.from(e.querySelectorAll('[slot="hint"]')).pop();t&&tt(()=>{const i=this.md.fd();i&&(t.textContent=i)})}rb(){this.md.Nc(this.$props.disabled())}}class iu extends Vn{static el=Yt({tagName:"media-menu-items"});md;constructor(e){super(e),this.md=Br(cl),new Co(e)}onAttach(e){this.md.Lc(e)}}const K1=Jc();var hI=Object.defineProperty,fI=Object.getOwnPropertyDescriptor,G4=(n,e,t,i)=>{for(var r=fI(e,t),l=n.length-1,u;l>=0;l--)(u=n[l])&&(r=u(e,t,r)||r);return r&&hI(e,t,r),r};class No extends Vn{static el=Yt({tagName:"media-radio-group",props:{value:""}});td=new Set;sd=pn("");get values(){return Array.from(this.td).map(e=>e.sd())}get value(){return this.sd()}set value(e){this.Hc(e)}constructor(e){super(e),Pa(K1,{add:this.wd.bind(this),remove:this.xd.bind(this)})}onAttach(e){fm(cl)||Ii(e,"role","radiogroup"),this.ud(),this.setAttributes({value:this.sd})}onConnect(){tt(this.ud.bind(this))}onDestroy(){this.td.clear()}wd(e){this.td.has(e)||(this.td.add(e),e.qd=this.yd,e.pd(e.sd()===this.sd()))}xd(e){e.qd=null,this.td.delete(e)}ud(){this.Hc(this.$props.value())}yd=this.Hc.bind(this);Hc(e,t){const i=gt(this.sd);if(!e||e===i)return;const r=this.vd(i),l=this.vd(e);r?.pd(!1,t),l?.pd(!0,t),this.sd.set(e),this.dispatch("change",{trigger:t})}vd(e){for(const t of this.td)if(e===gt(t.sd))return t;return null}}G4([ki],No.prototype,"values");G4([ki],No.prototype,"value");var pI=Object.defineProperty,mI=Object.getOwnPropertyDescriptor,gI=(n,e,t,i)=>{for(var r=mI(e,t),l=n.length-1,u;l>=0;l--)(u=n[l])&&(r=u(e,t,r)||r);return r&&pI(e,t,r),r};const xI=zt('<!$><div part="check"></div>');class yl extends Vn{static el=Yt({tagName:"media-radio",props:{value:""}});nd=pn(!1);od={sd:this.$props.value,pd:this.pd.bind(this),qd:null};get checked(){return this.nd()}constructor(e){super(e),new Co(e)}onAttach(){tt(this.sb.bind(this)),this.rd();const e=fm(cl);this.setAttributes({value:this.$props.value,role:e?"menuitemradio":"radio",tabindex:e?-1:0,"aria-checked":vr(this.nd)})}onConnect(e){this.rd(),Ic(e,this.gb.bind(this))}onDisconnect(){Br(K1).remove(this.od)}rd(){Br(K1).add(this.od)}sb(){const{value:e}=this.$props,t=e();gt(this.nd)&&this.od.qd?.(t)}gb(e){gt(this.nd)||(this.nd.set(!0),this.dispatch("change",{trigger:e}),this.od.qd?.(gt(this.$props.value),e))}pd(e,t){gt(this.nd)!==e&&(this.nd.set(e),this.dispatch("change",{trigger:t}))}render(){return mm(xI)}}gI([ki],yl.prototype,"checked");const bI=zt("<!$><media-radio-group mk-d><!$></media-radio-group>"),vI=zt("<!$><media-radio mk-d><!$></media-radio>");
vendor: 12,635 bytes, line 69
69function ih(n){const{value:e,onChange:t,radioGroupClass:i}=n;return(()=>{const[r,l]=An(bI),u=l.nextNode();return ci(()=>ln(r,"class",i())),Uc(r,"change",t),Mn(()=>{Xi(u,()=>yI(n))},St(r,{value:e})),r})()}function yI(n){const{options:e}=n;return e().map(t=>(()=>{const[i,r]=An(vI),l=r.nextNode();return ln(i,"part",n.part),Mn(()=>{Xi(l,t.content)},St(i,{value:t.value})),i})())}const _I=zt('<!$><media-thumbnail part="thumbnail" mk-d></media-thumbnail>'),wI=zt('<!$><div part="content"><div part="title"><!$></div><div part="start-time"><!$></div><div part="duration"><!$></div></div>');class SI extends iu{static el=Yt({tagName:"media-chapters-menu-items",props:{containerClass:null,chapterClass:null,thumbnailClass:null,contentClass:null,titleClass:null,startTimeClass:null,durationClass:null}});static register=[Qv,No,yl];j;zd=pn(0);ya=pn(null);constructor(e){super(e),this.j=kn()}onAttach(e){super.onAttach(e),this.md.Mc({id:this.id.bind(this)}),this.setAttributes({"data-thumbnails":this.Ad.bind(this)})}id(){gt(()=>this.E())}onConnect(e){tt(this.E.bind(this)),tt(this.Bd.bind(this)),this.Ra(),Rt(this.j.textTracks,"mode-change",this.Ra.bind(this));const{chapterClass:t,thumbnailClass:i,contentClass:r,titleClass:l,startTimeClass:u,durationClass:h}=this.$props;new nu(e).dc('[part="chapter"]',t).dc('[part="thumbnail"]',i).dc('[part="content"]',r).dc('[part="title"]',l).dc('[part="start-time"]',u).dc('[part="duration"]',h)}Ad(){const{thumbnailCues:e}=this.j.$store;return e().length>0}E(){if(!this.md.wc())return;const e=this.ya();if(!e){this.zd.set(-1);return}const{currentTime:t}=this.j.$store,i=t(),r=e.cues.findIndex(l=>Gp(l,i));if(this.zd.set(r),r>=0){const l=e.cues[r],u=this.el.querySelector("shadow-root media-radio[aria-checked='true']"),h=(i-l.startTime)/(l.endTime-l.startTime)*100;u&&Ms(u,"--played-percent",As(h,3)+"%")}}Bd(){this.md.Ec(this.mb())}mb(){const e=this.ya();return!e||!e.cues.length}Hc(e){if(this.mb()||!e.trigger)return;const t=+e.target.value,i=this.ya()?.cues;Dc(t)&&i?.[t]&&(this.zd.set(t),this.j.remote.seek(i[t].startTime,e))}Ra(){M4(this.j.textTracks,gt(this.ya),this.ya.set)}Cd(){return this.zd()+""}Dd(){const e=this.ya();return e?e.cues.map((t,i)=>({value:i+"",content:()=>[(()=>{const r=Pv(()=>this.Ad()&&(()=>{const[l,u]=An(_I);return St(l,{time:t.startTime}),l})());return r(),r})(),(()=>{const[r,l]=An(wI),u=l.nextNode(),h=l.nextNode(),d=l.nextNode();return Xi(u,t.text),Xi(h,()=>ym(t.startTime,!1,t.startTime>=3600)),Xi(d,()=>Y1(t.endTime-t.startTime)),r})()]})):[]}render(){const{containerClass:e}=this.$props;return ih({part:"chapter",value:this.Cd.bind(this),options:this.Dd.bind(this),radioGroupClass:e,onChange:this.Hc.bind(this)})}}const EI=zt('<!$><span part="label"><!$></span>');class CI extends iu{static el=Yt({tagName:"media-audio-menu-items",props:{emptyLabel:"Default",radioClass:null,radioGroupClass:null,radioCheckClass:null}});static register=[No,yl];j;constructor(e){super(e),this.j=kn()}onConnect(e){tt(this.Bd.bind(this)),tt(this.Ed.bind(this));const{radioClass:t,radioCheckClass:i}=this.$props;new nu(e).dc("media-radio",t).dc('[part="check"]',i)}Ed(){const{emptyLabel:e}=this.$props,{audioTrack:t}=this.j.$store,i=t();this.md.fd.set(i?.label??e())}Bd(){this.md.Ec(this.mb())}mb(){const{audioTracks:e}=this.j.$store;return e().length===0}Hc(e){if(this.mb())return;const i=e.target.value,r=this.j.audioTracks.toArray().findIndex(l=>l.label.toLowerCase()===i);r>=0&&this.j.remote.changeAudioTrack(r,e)}Cd(){const{audioTrack:e}=this.j.$store,t=e();return t?t.label.toLowerCase():""}Dd(){const{audioTracks:e}=this.j.$store;return e().map(t=>({value:t.label.toLowerCase(),content:()=>(()=>{const[i,r]=An(EI),l=r.nextNode();return Xi(l,t.label),i})()}))}render(){const{radioGroupClass:e}=this.$props;return ih({value:this.Cd.bind(this),options:this.Dd.bind(this),radioGroupClass:e,onChange:this.Hc.bind(this)})}}var NI='<path fill-rule="evenodd" clip-rule="evenodd" d="M26.6667 5.99998C26.6667 5.63179 26.3682 5.33331 26 5.33331H11.3333C10.9651 5.33331 10.6667 5.63179 10.6667 5.99998V17.5714C10.6667 17.6694 10.5644 17.7342 10.4741 17.6962C9.91823 17.4625 9.30754 17.3333 8.66667 17.3333C6.08934 17.3333 4 19.4226 4 22C4 24.5773 6.08934 26.6666 8.66667 26.6666C11.244 26.6666 13.3333 24.5773 13.3333 22V8.66665C13.3333 8.29846 13.6318 7.99998 14 7.99998L23.3333 7.99998C23.7015 7.99998 24 8.29846 24 8.66665V14.9048C24 15.0027 23.8978 15.0675 23.8075 15.0296C23.2516 14.7958 22.6409 14.6666 22 14.6666C19.4227 14.6666 17.3333 16.756 17.3333 19.3333C17.3333 21.9106 19.4227 24 22 24C24.5773 24 26.6667 21.9106 26.6667 19.3333V5.99998ZM22 21.3333C23.1046 21.3333 24 20.4379 24 19.3333C24 18.2287 23.1046 17.3333 22 17.3333C20.8954 17.3333 20 18.2287 20 19.3333C20 20.4379 20.8954 21.3333 22 21.3333ZM8.66667 24C9.77124 24 10.6667 23.1045 10.6667 22C10.6667 20.8954 9.77124 20 8.66667 20C7.5621 20 6.66667 20.8954 6.66667 22C6.66667 23.1045 7.5621 24 8.66667 24Z" fill="currentColor"/>',TI='<path d="M13.0908 14.3334C12.972 14.3334 12.9125 14.1898 12.9965 14.1058L17.7021 9.40022C17.9625 9.13987 17.9625 8.71776 17.7021 8.45741L16.2879 7.04319C16.0275 6.78284 15.6054 6.78284 15.3451 7.04319L6.8598 15.5285C6.59945 15.7888 6.59945 16.2109 6.8598 16.4713L8.27401 17.8855L8.27536 17.8868L15.3453 24.9568C15.6057 25.2172 16.0278 25.2172 16.2881 24.9568L17.7024 23.5426C17.9627 23.2822 17.9627 22.8601 17.7024 22.5998L12.9969 17.8944C12.9129 17.8104 12.9724 17.6668 13.0912 17.6668L26 17.6668C26.3682 17.6668 26.6667 17.3683 26.6667 17.0001V15.0001C26.6667 14.6319 26.3682 14.3334 26 14.3334L13.0908 14.3334Z" fill="currentColor"/>',MI='<path d="M15.905 17.4809C15.9571 17.533 16.0415 17.533 16.0936 17.4809L22.4111 11.1635C22.6714 10.9031 23.0935 10.9031 23.3539 11.1635L24.9567 12.7662C25.217 13.0266 25.217 13.4487 24.9567 13.709L18.1028 20.5629C18.0937 20.5732 18.0842 20.5833 18.0744 20.5931L16.4716 22.1959C16.2113 22.4562 15.7892 22.4562 15.5288 22.1959L7.04353 13.7106C6.78318 13.4503 6.78318 13.0281 7.04353 12.7678L8.6463 11.165C8.90665 10.9047 9.32876 10.9047 9.58911 11.165L15.905 17.4809Z" fill="currentColor"/>';const AI=zt('<!$><span slot="label"><!$></span>'),RI=zt('<!$><div slot="hint"></div>');function _m({label:n,iconPaths:e}){return[xt(di,{slot:"close-icon",paths:TI}),xt(di,{slot:"icon",paths:e}),(()=>{const[t,i]=An(AI),r=i.nextNode();return Xi(r,n),t})(),mm(RI),xt(di,{slot:"open-icon",paths:MI})]}class kI extends nh{static el=Yt({tagName:"media-audio-menu-button",props:{disabled:!1,label:"Audio"}});render(){const{label:e}=this.$props;return _m({label:e,iconPaths:NI})}}const q4=zt('<!$><span part="label"><!$></span>'),jI=q4;class LI extends iu{static el=Yt({tagName:"media-captions-menu-items",props:{offLabel:"Off",radioClass:null,radioGroupClass:null,radioCheckClass:null}});static register=[No,yl];j;constructor(e){super(e),this.j=kn()}onConnect(e){tt(this.Bd.bind(this)),tt(this.Ed.bind(this));const{radioClass:t,radioCheckClass:i}=this.$props;new nu(e).dc("media-radio",t).dc('[part="check"]',i)}Ed(){const{offLabel:e}=this.$props,{textTrack:t}=this.j.$store,i=t();this.md.fd.set(i&&Wi(i)&&i.mode==="showing"?i.label:e())}Bd(){this.md.Ec(this.mb())}mb(){const{textTracks:e}=this.j.$store;return e().filter(Wi).length===0}Hc(e){if(this.mb())return;const i=e.target.value;if(i==="off"){const l=this.j.textTracks.selected;if(l){const u=this.j.textTracks.toArray().indexOf(l);this.j.remote.changeTextTrackMode(u,"disabled",e)}return}const r=this.j.textTracks.toArray().findIndex(l=>l.label.toLowerCase()===i);r>=0&&this.j.remote.changeTextTrackMode(r,"showing",e)}Cd(){const{textTrack:e,textTracks:t}=this.j.$store,i=e();return i&&Wi(i)&&i.mode==="showing"?i.label.toLowerCase():"off"}Dd(){const{offLabel:e}=this.$props,{textTracks:t}=this.j.$store;return[{value:"off",content:()=>(()=>{const[i,r]=An(q4),l=r.nextNode();return Xi(l,e),i})()},...t().filter(Wi).map(i=>({value:i.label.toLowerCase(),content:()=>(()=>{const[r,l]=An(jI),u=l.nextNode();return Xi(u,i.label),r})()}))]}render(){const{radioGroupClass:e}=this.$props;return ih({value:this.Cd.bind(this),options:this.Dd.bind(this),radioGroupClass:e,onChange:this.Hc.bind(this)})}}class PI extends nh{static el=Yt({tagName:"media-captions-menu-button",props:{disabled:!1,label:"Captions"}});render(){const{label:e}=this.$props;return _m({label:e,iconPaths:B4})}}const OI=zt('<!$><span part="label"><!$></span>');class DI extends iu{static el=Yt({tagName:"media-playback-rate-menu-items",props:{normalLabel:"Normal",rates:[.25,.5,.75,1,1.25,1.5,1.75,2],radioGroupClass:null,radioClass:null,radioCheckClass:null}});static register=[No,yl];j;constructor(e){super(e),this.j=kn()}onConnect(e){tt(this.Ed.bind(this));const{radioClass:t,radioCheckClass:i}=this.$props;new nu(e).dc("media-radio",t).dc('[part="check"]',i)}Ed(){const{normalLabel:e}=this.$props,{playbackRate:t}=this.j.$store,i=t();this.md.fd.set(i===1?e():i+"Ã")}Hc(e){const t=e.target;this.j.remote.changePlaybackRate(+t.value,e)}Cd(){const{playbackRate:e}=this.j.$store;return e()+""}Dd(){const{rates:e,normalLabel:t}=this.$props;return e().map(i=>({value:i+"",content:()=>(()=>{const[r,l]=An(OI),u=l.nextNode();return Xi(u,()=>i===1?t():i+"Ã"),r})()}))}render(){const{radioGroupClass:e}=this.$props;return ih({value:this.Cd.bind(this),options:this.Dd.bind(this),radioGroupClass:e,onChange:this.Hc.bind(this)})}}var UI='<path d="M25.14 25.1089C25.0171 25.2532 24.8356 25.3333 24.646 25.3333H22.8124C22.1084 25.3333 21.7734 24.1872 22.2745 23.6927C23.9161 22.0729 24.9336 19.822 24.9336 17.3333C24.9336 12.3997 20.9336 8.39973 16 8.39973C11.0664 8.39973 7.06641 12.3997 7.06641 17.3333C7.06641 19.822 8.08389 22.0729 9.72555 23.6927C10.2266 24.1872 9.89155 25.3333 9.18762 25.3333H7.35398C7.16436 25.3333 6.98294 25.2532 6.86001 25.1089C5.07703 23.015 4 20.2991 4 17.3333C4 10.7057 9.3724 5.33333 16 5.33333C22.6276 5.33333 28 10.7057 28 17.3333C28 20.2991 26.923 23.015 25.14 25.1089Z" fill="currentColor"/> <path d="M21.1992 14.3399C21.4595 14.0796 21.4595 13.6575 21.1992 13.3971L20.2564 12.4543C19.996 12.194 19.5739 12.194 19.3136 12.4543L16.4492 15.3187C16.4185 15.3493 16.3749 15.3629 16.332 15.3568C16.2236 15.3414 16.1127 15.3334 16 15.3334C14.7113 15.3334 13.6667 16.378 13.6667 17.6667C13.6667 18.9554 14.7113 20 16 20C17.2887 20 18.3333 18.9554 18.3333 17.6667C18.3333 17.5464 18.3242 17.4283 18.3067 17.313C18.3001 17.2696 18.3136 17.2255 18.3446 17.1945L21.1992 14.3399Z" fill="currentColor"/>';class II extends nh{static el=Yt({tagName:"media-playback-rate-menu-button",props:{disabled:!1,label:"Speed"}});render(){const{label:e}=this.$props;return _m({label:e,iconPaths:UI})}}const zI=zt("<!$><span><!$></span>"),$I=zt('<!$><span part="label"><!$></span>'),FI=zt('<!$><span part="info"><!$></span>');class BI extends iu{static el=Yt({tagName:"media-quality-menu-items",props:{autoLabel:"Auto",hideBitrate:!1,radioGroupClass:null,radioClass:null,radioCheckClass:null}});static register=[No,yl];j;Gd=$i(()=>{const{qualities:e}=this.j.$store;return[...e()].sort((t,i)=>i.height===t.height?i.bitrate-t.bitrate:i.height-t.height)});constructor(e){super(e),this.j=kn()}onConnect(e){tt(this.Bd.bind(this)),tt(this.Ed.bind(this));const{radioClass:t,radioCheckClass:i}=this.$props;new nu(e).dc("media-radio",t).dc('[part="check"]',i)}Ed(){const{autoLabel:e}=this.$props,{autoQuality:t,quality:i}=this.j.$store,r=i()?i().height+"p":"";this.md.fd.set(t()?e()+` (${r})`:r)}Bd(){const{qualities:e}=this.j.$store;this.md.Ec(e().length===0)}mb(){const{canSetQuality:e,qualities:t}=this.j.$store;return!e()||t().length===0}Hc(e){if(this.mb())return;const t=e.target,i=t.value;if(i==="auto"){this.j.remote.changeQuality(-1,e);return}const{qualities:r}=this.j.$store,l=gt(r).findIndex(u=>this.Fd(u)===i);l>=0&&this.j.remote.changeQuality(l,e)}Cd(){const{quality:e,autoQuality:t}=this.j.$store;if(t())return"auto";const i=e();return i?this.Fd(i):"auto"}Fd(e){return e.height+"_"+e.bitrate}Dd(){const{autoLabel:e,hideBitrate:t}=this.$props;return[{value:"auto",content:()=>(()=>{const[i,r]=An(zI),l=r.nextNode();return Xi(l,e),i})()},...this.Gd().map(i=>{const r=`${As(i.bitrate/1e6,2)} Mbps`;return{value:this.Fd(i),content:()=>[(()=>{const[l,u]=An($I),h=u.nextNode();return Xi(h,i.height+"p"),l})(),(()=>{const l=Pv(()=>!t()&&(()=>{const[u,h]=An(FI),d=h.nextNode();return Xi(d,r),u})());return l(),l})()]}})]}render(){const{radioGroupClass:e}=this.$props;return ih({value:this.Cd.bind(this),options:this.Dd.bind(this),radioGroupClass:e,onChange:this.Hc.bind(this)})}}var HI='<path d="M18.6669 10.4001C18.6669 10.7683 18.3684 11.0667 18.0002 11.0667H16.2668C15.8987 11.0667 15.6002 10.7683 15.6002 10.4001V9.86674C15.6002 9.7931 15.54
6905 9.73341 15.4669 9.73341H5.99998C5.63179 9.73341 5.33331 9.43493 5.33331 9.06674V7.33341C5.33331 6.96522 5.63179 6.66674 5.99998 6.66674H15.4669C15.5405 6.66674 15.6002 6.60704 15.6002 6.53341V6.00007C15.6002 5.63188 15.8987 5.3334 16.2668 5.3334H18.0002C18.3684 5.3334 18.6669 5.63188 18.6669 6.00007V10.4001Z" fill="currentColor"/> <path d="M11.3334 18.8668C11.7016 18.8668 12.0001 18.5683 12.0001 18.2001V13.8001C12.0001 13.4319 11.7016 13.1335 11.3334 13.1335H9.60006C9.23187 13.1335 8.93339 13.4319 8.93339 13.8001V14.3335C8.93339 14.4071 8.8737 14.4668 8.80006 14.4668H6.00006C5.63187 14.4668 5.33339 14.7653 5.33339 15.1335V16.8668C5.33339 17.235 5.63187 17.5335 6.00006 17.5335H8.80006C8.8737 17.5335 8.93339 17.5932 8.93339 17.6668V18.2001C8.93339 18.5683 9.23187 18.8668 9.60006 18.8668H11.3334Z" fill="currentColor"/> <path d="M18.6667 26.0001C18.6667 26.3683 18.3682 26.6668 18 26.6668H16.2667C15.8985 26.6668 15.6 26.3683 15.6 26.0001V25.4668C15.6 25.3931 15.5403 25.3334 15.4667 25.3334H6.00014C5.63195 25.3334 5.33348 25.0349 5.33348 24.6668V22.9334C5.33348 22.5652 5.63195 22.2668 6.00014 22.2668H15.4667C15.5403 22.2668 15.6 22.2071 15.6 22.1334V21.6001C15.6 21.2319 15.8985 20.9334 16.2667 20.9334H18C18.3682 20.9334 18.6667 21.2319 18.6667 21.6001V26.0001Z" fill="currentColor"/> <path d="M22 24.6668C22 25.0349 22.2985 25.3334 22.6667 25.3334H26.0001C26.3683 25.3334 26.6668 25.0349 26.6668 24.6668V22.9334C26.6668 22.5652 26.3683 22.2668 26.0001 22.2668H22.6667C22.2985 22.2668 22 22.5652 22 22.9334V24.6668Z" fill="currentColor"/> <path d="M16.0001 17.5335C15.6319 17.5335 15.3334 17.235 15.3334 16.8668V15.1335C15.3334 14.7653 15.6319 14.4668 16.0001 14.4668H26.0001C26.3683 14.4668 26.6667 14.7653 26.6667 15.1335V16.8668C26.6667 17.235 26.3683 17.5335 26.0001 17.5335H16.0001Z" fill="currentColor"/> <path d="M22.0002 9.06674C22.0002 9.43493 22.2987 9.73341 22.6669 9.73341H26C26.3682 9.73341 26.6666 9.43493 26.6666 9.06674V7.3334C26.6666 6.96521 26.3682 6.66674 26 6.66674H22.6669C22.2987 6.66674 22.0002 6.96522 22.0002 7.33341V9.06674Z" fill="currentColor"/>';class VI extends nh{static el=Yt({tagName:"media-quality-menu-button",props:{disabled:!1,label:"Quality"}});render(){const{label:e}=this.$props;return _m({label:e,iconPaths:HI})}}class GI extends Vn{static el=Yt({tagName:"media-gesture",props:{event:void 0,action:void 0}});j;Id=null;onAttach(){const{event:e,action:t}=this.$props;this.setAttributes({event:e,action:t})}onConnect(){this.j=kn(),th(()=>{this.Id=this.j.player.querySelector("media-outlet"),tt(this.Ld.bind(this))})}Ld(){let e=this.$props.event();!this.Id||!e||(/^dbl/.test(e)&&(e=e.split(/^dbl/)[1]),Rt(this.Id,e,this.Md.bind(this)))}Hd=0;Jd=-1;Md(e){if(!this.Nd(e)||U1(e)&&(e.button!==0||this.j.activeMenu))return;if(e.MEDIA_GESTURE=!0,e.preventDefault(),!gt(this.$props.event)?.startsWith("dbl"))this.Hd===0&&setTimeout(()=>{this.Hd===1&&this.Kd(e)},250);else if(this.Hd===1){queueMicrotask(()=>this.Kd(e)),clearTimeout(this.Jd),this.Hd=0;return}this.Hd===0&&(this.Jd=window.setTimeout(()=>{this.Hd=0},275)),this.Hd++}Kd(e){this.el.setAttribute("data-triggered",""),requestAnimationFrame(()=>{this.Od()&&this.Pd(gt(this.$props.action),e),requestAnimationFrame(()=>{this.el.removeAttribute("data-triggered")})})}Nd(e){if(!this.el)return!1;if(U1(e)||J5(e)||I1(e)){const t=I1(e)?e.touches[0]:void 0,i=t?.clientX??e.clientX,r=t?.clientY??e.clientY,l=this.el.getBoundingClientRect(),u=r>=l.top&&r<=l.bottom&&i>=l.left&&i<=l.right;return e.type.includes("leave")?!u:u}return!0}Od(){const e=this.j.player.querySelectorAll("media-gesture[data-triggered]");return Array.from(e).sort((t,i)=>+getComputedStyle(i).zIndex-+getComputedStyle(t).zIndex)[0]?.component===this}Pd(e,t){if(!e)return;const[i,r]=e.replace(/:([a-z])/,"-$1").split(":");e.includes(":fullscreen")?this.j.remote.toggleFullscreen("prefer-media",t):e.includes("seek:")?this.j.remote.seek(gt(this.j.$store.currentTime)+(+r||0),t):this.j.remote[i4(i)](t)}}const qI=zt('<!$><svg part="icon" fill="none" viewBox="0 0 120 120" aria-hidden="true"><circle part="track" cx="60" cy="60" r="54" stroke="currentColor"></circle><circle part="track-fill" cx="60" cy="60" r="54" stroke="currentColor" pathLength="100"></circle></svg>');class WI extends Vn{static el=Yt({tagName:"media-buffering-indicator"});j;onAttach(){this.j=kn(),this.setAttributes({"data-buffering":$i(this.Qd.bind(this))})}Qd(){const{canPlay:e,waiting:t}=this.j.$store;return!e()||t()}render(){return mm(qI)}}class XI{constructor(e){this.Sd=e}priority=10;ya=null;ih=Iv();attach(){}canRender(){return!0}detach(){this.ih.empty(),this.Sd.reset(),this.ya=null}changeTrack(e){!e||this.ya===e||(this.ih.empty(),e.readyState<2?(this.Sd.reset(),this.ih.add(Rt(e,"load",()=>this.jh(e),{once:!0}))):this.jh(e),this.ih.add(Rt(e,"add-cue",t=>{this.Sd.addCue(t.detail)}),Rt(e,"remove-cue",t=>{this.Sd.removeCue(t.detail)})),this.ya=e)}jh(e){this.Sd.changeTrack({cues:[...e.cues],regions:[...e.regions]})}}class YI extends Vn{static el=Yt({tagName:"media-captions",props:{textDir:"ltr"}});j;Sd;Rd;onAttach(){this.j=kn(),this.setAttributes({"aria-hidden":vr(this.jb.bind(this))})}onConnect(e){this.Sd=new F4(e),this.Rd=new XI(this.Sd),tt(this.Ud.bind(this))}onDisconnect(){this.Rd&&(this.Rd.detach(),this.j.textRenderers.remove(this.Rd)),this.Sd?.destroy()}jb(){const{textTrack:e}=this.j.$store,t=e();return!t||!Wi(t)}
69Ud(){const{viewType:e}=this.j.$store;return e()==="audio"?this.Vd():this.Wd()}Vd(){return tt(this.oc.bind(this)),()=>{this.el.textContent=""}}oc(){if(this.jb())return;const{textTrack:e}=this.j.$store;this.Td(),Rt(e(),"cue-change",this.Td.bind(this)),tt(this.Xd.bind(this))}Td(){this.el.textContent="";const{currentTime:e,textTrack:t}=this.j.$store,i=gt(e),r=gt(t).activeCues;for(const l of r){const u=document.createElement("div");u.setAttribute("part","cue"),u.innerHTML=vm(l,i),this.el.append(u)}}Xd(){const{currentTime:e}=this.j.$store;Vv(this.el,e())}Wd(){return tt(this.Yd.bind(this)),tt(this.Zd.bind(this)),this.j.textRenderers.add(this.Rd),()=>{this.el.textContent="",this.Rd.detach(),this.j.textRenderers.remove(this.Rd)}}Yd(){this.Sd.dir=this.$props.textDir()}Zd(){if(this.jb())return;const{currentTime:e}=this.j.$store;this.Sd.currentTime=e()}}const KI=zt('<!$><div part="container"><div part="text">LIVE</div></div>');class ZI extends Vn{static el=Yt({tagName:"media-live-indicator"});j;constructor(e){super(e),this.j=kn(),new Co(e)}onAttach(e){const{live:t,liveEdge:i}=this.j.$store;bl(e,this.ib.bind(this)),this.setAttributes({tabindex:this._d.bind(this),role:this.$d.bind(this),"data-live":t,"data-live-edge":i,"data-media-button":!0})}onConnect(e){Ic(e,this.gb.bind(this))}ib(){const{live:e}=this.j.$store;return e()?"Go live":null}_d(){const{live:e}=this.j.$store;return e()?0:null}$d(){const{live:e}=this.j.$store;return e()?"button":null}gb(e){const{liveEdge:t}=this.j.$store;t()||this.j.remote.seekToLiveEdge(e)}render(){return mm(KI)}}const QI=zt('<!$><img part="img" />');class JI extends Vn{static el=Yt({tagName:"media-poster",props:{alt:void 0}});j;ae=pn(!0);be=pn(!1);ce;de;onAttach(e){this.j=kn(),this.ce=$i(this.ee.bind(this)),this.de=this.fe.bind(this),this.setAttributes({"data-loading":this.ae,"aria-hidden":vr(this.jb.bind(this))})}onConnect(e){const{canLoad:t,poster:i}=this.j.$store;window.requestAnimationFrame(()=>{t()||$v(i())}),tt(this.ge.bind(this))}jb(){const{poster:e}=this.j.$store;return this.be()||!e()}ee(){const{canLoad:e,poster:t}=this.j.$store;return e()&&t().length?t():null}fe(){return this.ce()?this.$props.alt():null}ge(){const{canLoad:e,poster:t}=this.j.$store,i=e()&&!!t();this.ae.set(i),this.be.set(!1)}he(){this.ae.set(!1)}Wb(){this.ae.set(!1),this.be.set(!0)}render(){const{crossorigin:e}=this.j.$store;return(()=>{const[t,i]=An(QI);return ci(()=>ln(t,"src",this.ce())),ci(()=>ln(t,"alt",this.de())),ci(()=>ln(t,"crossorigin",e())),Uc(t,"load",this.he.bind(this)),Uc(t,"error",this.Wb.bind(this)),t})()}}const ez=zt("<!$><span><!$></span>");class tz extends Vn{static el=Yt({tagName:"media-time",props:{type:"current",showHours:!1,padHours:null,padMinutes:null,remainder:!1}});j;ie;onAttach(){this.j=kn(),this.ie=$i(this.Mb.bind(this))}Mb(){const{type:e,remainder:t,padHours:i,padMinutes:r,showHours:l}=this.$props,u=this.je(e()),h=this.j.$store.duration();if(!Number.isFinite(u+h))return"LIVE";const d=t()?Math.max(0,h-u):u;return ym(d,i(),xl(r())?d>=3600:r(),l())}je(e){const{bufferedEnd:t,duration:i,currentTime:r}=this.j.$store;switch(e){case"buffered":return t();case"duration":return i();default:return r()}}render(){return(()=>{const[e,t]=An(ez),i=t.nextNode();return Xi(i,this.ie),e})()}}function nz(n,e){let t=n.getBoundingClientRect(),i={"--computed-width":t.width+"px","--computed-height":t.height+"px","--preview-width":"var(--media-slider-preview-width, var(--computed-width))","--preview-height":"var(--media-slider-preview-height, var(--computed-height))"};e!=="vertical"?i={...i,"--preview-width-half":"calc(var(--preview-width) / 2)","--preview-left-clamp":"max(var(--preview-width-half), var(--slider-pointer-percent))","--preview-right-clamp":"calc(100% - var(--preview-width-half))","--preview-left":"min(var(--preview-left-clamp), var(--preview-right-clamp))"}:i={...i,"--preview-height-half":"calc(var(--preview-height) / 2)","--preview-top-clamp":"max(var(--preview-height-half), var(--slider-pointer-percent))","--preview-bottom-clamp":"calc(100% - var(--preview-height-half))","--preview-bottom":"min(var(--preview-top-clamp), var(--preview-bottom-clamp))"};for(const r of Object.keys(i))n.style.setProperty(r,i[r])}var iz=Object.freeze({__proto__:null,setupPreviewStyles:nz});class sz{_e=!1;$e=Bp();Ze=new Map;get df(){return this.Ze.size}get ef(){return this._e}async ff(){this._e||await this.$e.promise}t(e,t){if(this._e){t();return}this.Ze.delete(e),this.Ze.set(e,t)}cf(e){this.Ze.get(e)?.(),this.Ze.delete(e)}O(){this.af(),this._e=!0,this.Ze.size>0&&this.af()}P(){this._e=!1}gf(){this.P(),this.Ze.clear(),this.bf()}af(){for(const e of this.Ze.keys())this.cf(e);this.bf()}bf(){this.$e.resolve(),this.$e=Bp()}}var rz=Object.defineProperty,az=Object.getOwnPropertyDescriptor,Zn=(n,e,t,i)=>{for(var r=i>1?void 0:i?az(e,t):e,l=n.length-1,u;l>=0;l--)(u=n[l])&&(r=(i?u(e,t,r):u(r))||r);return i&&r&&rz(e,t,r),r};class Gn extends Vn{static el=Yt({tagName:"media-player",props:GO,store:N4});j;u;r;s=new sz;get q(){return this.j.$provider()}constructor(e){super(e),this.w(),new lD(e);const t={player:null,scope:Jd(),qualities:new XO,audioTracks:new fD,$provider:pn(null),$props:this.$props,$store:this.$store};t.remote=new dD(void 0),t.$iosControls=$i(this.x.bind(this)),t.textTracks=new gD,t.textTracks[Rc]=this.$props.crossorigin,t.textRenderers=new mD(t),t.ariaKeys={},this.j=t,Pa(C4,t),this.orientation=new S4(e),new Co(e),new BO(e,t),new hD(e);const i=new JO;this.u=new oD(e,i,t),this.r=new eD(e,this.u,i,t),t.delegate=new KO(this.u.N.bind(this.u),t),new YO(e,this.startLoading.bind(this))}
vendor: 4,214 bytes, line 69
69onAttach(e){e.setAttribute("tabindex","0"),Ii(e,"role","region"),tt(this.y.bind(this)),tt(this.z.bind(this)),tt(this.A.bind(this)),tt(this.B.bind(this)),tt(this.C.bind(this)),tt(this.D.bind(this)),tt(this.E.bind(this)),tt(this.F.bind(this)),tt(this.G.bind(this)),this.H(),this.I(),this.j.player=e,this.j.remote.setTarget(e),this.j.remote.setPlayer(e),Rt(e,"find-media-player",this.J.bind(this))}onConnect(e){jO&&Xt(e,"data-iphone","");const t=window.matchMedia("(pointer: coarse)");this.v(t),t.onchange=this.v.bind(this);const i=new ResizeObserver(this.n.bind(this));return i.observe(e),tt(this.n.bind(this)),this.dispatch("media-player-connect",{detail:this.el,bubbles:!0,composed:!0}),()=>{i.disconnect(),t.onchange=null}}w(){const e={viewType:"providedViewType",streamType:"providedStreamType"};for(const t of Object.keys(this.$props))this.$store[e[t]??t]?.set(this.$props[t]());tt(this.K.bind(this)),this.$store.muted.set(this.$props.muted()||this.$props.volume()===0)}y(){const{title:e}=this.$props,{live:t,viewType:i}=this.$store,r=t(),l=kv(i()),u=l!=="Unknown"?`${r?"Live ":""}${l}`:r?"Live":"Media",h=e();h&&(this.el?.setAttribute("data-title",h),this.el?.removeAttribute("title"));const d=this.el?.getAttribute("data-title")||"";this.$store.title.set(d),Xt(this.el,"aria-label",d?`${u} - ${d}`:u+" Player")}z(){const e=this.orientation.landscape?"landscape":"portrait";this.$store.orientation.set(e),Xt(this.el,"data-orientation",e),this.n()}A(){this.$store.canPlay()&&this.q?this.s.O():this.s.P()}K(){this.$store.providedViewType.set(this.$props.viewType()),this.$store.providedStreamType.set(this.$props.streamType())}H(){const e={"aspect-ratio":this.$props.aspectRatio,"data-captions":()=>{const i=this.$store.textTrack();return!!i&&Wi(i)},"data-ios-controls":this.j.$iosControls},t={canPictureInPicture:"can-pip",pictureInPicture:"pip"};for(const i of zO){const r="data-"+(t[i]??Av(i));e[r]=this.$store[i]}delete e.title,this.setAttributes(e)}I(){this.setCSSVars({"--media-aspect-ratio":()=>{const e=this.$props.aspectRatio();return e?+e.toFixed(4):null}})}J(e){e.detail(this.el)}n(){if(!this.el)return;const e=this.el.clientWidth,t=this.el.clientHeight,{smallBreakpointX:i,smallBreakpointY:r,largeBreakpointX:l,largeBreakpointY:u}=this.$props,h=e<i()?"sm":e<l()?"md":"lg",d=t<r()?"sm":t<u()?"md":"lg";this.$store.breakpointX.set(h),this.$store.breakpointY.set(d),Xt(this.el,"data-bp-x",h),Xt(this.el,"data-bp-y",d)}v(e){const t=e.matches;Xt(this.el,"data-touch",t),this.$store.touchPointer.set(t),this.n()}x(){return!AO()&&this.$store.mediaType()==="video"&&(this.$store.controls()&&!this.$props.playsinline()||this.$store.fullscreen())}get provider(){return this.q}get user(){return this.r.Q}orientation;get qualities(){return this.j.qualities}get audioTracks(){return this.j.audioTracks}get textTracks(){return this.j.textTracks}get textRenderers(){return this.j.textRenderers}get paused(){return this.q?.paused??!0}set paused(e){e?this.s.t("paused",()=>this.r.L()):this.s.t("paused",()=>this.r.M())}C(){this.paused=this.$props.paused()}get muted(){return this.q?.muted??!1}set muted(e){this.s.t("muted",()=>this.q.muted=e)}B(){this.muted=this.$props.muted()}get currentTime(){return this.q?.currentTime??0}set currentTime(e){this.s.t("currentTime",()=>{const t=this.q;e!==t.currentTime&>(()=>{const i=Math.min(Math.max(this.$store.seekableStart()+.1,e),this.$store.seekableEnd()-.1);Number.isFinite(i)&&(t.currentTime=i)})})}E(){this.currentTime=this.$props.currentTime()}get volume(){return this.q?.volume??1}set volume(e){this.s.t("volume",()=>this.q.volume=e)}D(){this.volume=Wv(0,this.$props.volume(),1)}get playsinline(){return this.q?.playsinline??!1}set playsinline(e){this.s.t("playsinline",()=>this.q.playsinline=e)}F(){this.playsinline=this.$props.playsinline()}get playbackRate(){return this.q?.playbackRate??1}set playbackRate(e){this.s.t("rate",()=>this.q.playbackRate=e)}G(){this.playbackRate=this.$props.playbackRate()}async play(){return this.r.M()}async pause(){return this.r.L()}async enterFullscreen(e){return this.r.R(e)}async exitFullscreen(e){return this.r.S(e)}enterPictureInPicture(){return this.r.T()}exitPictureInPicture(){return this.r.U()}seekToLiveEdge(){this.r.V()}
69startLoading(){this.j.delegate.p("can-load")}destroy(){this.dispatch("destroy")}}Zn([ki],Gn.prototype,"provider",1);Zn([ki],Gn.prototype,"user",1);Zn([ki],Gn.prototype,"orientation",2);Zn([ki],Gn.prototype,"qualities",1);Zn([ki],Gn.prototype,"audioTracks",1);Zn([ki],Gn.prototype,"textTracks",1);Zn([ki],Gn.prototype,"textRenderers",1);Zn([ki],Gn.prototype,"paused",1);Zn([ki],Gn.prototype,"muted",1);Zn([ki],Gn.prototype,"currentTime",1);Zn([ki],Gn.prototype,"volume",1);Zn([ki],Gn.prototype,"playsinline",1);Zn([ki],Gn.prototype,"playbackRate",1);Zn([Wr],Gn.prototype,"play",1);Zn([Wr],Gn.prototype,"pause",1);Zn([Wr],Gn.prototype,"enterFullscreen",1);Zn([Wr],Gn.prototype,"exitFullscreen",1);Zn([Wr],Gn.prototype,"enterPictureInPicture",1);Zn([Wr],Gn.prototype,"exitPictureInPicture",1);Zn([Wr],Gn.prototype,"seekToLiveEdge",1);Zn([Wr],Gn.prototype,"startLoading",1);function oz(){return[JI,WI,xU,Qv,CU,OU,IU,kU,MU,FU,Zv,aI,nI,ZU,tI,JU,tz,vl,ZI,YI,GI,Jv,nh,iu,No,yl,kI,CI,PI,LI,SI,VI,BI,II,DI]}var lz='<path d="M16.6927 25.3346C16.3245 25.3346 16.026 25.0361 16.026 24.6679L16.026 7.3346C16.026 6.96641 16.3245 6.66794 16.6927 6.66794L18.6927 6.66794C19.0609 6.66794 19.3594 6.96642 19.3594 7.3346L19.3594 24.6679C19.3594 25.0361 19.0609 25.3346 18.6927 25.3346H16.6927Z" fill="currentColor"/> <path d="M24.026 25.3346C23.6578 25.3346 23.3594 25.0361 23.3594 24.6679L23.3594 7.3346C23.3594 6.96641 23.6578 6.66794 24.026 6.66794L26.026 6.66794C26.3942 6.66794 26.6927 6.96642 26.6927 7.3346V24.6679C26.6927 25.0361 26.3942 25.3346 26.026 25.3346H24.026Z" fill="currentColor"/> <path d="M5.48113 23.9407C5.38584 24.2963 5.59689 24.6619 5.95254 24.7572L7.88439 25.2748C8.24003 25.3701 8.60559 25.159 8.70089 24.8034L13.1871 8.06067C13.2824 7.70503 13.0713 7.33947 12.7157 7.24417L10.7838 6.72654C10.4282 6.63124 10.0626 6.8423 9.96733 7.19794L5.48113 23.9407Z" fill="currentColor"/>',cz='<path d="M16.6667 10.3452C16.6667 10.8924 16.0439 11.2066 15.6038 10.8814L11.0766 7.5364C10.7159 7.26993 10.7159 6.73054 11.0766 6.46405L15.6038 3.11873C16.0439 2.79356 16.6667 3.10773 16.6667 3.6549V5.22682C16.6667 5.29746 16.7223 5.35579 16.7927 5.36066C22.6821 5.76757 27.3333 10.674 27.3333 16.6667C27.3333 22.9259 22.2592 28 16 28C9.96483 28 5.03145 23.2827 4.68601 17.3341C4.66466 16.9665 4.96518 16.6673 5.33339 16.6673H7.3334C7.70157 16.6673 7.99714 16.9668 8.02743 17.3337C8.36638 21.4399 11.8064 24.6667 16 24.6667C20.4183 24.6667 24 21.085 24 16.6667C24 12.5225 20.8483 9.11428 16.8113 8.70739C16.7337 8.69957 16.6667 8.76096 16.6667 8.83893V10.3452Z" fill="currentColor"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M17.0879 19.679C17.4553 19.9195 17.8928 20.0398 18.4004 20.0398C18.9099 20.0398 19.3474 19.9205 19.7129 19.6818C20.0803 19.4413 20.3635 19.0938 20.5623 18.6392C20.7612 18.1847 20.8606 17.6373 20.8606 16.9972C20.8625 16.3608 20.764 15.8192 20.5652 15.3722C20.3663 14.9252 20.0822 14.5853 19.7129 14.3523C19.3455 14.1175 18.908 14 18.4004 14C17.8928 14 17.4553 14.1175 17.0879 14.3523C16.7224 14.5853 16.4402 14.9252 16.2413 15.3722C16.0443 15.8173 15.9449 16.3589 15.943 16.9972C15.9411 17.6354 16.0396 18.1818 16.2385 18.6364C16.4373 19.089 16.7205 19.4366 17.0879 19.679ZM19.1362 18.4262C18.9487 18.7349 18.7034 18.8892 18.4004 18.8892C18.1996 18.8892 18.0226 18.8211 17.8691 18.6847C17.7157 18.5464 17.5964 18.3372 17.5112 18.0568C17.4279 17.7765 17.3871 17.4233 17.389 16.9972C17.3909 16.3684 17.4847 15.9025 17.6703 15.5995C17.8559 15.2945 18.0993 15.1421 18.4004 15.1421C18.603 15.1421 18.7801 15.2093 18.9316 15.3438C19.0832 15.4782 19.2015 15.6828 19.2868 15.9574C19.372 16.2301 19.4146 16.5767 19.4146 16.9972C19.4165 17.6392 19.3237 18.1156 19.1362 18.4262Z" fill="currentColor"/> <path d="M13.7746 19.8978C13.8482 19.8978 13.9079 19.8381 13.9079 19.7644V14.2129C13.9079 14.1393 13.8482 14.0796 13.7746 14.0796H12.642C12.6171 14.0796 12.5927 14.0865 12.5716 14.0997L11.2322 14.9325C11.1931 14.9568 11.1693 14.9996 11.1693 15.0457V15.9497C11.1693 16.0539 11.2833 16.1178 11.3722 16.0635L12.464 15.396C12.4682 15.3934 12.473 15.3921 12.4779 15.3921C12.4926 15.3921 12.5045 15.404 12.5045 15.4187V19.7644C12.5045 19.8381 12.5642 19.8978 12.6378 19.8978H13.7746Z" fill="currentColor"/>',uz='<path d="M15.3333 10.3452C15.3333 10.8924 15.9561 11.2066 16.3962 10.8814L20.9234 7.5364C21.2841 7.26993 21.2841 6.73054 20.9235 6.46405L16.3962 3.11873C15.9561 2.79356 15.3333 3.10773 15.3333 3.6549V5.22682C15.3333 5.29746 15.2778 5.35579 15.2073 5.36066C9.31791 5.76757 4.66667 10.674 4.66667 16.6667C4.66667 22.9259 9.74078 28 16 28C22.0352 28 26.9686 23.2827 27.314 17.3341C27.3354 16.9665 27.0348 16.6673 26.6666 16.6673H24.6666C24.2984 16.6673 24.0029 16.9668 23.9726 17.3337C23.6336 21.4399 20.1937 24.6667 16 24.6667C11.5817 24.6667 8 21.085 8 16.6667C8 12.5225 11.1517 9.11428 15.1887 8.70739C15.2663 8.69957 15.3333 8.76096 15.3333 8.83893V10.3452Z" fill="currentColor"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M17.0879 19.679C17.4553 19.9195 17.8928 20.0398 18.4004 20.0398C18.9099 20.0398 19.3474 19.9205 19.7129 19.6818C20.0803 19.4413 20.3635 19.0938 20.5623 18.6392C20.7612 18.1847 20.8606 17.6373 20.8606 16.9972C20.8625 16.3608 20.764 15.8192 20.5652 15.3722C20.3663 14.9252 20.0822 14.5853 19.7129 14.3523C19.3455 14.1175 18.908 14 18.4004 14C17.8928 14 17.4553 14.1175 17.0879 14.3523C16.7224 14.5853 16.4402 14.9252 16.2413 15.3722C16.0443 15.8173 15.9449 16.3589 15.943 16.9972C15.9411 17.6354 16.0396 18.1818 16.2385 18.6364C16.4373 19.089 16.7205 19.4366 17.0879 19.679ZM19.1362 18.4262C18.9487 18.7349 18.7034 18.8892 18.4004 18.8892C18.1996 18.8892 18.0225 18.8211 17.8691 18.6847C17.7157 18.5464 17.5964 18.3372 17.5112 18.0568C17.4278 17.7765 17.3871 17.4233 17.389 16.9972C17.3909 16.3684 17.4847 15.9025 17.6703 15.5995C17.8559 15.2945 18.0992 15.1421 18.4004 15.1421C18.603 15.1421 18.7801 15.2093 18.9316 15.3438C19.0831 15.4782 19.2015 15.6828 19.2867 15.9574C19.372 16.2301 19.4146 16.5767 19.4146 16.9972C19.4165 17.6392 19.3237 18.1156 19.1362 18.4262Z" fill="currentColor"/> <path d="M13.7746 19.8978C13.8482 19.8978 13.9079 19.8381 13.9079 19.7644V14.2129C13.9079 14.1393 13.8482 14.0796 13.7746 14.0796H12.642C12.6171 14.0796 12.5927 14.0865 12.5716 14.0997L11.2322 14.9325C11.1931 14.9568 11.1693 14.9996 11.1693 15.0457V15.9497C11.1693 16.0539 11.2833 16.1178 11.3722 16.0635L12.464 15.396C12.4682 15.3934 12.473 15.3921 12.4779 15.3921C12.4926 15.3921 12.5045 15.404 12.5045 15.4187V19.7644C12.5045 19.8381 12.5642 19.8978 12.6378 19.8978H13.7746Z" fill="currentColor"/>',dz='<path fill-rule="evenodd" clip-rule="evenodd" d="M13.5722 5.33333C13.2429 5.33333 12.9629 5.57382 12.9132 5.89938L12.4063 9.21916C12.4 9.26058 12.3746 9.29655 12.3378 9.316
6972C12.2387 9.37118 12.1409 9.42779 12.0444 9.48648C12.0086 9.5083 11.9646 9.51242 11.9255 9.49718L8.79572 8.27692C8.48896 8.15732 8.14083 8.27958 7.9762 8.56472L5.5491 12.7686C5.38444 13.0538 5.45271 13.4165 5.70981 13.6223L8.33308 15.7225C8.3658 15.7487 8.38422 15.7887 8.38331 15.8306C8.38209 15.8867 8.38148 15.9429 8.38148 15.9993C8.38148 16.0558 8.3821 16.1121 8.38332 16.1684C8.38423 16.2102 8.36582 16.2503 8.33313 16.2765L5.7103 18.3778C5.45334 18.5836 5.38515 18.9462 5.54978 19.2314L7.97688 23.4352C8.14155 23.7205 8.48981 23.8427 8.79661 23.723L11.926 22.5016C11.9651 22.4864 12.009 22.4905 12.0449 22.5123C12.1412 22.5709 12.2388 22.6274 12.3378 22.6818C12.3745 22.7019 12.4 22.7379 12.4063 22.7793L12.9132 26.0993C12.9629 26.4249 13.2429 26.6654 13.5722 26.6654H18.4264C18.7556 26.6654 19.0356 26.425 19.0854 26.0995L19.5933 22.7801C19.5997 22.7386 19.6252 22.7027 19.6619 22.6825C19.7614 22.6279 19.8596 22.5711 19.9564 22.5121C19.9923 22.4903 20.0362 22.4862 20.0754 22.5015L23.2035 23.7223C23.5103 23.842 23.8585 23.7198 24.0232 23.4346L26.4503 19.2307C26.6149 18.9456 26.5467 18.583 26.2898 18.3771L23.6679 16.2766C23.6352 16.2504 23.6168 16.2104 23.6177 16.1685C23.619 16.1122 23.6196 16.0558 23.6196 15.9993C23.6196 15.9429 23.619 15.8866 23.6177 15.8305C23.6168 15.7886 23.6353 15.7486 23.668 15.7224L26.2903 13.623C26.5474 13.4172 26.6156 13.0544 26.451 12.7692L24.0239 8.56537C23.8592 8.28023 23.5111 8.15797 23.2043 8.27757L20.0758 9.49734C20.0367 9.51258 19.9927 9.50846 19.9569 9.48664C19.8599 9.42762 19.7616 9.37071 19.6618 9.31596C19.6251 9.2958 19.5997 9.25984 19.5933 9.21843L19.0854 5.89915C19.0356 5.57369 18.7556 5.33333 18.4264 5.33333H13.5722ZM16.0001 20.2854C18.3672 20.2854 20.2862 18.3664 20.2862 15.9993C20.2862 13.6322 18.3672 11.7132 16.0001 11.7132C13.6329 11.7132 11.714 13.6322 11.714 15.9993C11.714 18.3664 13.6329 20.2854 16.0001 20.2854Z" fill="currentColor"/>';function Yn(n,e){return n()?.[e]??e}const W4=Jc();function X4(){return Br(W4)}function To(){return X4().$props.translations}const hz=zt('<media-play-button default-appearance="" mk-d><media-tooltip mk-d><span slot="play"></span><span slot="pause"></span></media-tooltip></media-play-button>'),fz=zt('<media-mute-button default-appearance="" mk-d><media-tooltip mk-d><span slot="mute"></span><span slot="unmute"></span></media-tooltip></media-mute-button>'),pz=zt('<media-caption-button default-appearance="" mk-d><media-tooltip mk-d><span slot="on"></span><span slot="off"></span></media-tooltip></media-caption-button>'),mz=zt('<media-pip-button default-appearance="" mk-d><media-tooltip mk-d><span slot="enter"></span><span slot="exit"></span></media-tooltip></media-pip-button>'),gz=zt('<media-fullscreen-button default-appearance="" mk-d><media-tooltip position="top right" mk-d><span slot="enter"></span><span slot="exit"></span></media-tooltip></media-fullscreen-button>'),xz=zt("<media-seek-button mk-d><media-tooltip mk-d><span></span></media-tooltip></media-seek-button>"),bz=zt('<media-volume-slider mk-d><media-slider-value type="pointer" format="percent" slot="preview" mk-d></media-slider-value></media-volume-slider>'),vz=zt('<span part="main-title"></span>'),yz=vz,_z=zt('<media-menu part="chapters-menu" mk-d><media-menu-button mk-d><media-tooltip mk-d></media-tooltip></media-menu-button><media-chapters-menu-items mk-d></media-chapters-menu-items></media-menu>'),wz=zt('<media-menu part="settings-menu" mk-d><media-menu-button mk-d><media-tooltip mk-d></media-tooltip></media-menu-button><media-menu-items mk-d><media-menu mk-d><media-audio-menu-button mk-d></media-audio-menu-button><media-audio-menu-items mk-d></media-audio-menu-items></media-menu><media-menu mk-d><media-playback-rate-menu-button mk-d></media-playback-rate-menu-button><media-playback-rate-menu-items mk-d></media-playback-rate-menu-items></media-menu><media-menu mk-d><media-quality-menu-button mk-d></media-quality-menu-button><media-quality-menu-items mk-d></media-quality-menu-items></media-menu><media-menu mk-d><media-captions-menu-button mk-d></media-captions-menu-button><media-captions-menu-items mk-d></media-captions-menu-items></media-menu></media-menu-items></media-menu>'),Sz=zt('<div part="gestures"><media-gesture event="pointerup" action="toggle:paused" mk-d></media-gesture><media-gesture event="pointerup" action="toggle:user-idle" mk-d></media-gesture><media-gesture event="dblpointerup" action="toggle:fullscreen" mk-d></media-gesture><media-gesture event="dblpointerup" action="seek:-10" mk-d></media-gesture><media-gesture event="dblpointerup" action="seek:10" mk-d></media-gesture></div>
69'),Ez=zt('<media-time-slider mk-d><div slot="preview"><media-slider-thumbnail mk-d></media-slider-thumbnail><div part="chapter-title"></div><media-slider-value type="pointer" format="time" mk-d></media-slider-value></div></media-time-slider>'),Cz=zt('<div part="time-group"><media-time type="current" mk-d></media-time><div part="time-divider">/</div><media-time type="duration" mk-d></media-time></div>');function wm({part:n,tooltip:e="top left"}){const t=To();return(()=>{const i=mi(hz),r=i.firstChild,l=r.firstChild,u=l.nextSibling;return ln(i,"part",n),Mn(()=>{ln(r,"position",e),Mn(()=>{_t(l,()=>Yn(t,"Play")),_t(u,()=>Yn(t,"Pause"))},St(r))},St(i)),i})()}function Sm({tooltip:n="top center"}){const e=To();return(()=>{const t=mi(fz),i=t.firstChild,r=i.firstChild,l=r.nextSibling;return Mn(()=>{ln(i,"position",n),Mn(()=>{_t(r,()=>Yn(e,"Mute")),_t(l,()=>Yn(e,"Unmute"))},St(i))},St(t)),t})()}function Em({tooltip:n="top center"}){const e=To();return(()=>{const t=mi(pz),i=t.firstChild,r=i.firstChild,l=r.nextSibling;return Mn(()=>{ln(i,"position",n),Mn(()=>{_t(r,()=>Yn(e,"Closed-Captions On")),_t(l,()=>Yn(e,"Closed-Captions Off"))},St(i))},St(t)),t})()}function Nz(){const n=To();return(()=>{const e=mi(mz),t=e.firstChild,i=t.firstChild,r=i.nextSibling;return Mn(()=>{Mn(()=>{_t(i,()=>Yn(n,"Enter PiP")),_t(r,()=>Yn(n,"Exit PiP"))},St(t))},St(e)),e})()}function Y4(){const n=To();return(()=>{const e=mi(gz),t=e.firstChild,i=t.firstChild,r=i.nextSibling;return Mn(()=>{Mn(()=>{_t(i,()=>Yn(n,"Enter Fullscreen")),_t(r,()=>Yn(n,"Exit Fullscreen"))},St(t))},St(e)),e})()}function qp({seconds:n,tooltip:e="top center"}){const t=To();return(()=>{const i=mi(xz),r=i.firstChild,l=r.firstChild;return ln(i,"seconds",n),Mn(()=>{_t(i,xt(di,{paths:n>=0?uz:cz}),r),ln(r,"position",e),Mn(()=>{_t(l,()=>Yn(t,n>=0?"Seek Forward":"Seek Backward"))},St(r))},St(i)),i})()}function K4(){return(()=>{const n=mi(bz),e=n.firstChild;return Mn(()=>{St(e)},St(n)),n})()}function Cm(){const{$media:{title:n,textTracks:e,started:t}}=X4(),i=pn(""),r=$i(()=>t()&&i()||n());return tt(()=>{const l=e().find(u=>u.kind==="chapters"&&u.mode==="showing");return l&&Rt(l,"cue-change",()=>{i.set(l.activeCues[0]?.text||"")}),()=>i.set("")}),(()=>{const l=mi(yz);return _t(l,r),l})()}function Nm({position:n="bottom",tooltip:e="bottom center"}){const t=To();return(()=>{const i=mi(_z),r=i.firstChild,l=r.firstChild,u=r.nextSibling;return ln(i,"position",n),Mn(()=>{Mn(()=>{_t(r,xt(di,{paths:lz}),l),ln(l,"position",e),Mn(()=>{_t(l,()=>Yn(t,"Chapters"))},St(l))},St(r)),St(u)},St(i)),i})()}function Tm({position:n="bottom",tooltip:e="bottom right"}){const t=To();return(()=>{const i=mi(wz),r=i.firstChild,l=r.firstChild,u=r.nextSibling,h=u.firstChild,d=h.firstChild,p=d.nextSibling,m=h.nextSibling,g=m.firstChild,b=g.nextSibling,y=m.nextSibling,_=y.firstChild,C=_.nextSibling,w=y.nextSibling,S=w.firstChild,T=S.nextSibling;return ln(i,"position",n),Mn(()=>{Mn(()=>{_t(r,xt(di,{paths:dz,rotate:!0}),l),ln(l,"position",e),Mn(()=>{_t(l,()=>Yn(t,"Settings"))},St(l))},St(r)),Mn(()=>{Mn(()=>{St(d,{label:()=>Yn(t,"Audio")}),St(p,{emptyLabel:()=>Yn(t,"Default")})},St(h)),Mn(()=>{St(g,{label:()=>Yn(t,"Speed")}),St(b,{normalLabel:()=>Yn(t,"Normal")})},St(m)),Mn(()=>{St(_,{label:()=>Yn(t,"Quality")}),St(C,{autoLabel:()=>Yn(t,"Auto")})},St(y)),Mn(()=>{St(S,{label:()=>Yn(t,"Captions")}),St(T,{offLabel:()=>Yn(t,"Off")})},St(w))},St(u))},St(i)),i})()}function Z4(){return(()=>{const n=mi(Sz),e=n.firstChild,t=e.nextSibling,i=t.nextSibling,r=i.nextSibling,l=r.nextSibling;return St(e),St(t),St(i),St(r),St(l),n})()}function Mm(){return(()=>{const n=mi(Ez),e=n.firstChild,t=e.firstChild,i=t.nextSibling,r=i.nextSibling;return Mn(()=>{St(t),St(r)},St(n)),n})()}function ey(){return(()=>{const n=mi(Cz),e=n.firstChild,t=e.nextSibling,i=t.nextSibling;return St(e),St(i),n})()}const Tz=zt('<div part="media-ui aod live:dvr mobile"><media-captions mk-d></media-captions><div part="controls"><div part="controls-group"></div><div part="controls-group"></div><div part="controls-group"><media-time type="current" mk-d></media-time><div part="controls-spacer"></div><media-time type="duration" mk-d></media-time></div><div part="controls-group"><div part="controls-spacer"></div><div part="controls-spacer"></div></div></div></div>'),Mz=zt('<div part="media-ui aod live:dvr desktop"><media-captions mk-d></media-captions><div part="controls"><div part="controls-group"></div><div part="controls-group"></div></div></div>');function Az(n){return n?Rz():kz()}function Rz(){return(()=>{const n=mi(Tz),e=n.firstChild,t=e.nextSibling,i=t.firstChild,r=i.nextSibling,l=r.nextSibling,u=l.firstChild,h=u.nextSibling,d=h.nextSibling,p=l.nextSibling,m=p.firstChild,g=m.nextSibling;return St(e),_t(i,xt(Sm,{tooltip:"top left"}),null),_t(i,xt(Cm),null),_t(i,xt(Em),null),_t(i,xt(Nm,{tooltip:"top center",position:"top"}),null),_t(i,xt(Tm,{tooltip:"top right",position:"top"}),null),_t(r,xt(Mm)),St(u),St(d),_t(p,xt(qp,{seconds:-10,tooltip:"top left"}),g),_t(p,xt(wm,{tooltip:"top center"}),g),_t(p,xt(qp,{seconds:10}),g),n})()}function kz(){return(()=>{const n=mi(Mz),e=n.firstChild,t=e.nextSibling,i=t.firstChild,r=i.nextSibling;return St(e),_t(i,xt(Mm)),_t(r,xt(qp,{seconds:-10,tooltip:"top left"}),null),_t(r,xt(wm,{tooltip:"top center"}),null),_t(r,xt(qp,{seconds:10}),null),_t(r,xt(ey),null),_t(r,xt(Cm),null),_t(r,xt(Sm,{tooltip:"top center"}),null),_t(r,xt(K4),null),_t(r,xt(Em),null),_t(r,xt(Nm,{tooltip:"top center",position:"top"}),null),_t(r,xt(Tm,{tooltip:"top right",position:"top"}),null),n})()}const jz=zt('<div part="media-ui vod live:dvr mobile"><media-captions mk-d></media-captions><media-buffering-indicator mk-d></media-buffering-indicator><div part="scrim"></div><div part="controls"><div part="controls-group"><div part="controls-spacer"></div></div><div part="controls-group"></div><div part="controls-group"><div part="controls-spacer"></div></div><div part="controls-group"></div></div><div part="start-duration"><media-time type="duration" mk-d></media-time></div></div>'),Lz=zt('<div part="media-ui vod live:dvr desktop "><media-captions mk-d></media-captions><media-buffering-indicator mk-d></media-buffering-indicator><div part="scrim"></div><div part="controls"><div part="controls-group"><div part="controls-spacer"></div></div><div part="controls-group"></div><div part="controls-group"></div><div part="controls-group"></div></div></div>');function Pz(n){return n?Oz():Dz()}function Oz(){return(()=>{const n=mi(jz),e=n.firstChild,t=e.nextSibling,i=t.nextSibling,r=i.nextSibling,l=r.firstChild;l.firstChild;const u=l.nextSibling,h=u.nextSibling,d=h.firstChild,p=h.nextSibling,m=r.nextSibling,g=m.firstChild;
69return _t(n,xt(Z4),e),St(e),St(t),_t(l,xt(Em,{tooltip:"bottom center"}),null),_t(l,xt(Nm),null),_t(l,xt(Tm,{tooltip:"bottom center"}),null),_t(l,xt(Sm,{tooltip:"bottom right"}),null),_t(u,xt(wm,{tooltip:"top center"})),_t(h,xt(ey),d),_t(h,xt(Cm),d),_t(h,xt(Y4),null),_t(p,xt(Mm)),St(g),n})()}function Dz(){return(()=>{const n=mi(Lz),e=n.firstChild,t=e.nextSibling,i=t.nextSibling,r=i.nextSibling,l=r.firstChild;l.firstChild;const u=l.nextSibling,h=u.nextSibling,d=h.nextSibling;return _t(n,xt(Z4),e),St(e),St(t),_t(l,xt(Nm),null),_t(l,xt(Tm),null),_t(h,xt(Mm)),_t(d,xt(wm),null),_t(d,xt(Sm),null),_t(d,xt(K4),null),_t(d,xt(ey),null),_t(d,xt(Cm),null),_t(d,xt(Em),null),_t(d,xt(Nz),null),_t(d,xt(Y4),null),n})()}class Uz extends Vn{static el=Yt({tagName:"media-community-skin",nohydrate:!0,props:{translations:null}});static register=oz;j;constructor(e){super(e),this.j=kn(),Pa(W4,{$props:this.$props,$media:this.j.$store})}Ae(){const{viewType:e,streamType:t}=this.j.$store;return e()==="audio"?t().includes("live")?"audio:live":"audio":t().endsWith("live")?"video:live":"video"}onAttach(){this.setAttributes({"data-audio":this.Be.bind(this),"data-video":this.Ce.bind(this),"data-mobile":this.ze.bind(this)})}Be(){const{viewType:e}=this.j.$store;return e()==="audio"}Ce(){const{viewType:e}=this.j.$store;return e()!=="audio"}ze(){const{breakpointX:e}=this.j.$store;return e()==="sm"}render(){const e=$i(this.Ae.bind(this)),t=$i(this.ze.bind(this));return()=>(e().startsWith("video")?Pz:Az)(t())}}const Iz=Uv(yD),zz=Uv(Gn),$z=Uv(Uz),Fz=` 70 .fullscreen-channel-player, 71 .fullscreen-channel-player media-outlet, 72 .fullscreen-channel-player video { 73 position: absolute !important; 74 inset: 0 !important; 75 width: 100% !important; 76 height: 100% !important; 77 object-fit: cover !important; 78 } 79`,Q4="https://watch-server-production-c01b.up.railway.app/api";function vx(n){return String(n.id||n._id||"").trim()}function Bz(n){return[...n].sort((e,t)=>{const i=e.start?Date.parse(e.start):Number.MAX_SAFE_INTEGER,r=t.start?Date.parse(t.start):Number.MAX_SAFE_INTEGER;return i-r})}function qS(n,e){const t=n.start?Date.parse(n.start):Number.NaN,i=n.stop?Date.parse(n.stop):Number.NaN;return!Number.isFinite(t)||!Number.isFinite(i)?!1:t<=e&&e<i}function Hz(n,e){const t=n.start?Date.parse(n.start):Number.NaN;return Number.isFinite(t)&&t>e}function WS(n){if(!n)return"TBA";const e=Date.parse(n);return Number.isFinite(e)?new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit",month:"short",day:"numeric"}).format(e):"TBA"}async function Vz(n){const e=await fetch(`${Q4}/channels`,{headers:{accept:"application/json"},signal:n});if(!e.ok){const i=await e.text().catch(()=>"");throw new Error(i||e.statusText||"Failed to load channels.")}const t=await e.json();return Array.isArray(t.results)?t.results:[]}async function Gz(n){const e=await fetch(`${Q4}/channels/${encodeURIComponent(n)}/play-url`,{headers:{accept:"application/json"}}),t=await e.json();if(!e.ok)throw new Error(t.error||"Failed to resolve play URL.");if(!t.url)throw new Error("Play URL is missing from server response.");return t.url}function qz(){return o.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center bg-zinc-950 pt-20 text-white",children:[o.jsx("div",{className:"mb-4 h-16 w-16 animate-spin rounded-full border-b-4 border-t-4 border-orange-500"}),o.jsx("span",{className:"text-lg font-semibold",children:"Loading channel page..."})]})}function XS(){const{id:n=""}=nv(),[e,t]=E.useState(!1),[i,r]=E.useState(null),[l,u]=E.useState(null),[h,d]=E.useState(null),[p,m]=E.useState(null),[g,b]=E.useState(!1),[y,_]=E.useState(!1),[C,w]=E.useState(!1),S=E.useRef(null),T=Date.now(),N=E.useMemo(()=>Bz(Array.isArray(l?.epg?.entries)?l.epg.entries:[]).slice(0,32),[l]),j=E.useMemo(()=>N.find(M=>qS(M,T))||null,[N,T]),O=l?vx(l):String(n).trim(),R=async(M,P)=>{if(!M){r("Cannot resolve stream for this channel.");return}P?.resetAttempts&&m(null),P?.hardResetBeforeResolve&&d(null),w(!0),b(!0),r(null);try{const G=await Gz(M);d(G)}catch(G){r(G instanceof Error?G.message:"Failed to resolve stream URL.")}finally{b(!1)}};if(E.useEffect(()=>{const M=new AbortController;return(async()=>{const G=String(n||"").trim();if(!G){r("Missing channel id in URL.");return}t(!0),r(null);try{const Y=(await Vz(M.signal)).find(J=>vx(J)===G)||null;if(!Y)throw new Error(`Channel with id "${G}" not found.`);u(Y);const W=vx(Y);W&&R(W)}catch(U){if(M.signal.aborted)return;r(U instanceof Error?U.message:"Failed to load channel.")}finally{M.signal.aborted||t(!1)}})(),()=>M.abort()},[n]),e)return o.jsx(qz,{});const z=l?.thumbnail||l?.thumbnails?.light||l?.thumbnails?.dark||null;return o.jsxs("div",{className:"fixed inset-0 isolate overflow-hidden bg-black",children:[o.jsx("style",{children:Fz}),o.jsx("div",{ref:S,className:"absolute inset-0 z-0 bg-zinc-950",children:h&&o.jsxs(zz,{className:"fullscreen-channel-player",title:`${l?.name||"Channel"} stream`,src:h,streamType:"live",crossorigin:"anonymous",muted:!0,autoplay:!0,playsInl
79ine:!0,children:[o.jsx(Iz,{}),o.jsx($z,{})]})}),!h&&!g&&C&&o.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 px-6 text-center",children:[o.jsx("p",{className:"text-sm text-zinc-400",children:"Stream didn't load?"}),o.jsxs("button",{type:"button",onClick:()=>{R(O)},className:"inline-flex items-center gap-2 rounded-2xl border border-white/20 bg-white/10 px-5 py-3 text-sm font-bold text-white backdrop-blur-md transition hover:bg-white/20",children:[o.jsx(Dd,{className:"h-4 w-4"}),"Tap to refresh"]})]}),o.jsx("div",{className:"absolute inset-0 pointer-events-none transition-opacity duration-500 opacity-100",children:o.jsx("div",{className:"absolute inset-x-0 top-0 h-40 bg-linear-to-b from-black/80 to-transparent"})}),o.jsxs("div",{className:"absolute inset-x-0 top-0 z-20 flex items-start justify-between gap-4 px-4 pt-[max(1rem,env(safe-area-inset-top))] pb-4 transition-opacity duration-500 opacity-100 pointer-events-auto",children:[o.jsxs(Ut,{to:"/channels",className:"inline-flex items-center gap-1.5 rounded-xl border border-white/20 bg-black/40 px-3 py-2 text-xs font-semibold uppercase tracking-[0.14em] text-white backdrop-blur-md transition hover:bg-white/15",children:[o.jsx(X6,{className:"h-3.5 w-3.5"}),"Channels"]}),l&&o.jsxs("div",{children:[o.jsx("div",{className:"max-w-[55vw] rounded-2xl border border-white/15 bg-black/50 px-3 py-2 backdrop-blur-md sm:max-w-xs",children:o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx("div",{className:"h-10 w-14 shrink-0 overflow-hidden rounded-lg border border-white/10 bg-zinc-900",children:z?o.jsx("img",{src:z,alt:l.name||"Channel",className:"h-full w-full object-contain p-1.5",loading:"lazy"}):o.jsx("div",{className:"flex h-full w-full items-center justify-center",children:o.jsx(g8,{className:"h-4 w-4 text-zinc-500"})})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"line-clamp-1 text-xs font-bold text-white",children:l.name||"Unnamed channel"}),j?.title?o.jsxs("div",{className:"mt-0.5 flex items-center gap-1",children:[o.jsx(ul,{className:"h-2.5 w-2.5 shrink-0 animate-pulse text-rose-400"}),o.jsx("p",{className:"line-clamp-1 text-[11px] text-zinc-300",children:j.title})]}):o.jsxs("p",{className:"mt-0.5 text-[11px] text-zinc-500",children:["Ch ",l.channelNumber??"--"]})]})]})}),o.jsxs("div",{className:"mt-2 hidden items-center gap-1 rounded-2xl border border-white/15 bg-black/60 p-1.5 backdrop-blur-md",children:[o.jsxs("button",{type:"button",onClick:()=>{R(O,{resetAttempts:!0})},disabled:g,className:"inline-flex items-center gap-1.5 rounded-xl px-4 py-2 text-xs font-semibold text-white transition hover:bg-white/15 disabled:opacity-50",children:[o.jsx(Dd,{className:`h-3.5 w-3.5 ${g?"animate-spin":""}`}),"Refresh"]}),o.jsx("div",{className:"h-5 w-px bg-white/15"}),o.jsxs("button",{type:"button",onClick:()=>_(!0),className:"inline-flex items-center gap-1.5 rounded-xl px-4 py-2 text-xs font-semibold text-white transition hover:bg-white/15",children:[o.jsx(C3,{className:"h-3.5 w-3.5"}),"Schedule"]})]})]})]}),o.jsxs("div",{className:"absolute bottom-0 left-0 z-20 max-w-xs pointer-events-none px-4 pb-[max(1.25rem,env(safe-area-inset-bottom))] transition-opacity duration-500 opacity-100",children:[p&&o.jsx("div",{className:"mb-2 rounded-lg border border-orange-300/25 bg-orange-500/15 px-3 py-2 text-xs text-orange-200 backdrop-blur-sm",children:p}),i&&o.jsx("div",{className:"mb-2 rounded-lg border border-rose-300/25 bg-rose-500/15 px-3 py-2 text-xs text-rose-200 backdrop-blur-sm",children:i})]}),y&&o.jsx("div",{className:"absolute inset-0 z-30 flex items-end justify-center bg-black/55 p-4 sm:items-center",onClick:()=>_(!1),children:o.jsxs("div",{className:"flex max-h-[75vh] w-full max-w-2xl flex-col overflow-hidden rounded-3xl border border-white/10 bg-zinc-950 shadow-[0_24px_80px_rgba(0,0,0,0.55)]",onClick:M=>M.stopPropagation(),children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-white/10 px-5 pt-4 pb-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(C3,{className:"h-4 w-4 text-orange-400"}),o.jsx("h2",{className:"text-sm font-black tracking-tight text-zinc-100",children:"Schedule"}),N.length>0&&o.jsxs("span",{className:"text-[10px] uppercase tracking-[0.16em] text-zinc-500",children:[N.length," slots"]})]}),o.jsx("button",{type:"button",onClick:()=>_(!1),className:"rounded-lg border border-white/10 bg-white/5 p-1.5 text-zinc-400 transition hover:bg-white/10 hover:text-white",children:o.jsx(Ar,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"overflow-y-auto px-5 pb-5 pt-4",children:[N.length===0&&o.jsx("p",{className:"rounded-xl border border-white/10 bg-zinc-900/50 p-4 text-sm text-zinc-400",children:"No schedule entries available."}),N.length>0&&o.jsxs("div",{className:"relative pl-8",children:[o.jsx("div",{className:"absolute left-2.75 top-2 bottom-2 w-px bg-white/10"}),N.map((M,P)=>{const G=qS(M,T),U=!G&&!Hz(M,T);return o.jsxs("div",{className:"relative mb-1 pb-5 last:pb-0",children:[o.jsx("div",{className:"absolute -left-8 top-0.75 flex items-center justify-center",children:G?o.jsxs("span",{className:"relative flex h-5 w-5 items-center justify-center",children:[o.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-rose-500 opacity-40"}),o.jsx("span",{className:"relative h-3 w-3 rounded-full bg-rose-500 shadow-[0_0_8px_2px_rgba(239,68,68,0.5)]"})]}):U?o.jsx("span",{className:"h-2 w-2 rounded-full bg-zinc-700"}):o.jsx("span",{className:"h-2.5 w-2.5 rounded-full border-2 border-orange-400/50 bg-orange-500/20"})}),o.jsxs("div",{className:["rounded-xl border p-3 transition-colors",G?"border-rose-400/25 bg-rose-500/8 ring-1 ring-rose-500/15":U?"border-white/6 bg-zinc-900/30 opacity-50":"border-white/10 bg-zinc-900/55"].join(" "),children:[o.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[o.jsx("p",{className:["line-clamp-2 text-sm font-semibold leading-snug",G?"text-white":U?"text-zinc-400":"text-zinc-100"].join(" "),children:M.title||"Untitled program"}),G&&o.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-rose-400/30 bg-rose-500/20 px-2 py-0.5 text-[10px] font-bold uppercase tracking-widest text-rose-200",children:[o.jsx(ul,{className:"h-2.5 w-2.5 animate-pulse"}),"Live"]})]}),o.jsxs("p",{className:["mt-1 text-[11px] font-medium tabular-nums",G?"text-rose-200/70":"text-zinc-500"].join(" "),children:[WS(M.start)," - ",WS(M.stop)]}),M.description&&o.jsx("p",{className:"mt-1.5 line-clamp-2 text-xs leading-relaxed text-zinc-400",children:M.description})]})]},`${O}-entry-${M.start||"na"}-${P}`)})]})]})]})})]})}function Wz(){return o.jsxs("div",{className:"flex flex-col items-center justify-center min-h-screen bg-zinc-950 text-white pt-20",children:[o.jsx("div",{className:"animate-spin rounded-full h-16 w-16 border-t-4 border-b-4 border-blue-500 mb-4"}),o.jsx("span",{className:"text-lg font-semibold",children:"Loading..."})]})}
79const Xz="https://watch-server-production-c01b.up.railway.app/api";function Yz({onPlay:n,isPlayerOpen:e}){const[t,i]=E.useState(0),[r,l]=E.useState([]),[u,h]=E.useState(!0);E.useEffect(()=>{const m=new AbortController;return(async()=>{try{const y=await(await fetch(`${Xz}/universes/marvel`,{signal:m.signal})).json();if(Array.isArray(y.results)){const _=y.results,C=await Kc(_.slice(0,5),m.signal).catch(()=>[]);l(Zc(_,C))}}catch(b){if(m.signal.aborted)return;console.error("Error fetching universes data:",b)}finally{h(!1)}})(),()=>m.abort()},[]);const p=[...r.slice(0,5)].map(m=>({id:m.id,title:m.title||m.original_title,logoUrl:m.logoUrl,year:(m.release_date||"").substring(0,4),rating:m.adult?"R":"PG-13",duration:"",quality:"HD",description:m.overview,image:`https://image.tmdb.org/t/p/original${m.backdrop_path}`,type:"movie"}));return E.useEffect(()=>{if(p.length===0)return;const m=setInterval(()=>{i(g=>(g+1)%p.length)},8e3);return()=>clearInterval(m)},[p.length]),u||p.length===0?o.jsx(Wz,{}):o.jsxs(o.Fragment,{children:[o.jsx(Qd,{featuredMovies:p,currentHeroIndex:t,setCurrentHeroIndex:i,onPlay:n,isPlayerOpen:e}),o.jsxs("div",{className:"pb-20 -mt-24 relative z-10",children:[o.jsx(ur,{title:"Marvel Universe",movies:r,endpoint:"/universes/marvel",showViewAll:!0}),o.jsx(ur,{title:"Star Wars",endpoint:"/universes/starwars",showViewAll:!0}),o.jsx(ur,{title:"Harry Potter",endpoint:"/universes/harrypotter",showViewAll:!0}),o.jsx(ur,{title:"Pixar",endpoint:"/universes/pixar",showViewAll:!0}),o.jsx(ur,{title:"DreamWorks",endpoint:"/universes/dreamworks",showViewAll:!0})]})]})}const YS="https://watch-server-production-c01b.up.railway.app/api";function Kz({onPlay:n}){const[e,t]=E.useState([]),[i,r]=E.useState(!0),[l,u]=E.useState(null),[h,d]=Ki();E.useEffect(()=>{(async()=>{r(!0),u(null);try{const b=await fetch(`${YS}/unlocked`);if(!b.ok)throw new Error("Failed to load unlocked library");const _=(await b.json()).results||[],C=await Promise.all(_.map(async w=>{try{const S=w.media_type==="tv"?"tv":"movies",T=await fetch(`${YS}/${S}/${w.media_id}`);if(!T.ok)throw new Error("meta fetch failed");const N=await T.json();return{...w,...N}}catch{return w}}));t(C)}catch(b){console.error(b),u("Unable to load unlocked titles right now.")}finally{r(!1)}})()},[]);const p=g=>{n({type:g.media_type,id:g.media_id,title:g.media_title||g.title||g.name||g.original_title,image:g.backdrop_path?`https://image.tmdb.org/t/p/original${g.backdrop_path}`:void 0})},m=g=>{const b=new URLSearchParams(h);b.set("watch",`${g.media_type}-${g.media_id}`),d(b)};return o.jsxs("div",{className:"pt-24 px-4 md:px-12 pb-12",children:[o.jsx("div",{className:"flex items-center justify-between mb-6",children:o.jsxs("div",{children:[o.jsx("p",{className:"text-sm text-zinc-400 uppercase tracking-wide",children:"Library"}),o.jsx("h1",{className:"text-3xl font-bold text-white",children:"Unlocked titles"}),o.jsx("p",{className:"text-zinc-400 text-sm mt-1",children:"Movies and series wallets that have reached full payment."})]})}),i&&o.jsx("div",{className:"flex justify-center py-12",children:o.jsx("div",{className:"w-10 h-10 border-4 border-[#E25E0C] border-t-transparent rounded-full animate-spin"})}),l&&!i&&o.jsx("div",{className:"text-center text-red-400 py-10 text-sm",children:l}),!i&&!l&&e.length===0&&o.jsx("div",{className:"text-center text-zinc-400 py-12",children:"No unlocked titles yet. Keep contributing to unlock movies."}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:e.map(g=>{const b=g.title||g.name||g.original_title||g.media_title||`Title #${g.media_id}`,y=(g.release_date||g.first_air_date||"").slice(0,4),_=g.backdrop_path||g.poster_path,C=_?`https://image.tmdb.org/t/p/w780${_}`:"https://via.placeholder.com/1280x720?text=Unlocked";return o.jsxs("div",{className:"group rounded-xl overflow-hidden border border-white/10 bg-zinc-900/70 hover:border-white/30 transition shadow-lg flex flex-col sm:flex-row cursor-pointer",onClick:()=>m(g),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),m(g))},role:"button",tabIndex:0,children:[o.jsxs("div",{className:"relative w-full sm:w-64 md:w-72 aspect-video bg-zinc-800 shrink-0",children:[o.jsx("img",{src:C,alt:b,className:"w-full h-full object-cover"}),o.jsx("div",{className:"absolute inset-0 bg-linear-to-t from-black via-black/40 to-transparent opacity-70 group-hover:opacity-50 transition"})]}),o.jsxs("div",{className:"flex-1 p-4 flex flex-col gap-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-white font-semibold line-clamp-2",children:b}),o.jsxs("p",{className:"text-xs text-zinc-400",children:["Unlocked ",g.media_type==="tv"?"Series":"Movie"," ⢠",
79y||"Unknown"]}),g.overview&&o.jsx("p",{className:"text-xs text-zinc-300 line-clamp-3 leading-relaxed",children:g.overview})]}),o.jsxs("div",{className:"flex gap-2 mt-auto",children:[o.jsxs("button",{type:"button",className:"flex-1 inline-flex items-center justify-center gap-2 rounded-lg bg-white text-black font-semibold py-2 text-sm hover:bg-zinc-200 transition",onClick:w=>{w.stopPropagation(),p(g)},children:[o.jsx(Ts,{className:"w-4 h-4 fill-black"}),"Play"]}),o.jsx("button",{type:"button",className:"px-3 py-2 rounded-lg border border-white/30 text-white text-sm bg-black/50 hover:bg-black/70",onClick:w=>{w.stopPropagation(),m(g)},children:"Details"})]})]})]},`${g.media_type}-${g.media_id}`)})})]})}const ty="183",Zz=0,KS=1,Qz=2,wp=1,Jz=2,xd=3,So=0,os=1,Rr=2,Na=0,kc=1,ZS=2,QS=3,JS=4,e$=5,il=100,t$=101,n$=102,i$=103,s$=104,r$=200,a$=201,o$=202,l$=203,Z1=204,Q1=205,c$=206,u$=207,d$=208,h$=209,f$=210,p$=211,m$=212,g$=213,x$=214,J1=0,eb=1,tb=2,zc=3,nb=4,ib=5,sb=6,rb=7,J4=0,b$=1,v$=2,Dr=0,eC=1,tC=2,nC=3,iC=4,sC=5,rC=6,aC=7,oC=300,fl=301,$c=302,yx=303,_x=304,Am=306,ab=1e3,Sa=1001,ob=1002,Ri=1003,y$=1004,Hf=1005,zi=1006,wx=1007,ol=1008,Ws=1009,lC=1010,cC=1011,qd=1012,ny=1013,Hr=1014,kr=1015,Ra=1016,iy=1017,sy=1018,Wd=1020,uC=35902,dC=35899,hC=1021,fC=1022,hr=1023,ka=1026,ll=1027,pC=1028,ry=1029,Fc=1030,ay=1031,oy=1033,Sp=33776,Ep=33777,Cp=33778,Np=33779,lb=35840,cb=35841,ub=35842,db=35843,hb=36196,fb=37492,pb=37496,mb=37488,gb=37489,xb=37490,bb=37491,vb=37808,yb=37809,_b=37810,wb=37811,Sb=37812,Eb=37813,Cb=37814,Nb=37815,Tb=37816,Mb=37817,Ab=37818,Rb=37819,kb=37820,jb=37821,Lb=36492,Pb=36494,Ob=36495,Db=36283,Ub=36284,Ib=36285,zb=36286,_$=3200,w$=0,S$=1,go="",Gs="srgb",Bc="srgb-linear",Wp="linear",yn="srgb",ac=7680,eE=519,E$=512,C$=513,N$=514,ly=515,T$=516,M$=517,cy=518,A$=519,tE=35044,nE="300 es",jr=2e3,Xp=2001;function R$(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Yp(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function k$(){const n=Yp("canvas");return n.style.display="block",n}const iE={};function sE(...n){const e="THREE."+n.shift();console.log(e,...n)}function mC(n){const e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function Bt(...n){n=mC(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function hn(...n){n=mC(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function Kp(...n){const e=n.join(" ");e in iE||(iE[e]=!0,Bt(...n))}function j$(n,e,t){return new Promise(function(i,r){function l(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(l,t);break;default:i()}}setTimeout(l,t)})}const L$={[J1]:eb,[tb]:sb,[nb]:rb,[zc]:ib,[eb]:J1,[sb]:tb,[rb]:nb,[ib]:zc};class su{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners;if(i===void 0)return;const r=i[e];if(r!==void 0){const l=r.indexOf(t);l!==-1&&r.splice(l,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const i=t[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let l=0,u=r.length;l<u;l++)r[l].call(this,e);e.target=null}}}const Di=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],Sx=Math.PI/180,$b=180/Math.PI;function sh(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Di[n&255]+Di[n>>8&255]+Di[n>>16&255]+Di[n>>24&255]+"-"+Di[e&255]+Di[e>>8&255]+"-"+Di[e>>16&15|64]+Di[e>>24&255]+"-"+Di[t&63|128]+Di[t>>8&255]+"-"+Di[t>>16&255]+Di[t>>24&255]+Di[i&255]+Di[i>>8&255]+Di[i>>16&255]+Di[i>>24&255]).toLowerCase()}function sn(n,e,t){return Math.max(e,Math.min(t,n))}function P$(n,e){return(n%e+e)%e}function Ex(n,e,t){return(1-t)*n+t*e}function ad(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function ss(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}class Cn{constructor(e=0,t=0){Cn.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 9,877 bytes, line 79
79sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=sn(this.x,e.x,t.x),this.y=sn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=sn(this.x,e,t),this.y=sn(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(sn(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(sn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),l=this.x-e.x,u=this.y-e.y;return this.x=l*i-u*r+e.x,this.y=l*r+u*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ru{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,l,u,h){let d=i[r+0],p=i[r+1],m=i[r+2],g=i[r+3],b=l[u+0],y=l[u+1],_=l[u+2],C=l[u+3];if(g!==C||d!==b||p!==y||m!==_){let w=d*b+p*y+m*_+g*C;w<0&&(b=-b,y=-y,_=-_,C=-C,w=-w);let S=1-h;if(w<.9995){const T=Math.acos(w),N=Math.sin(T);S=Math.sin(S*T)/N,h=Math.sin(h*T)/N,d=d*S+b*h,p=p*S+y*h,m=m*S+_*h,g=g*S+C*h}else{d=d*S+b*h,p=p*S+y*h,m=m*S+_*h,g=g*S+C*h;const T=1/Math.sqrt(d*d+p*p+m*m+g*g);d*=T,p*=T,m*=T,g*=T}}e[t]=d,e[t+1]=p,e[t+2]=m,e[t+3]=g}static multiplyQuaternionsFlat(e,t,i,r,l,u){const h=i[r],d=i[r+1],p=i[r+2],m=i[r+3],g=l[u],b=l[u+1],y=l[u+2],_=l[u+3];return e[t]=h*_+m*g+d*y-p*b,e[t+1]=d*_+m*b+p*g-h*y,e[t+2]=p*_+m*y+h*b-d*g,e[t+3]=m*_-h*g-d*b-p*y,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,l=e._z,u=e._order,h=Math.cos,d=Math.sin,p=h(i/2),m=h(r/2),g=h(l/2),b=d(i/2),y=d(r/2),_=d(l/2);switch(u){case"XYZ":this._x=b*m*g+p*y*_,this._y=p*y*g-b*m*_,this._z=p*m*_+b*y*g,this._w=p*m*g-b*y*_;break;case"YXZ":this._x=b*m*g+p*y*_,this._y=p*y*g-b*m*_,this._z=p*m*_-b*y*g,this._w=p*m*g+b*y*_;break;case"ZXY":this._x=b*m*g-p*y*_,this._y=p*y*g+b*m*_,this._z=p*m*_+b*y*g,this._w=p*m*g-b*y*_;break;case"ZYX":this._x=b*m*g-p*y*_,this._y=p*y*g+b*m*_,this._z=p*m*_-b*y*g,this._w=p*m*g+b*y*_;break;case"YZX":this._x=b*m*g+p*y*_,this._y=p*y*g+b*m*_,this._z=p*m*_-b*y*g,this._w=p*m*g-b*y*_;break;case"XZY":this._x=b*m*g-p*y*_,this._y=p*y*g-b*m*_,this._z=p*m*_+b*y*g,this._w=p*m*g+b*y*_;break;default:Bt("Quaternion: .setFromEuler() encountered an unknown order: "+u)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],l=t[8],u=t[1],h=t[5],d=t[9],p=t[2],m=t[6],g=t[10],b=i+h+g;if(b>0){const y=.5/Math.sqrt(b+1);this._w=.25/y,this._x=(m-d)*y,this._y=(l-p)*y,this._z=(u-r)*y}else if(i>h&&i>g){const y=2*Math.sqrt(1+i-h-g);this._w=(m-d)/y,this._x=.25*y,this._y=(r+u)/y,this._z=(l+p)/y}else if(h>g){const y=2*Math.sqrt(1+h-i-g);this._w=(l-p)/y,this._x=(r+u)/y,this._y=.25*y,this._z=(d+m)/y}else{const y=2*Math.sqrt(1+g-i-h);this._w=(u-r)/y,this._x=(l+p)/y,this._y=(d+m)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(sn(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,l=e._z,u=e._w,h=t._x,d=t._y,p=t._z,m=t._w;return this._x=i*m+u*h+r*p-l*d,this._y=r*m+u*d+l*h-i*p,this._z=l*m+u*p+i*d-r*h,this._w=u*m-i*h-r*d-l*p,this._onChangeCallback(),this}slerp(e,t){let i=e._x,r=e._y,l=e._z,u=e._w,h=this.dot(e);h<0&&(i=-i,r=-r,l=-l,u=-u,h=-h);let d=1-t;if(h<.9995){const p=Math.acos(h),m=Math.sin(p);d=Math.sin(d*p)/m,t=Math.sin(t*p)/m,this._x=this._x*d+i*t,this._y=this._y*d+r*t,this._z=this._z*d+l*t,this._w=this._w*d+u*t,this._onChangeCallback()}else this._x=this._x*d+i*t,this._y=this._y*d+r*t,this._z=this._z*d+l*t,this._w=this._w*d+u*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),l=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),l*Math.sin(t),l*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Ne{constructor(e=0,t=0,i=0){Ne.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(rE.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(rE.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,l=e.elements;return this.x=l[0]*t+l[3]*i+l[6]*r,this.y=l[1]*t+l[4]*i+l[7]*r,this.z=l[2]*t+l[5]*i+l[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,l=e.elements,u=1/(l[3]*t+l[7]*i+l[11]*r+l[15]);return this.x=(l[0]*t+l[4]*i+l[8]*r+l[12])*u,this.y=(l[1]*t+l[5]*i+l[9]*r
vendor: 5,923 bytes, line 79
79+l[13])*u,this.z=(l[2]*t+l[6]*i+l[10]*r+l[14])*u,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,l=e.x,u=e.y,h=e.z,d=e.w,p=2*(u*r-h*i),m=2*(h*t-l*r),g=2*(l*i-u*t);return this.x=t+d*p+u*g-h*m,this.y=i+d*m+h*p-l*g,this.z=r+d*g+l*m-u*p,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,l=e.elements;return this.x=l[0]*t+l[4]*i+l[8]*r,this.y=l[1]*t+l[5]*i+l[9]*r,this.z=l[2]*t+l[6]*i+l[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=sn(this.x,e.x,t.x),this.y=sn(this.y,e.y,t.y),this.z=sn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=sn(this.x,e,t),this.y=sn(this.y,e,t),this.z=sn(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(sn(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,l=e.z,u=t.x,h=t.y,d=t.z;return this.x=r*d-l*h,this.y=l*u-i*d,this.z=i*h-r*u,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Cx.copy(this).projectOnVector(e),this.sub(Cx)}reflect(e){return this.sub(Cx.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(sn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Cx=new Ne,rE=new ru;class Gt{constructor(e,t,i,r,l,u,h,d,p){Gt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,l,u,h,d,p)}set(e,t,i,r,l,u,h,d,p){const m=this.elements;return m[0]=e,m[1]=r,m[2]=h,m[3]=t,m[4]=l,m[5]=d,m[6]=i,m[7]=u,m[8]=p,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,l=this.elements,u=i[0],h=i[3],d=i[6],p=i[1],m=i[4],g=i[7],b=i[2],y=i[5],_=i[8],C=r[0],w=r[3],S=r[6],T=r[1],N=r[4],j=r[7],O=r[2],R=r[5],z=r[8];return l[0]=u*C+h*T+d*O,l[3]=u*w+h*N+d*R,l[6]=u*S+h*j+d*z,l[1]=p*C+m*T+g*O,l[4]=p*w+m*N+g*R,l[7]=p*S+m*j+g*z,l[2]=b*C+y*T+_*O,l[5]=b*w+y*N+_*R,l[8]=b*S+y*j+_*z,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],l=e[3],u=e[4],h=e[5],d=e[6],p=e[7],m=e[8];
vendor: 23,311 bytes, line 79
79return t*u*m-t*h*p-i*l*m+i*h*d+r*l*p-r*u*d}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],l=e[3],u=e[4],h=e[5],d=e[6],p=e[7],m=e[8],g=m*u-h*p,b=h*d-m*l,y=p*l-u*d,_=t*g+i*b+r*y;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const C=1/_;return e[0]=g*C,e[1]=(r*p-m*i)*C,e[2]=(h*i-r*u)*C,e[3]=b*C,e[4]=(m*t-r*d)*C,e[5]=(r*l-h*t)*C,e[6]=y*C,e[7]=(i*d-p*t)*C,e[8]=(u*t-i*l)*C,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,l,u,h){const d=Math.cos(l),p=Math.sin(l);return this.set(i*d,i*p,-i*(d*u+p*h)+u+e,-r*p,r*d,-r*(-p*u+d*h)+h+t,0,0,1),this}scale(e,t){return this.premultiply(Nx.makeScale(e,t)),this}rotate(e){return this.premultiply(Nx.makeRotation(-e)),this}translate(e,t){return this.premultiply(Nx.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Nx=new Gt,aE=new Gt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),oE=new Gt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function O$(){const n={enabled:!0,workingColorSpace:Bc,spaces:{},convert:function(r,l,u){return this.enabled===!1||l===u||!l||!u||(this.spaces[l].transfer===yn&&(r.r=Ta(r.r),r.g=Ta(r.g),r.b=Ta(r.b)),this.spaces[l].primaries!==this.spaces[u].primaries&&(r.applyMatrix3(this.spaces[l].toXYZ),r.applyMatrix3(this.spaces[u].fromXYZ)),this.spaces[u].transfer===yn&&(r.r=jc(r.r),r.g=jc(r.g),r.b=jc(r.b))),r},workingToColorSpace:function(r,l){return this.convert(r,this.workingColorSpace,l)},colorSpaceToWorking:function(r,l){return this.convert(r,l,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===go?Wp:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,l=this.workingColorSpace){return r.fromArray(this.spaces[l].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,l,u){return r.copy(this.spaces[l].toXYZ).multiply(this.spaces[u].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,l){return Kp("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(r,l)},toWorkingColorSpace:function(r,l){return Kp("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(r,l)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[Bc]:{primaries:e,whitePoint:i,transfer:Wp,toXYZ:aE,fromXYZ:oE,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Gs},outputColorSpaceConfig:{drawingBufferColorSpace:Gs}},[Gs]:{primaries:e,whitePoint:i,transfer:yn,toXYZ:aE,fromXYZ:oE,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Gs}}}),n}const cn=O$();function Ta(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function jc(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let oc;class D${static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{oc===void 0&&(oc=Yp("canvas")),oc.width=e.width,oc.height=e.height;const r=oc.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=oc}return i.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Yp("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),l=r.data;for(let u=0;u<l.length;u++)l[u]=Ta(l[u]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(Ta(t[i]/255)*255):t[i]=Ta(t[i]);return{data:t,width:e.width,height:e.height}}else return Bt("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let U$=0;class uy{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:U$++}),this.uuid=sh(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let l;if(Array.isArray(r)){l=[];for(let u=0,h=r.length;u<h;u++)r[u].isDataTexture?l.push(Tx(r[u].image)):l.push(Tx(r[u]))}else l=Tx(r);i.url=l}return t||(e.images[this.uuid]=i),i}}function Tx(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?D$.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(Bt("Texture: Unable to serialize Texture."),{})}let I$=0;const Mx=new Ne;class Yi extends su{constructor(e=Yi.DEFAULT_IMAGE,t=Yi.DEFAULT_MAPPING,i=Sa,r=Sa,l=zi,u=ol,h=hr,d=Ws,p=Yi.DEFAULT_ANISOTROPY,m=go){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:I$++}),this.uuid=sh(),this.name="",this.source=new uy(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=l,this.minFilter=u,this.anisotropy=p,this.format=h,this.internalFormat=null,this.type=d,this.offset=new Cn(0,0),this.repeat=new Cn(1,1),this.center=new Cn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Gt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=m,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Mx).x}get height(){return this.source.getSize(Mx).y}get depth(){return this.source.getSize(Mx).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const i=e[t];if(i===void 0){Bt(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Bt(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==oC)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ab:e.x=e.x-Math.floor(e.x);break;case Sa:e.x=e.x<0?0:1;break;case ob:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ab:e.y=e.y-Math.floor(e.y);break;case Sa:e.y=e.y<0?0:1;break;case ob:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Yi.DEFAULT_IMAGE=null;Yi.DEFAULT_MAPPING=oC;Yi.DEFAULT_ANISOTROPY=1;class Kn{constructor(e=0,t=0,i=0,r=1){Kn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,l=this.w,u=e.elements;return this.x=u[0]*t+u[4]*i+u[8]*r+u[12]*l,this.y=u[1]*t+u[5]*i+u[9]*r+u[13]*l,this.z=u[2]*t+u[6]*i+u[10]*r+u[14]*l,this.w=u[3]*t+u[7]*i+u[11]*r+u[15]*l,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,l;const d=e.elements,p=d[0],m=d[4],g=d[8],b=d[1],y=d[5],_=d[9],C=d[2],w=d[6],S=d[10];if(Math.abs(m-b)<.01&&Math.abs(g-C)<.01&&Math.abs(_-w)<.01){if(Math.abs(m+b)<.1&&Math.abs(g+C)<.1&&Math.abs(_+w)<.1&&Math.abs(p+y+S-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const N=(p+1)/2,j=(y+1)/2,O=(S+1)/2,R=(m+b)/4,z=(g+C)/4,M=(_+w)/4;return N>j&&N>O?N<.01?(i=0,r=.707106781,l=.707106781):(i=Math.sqrt(N),r=R/i,l=z/i):j>O?j<.01?(i=.707106781,r=0,l=.707106781):(r=Math.sqrt(j),i=R/r,l=M/r):O<.01?(i=.707106781,r=.707106781,l=0):(l=Math.sqrt(O),i=z/l,r=M/l),this.set(i,r,l,t),this}let T=Math.sqrt((w-_)*(w-_)+(g-C)*(g-C)+(b-m)*(b-m));return Math.abs(T)<.001&&(T=1),this.x=(w-_)/T,this.y=(g-C)/T,this.z=(b-m)/T,this.w=Math.acos((p+y+S-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=sn(this.x,e.x,t.x),this.y=sn(this.y,e.y,t.y),this.z=sn(this.z,e.z,t.z),this.w=sn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=sn(this.x,e,t),this.y=sn(this.y,e,t),this.z=sn(this.z,e,t),this.w=sn(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(sn(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class z$ extends su{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:zi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new Kn(0,0,e,t),this.scissorTest=!1,this.viewport=new Kn(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:i.depth},l=new Yi(r),u=i.count;for(let h=0;h<u;h++)this.textures[h]=l.clone(),this.textures[h].isRenderTargetTexture=!0,this.textures[h].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const t={minFilter:zi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,l=this.textures.length;r<l;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new uy(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ur extends z${constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class gC extends Yi{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Ri,this.minFilter=Ri,this.wrapR=Sa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class $$ extends Yi{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Ri,this.minFilter=Ri,this.wrapR=Sa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class hi{constructor(e,t,i,r,l,u,h,d,p,m,g,b,y,_,C,w){hi.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,l,u,h,d,p,m,g,b,y,_,C,w)}set(e,t,i,r,l,u,h,d,p,m,g,b,y,_,C,w){const S=this.elements;return S[0]=e,S[4]=t,S[8]=i,S[12]=r,S[1]=l,S[5]=u,S[9]=h,S[13]=d,S[2]=p,S[6]=m,S[10]=g,S[14]=b,S[3]=y,S[7]=_,S[11]=C,S[15]=w,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new hi().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,i=e.elements,r=1/lc.setFromMatrixColumn(e,0).length(),l=1/lc.setFromMatrixColumn(e,1).length(),u=1/lc.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*l,t[5]=i[5]*l,t[6]=i[6]*l,t[7]=0,t[8]=i[8]*u,t[9]=i[9]*u,t[10]=i[10]*u,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,l=e.z,u=Math.cos(i),h=Math.sin(i),d=Math.cos(r),p=Math.sin(r),m=Math.cos(l),g=Math.sin(l);if(e.order==="XYZ"){const b=u*m,y=u*g,_=h*m,C=h*g;t[0]=d*m,t[4]=-d*g,t[8]=p,t[1]=y+_*p,t[5]=b-C*p,t[9]=-h*d,t[2]=C-b*p,t[6]=_+y*p,t[10]=u*d}else if(e.order==="YXZ"){const b=d*m,y=d*g,_=p*m,C=p*g;t[0]=b+C*h,t[4]=_*h-y,t[8]=u*p,t[1]=u*g,t[5]=u*m,t[9]=-h,t[2]=y*h-_,t[6]=C+b*h,t[10]=u*d}else if(e.order==="ZXY"){const b=d*m,y=d*g,_=p*m,C=p*g;t[0]=b-C*h,t[4]=-u*g,t[8]=_+y*h,t[1]=y+_*h,t[5]=u*m,t[9]=C-b*h,t[2]=-u*p,t[6]=h,t[10]=u*d}else if(e.order==="ZYX"){const b=u*m,y=u*g,_=h*m,C=h*g;t[0]=d*m,t[4]=_*p-y,t[8]=b*p+C,t[1]=d*g,t[5]=C*p+b,t[9]=y*p-_,t[2]=-p,t[6]=h*d,t[10]=u*d}else if(e.order==="YZX"){const b=u*d,y=u*p,_=h*d,C=h*p;t[0]=d*m,t[4]=C-b*g,t[8]=_*g+y,t[1]=g,t[5]=u*m,t[9]=-h*m,t[2]=-p*m,t[6]=y*g+_,t[10]=b-C*g}else if(e.order==="XZY"){const b=u*d,y=u*p,_=h*d,C=h*p;t[0]=d*m,t[4]=-g,t[8]=p*m,t[1]=b*g+C,t[5]=u*m,t[9]=y*g-_,t[2]=_*g-y,t[6]=h*m,t[10]=C*g+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(F$,e,B$)}lookAt(e,t,i){const r=this.elements;return vs.subVectors(e,t),vs.lengthSq()===0&&(vs.z=1),vs.normalize(),so.crossVectors(i,vs),so.lengthSq()===0&&(Math.abs(i.z)===1?vs.x+=1e-4:vs.z+=1e-4,vs.normalize(),so.crossVectors(i,vs)),so.normalize(),Vf.crossVectors(vs,so),r[0]=so.x,r[4]=Vf.x,r[8]=vs.x,r[1]=so.y,r[5]=Vf.y,r[9]=vs.y,r[2]=so.z,r[6]=Vf.z,r[10]=vs.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,l=this.elements,u=i[0],h=i[4],d=i[8],p=i[12],m=i[1],g=i[5],b=i[9],y=i[13],_=i[2],C=i[6],w=i[10],S=i[14],T=i[3],N=i[7],j=i[11],O=i[15],R=r[0],z=r[4],M=r[8],P=r[12],G=r[1],U=r[5],Y=r[9],W=r[13],J=r[2],F=r[6],$=r[10],V=r[14],se=r[3],ue=r[7],Ce=r[11],D=r[15];
vendor: 4,349 bytes, line 79
79return l[0]=u*R+h*G+d*J+p*se,l[4]=u*z+h*U+d*F+p*ue,l[8]=u*M+h*Y+d*$+p*Ce,l[12]=u*P+h*W+d*V+p*D,l[1]=m*R+g*G+b*J+y*se,l[5]=m*z+g*U+b*F+y*ue,l[9]=m*M+g*Y+b*$+y*Ce,l[13]=m*P+g*W+b*V+y*D,l[2]=_*R+C*G+w*J+S*se,l[6]=_*z+C*U+w*F+S*ue,l[10]=_*M+C*Y+w*$+S*Ce,l[14]=_*P+C*W+w*V+S*D,l[3]=T*R+N*G+j*J+O*se,l[7]=T*z+N*U+j*F+O*ue,l[11]=T*M+N*Y+j*$+O*Ce,l[15]=T*P+N*W+j*V+O*D,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],l=e[12],u=e[1],h=e[5],d=e[9],p=e[13],m=e[2],g=e[6],b=e[10],y=e[14],_=e[3],C=e[7],w=e[11],S=e[15],T=d*y-p*b,N=h*y-p*g,j=h*b-d*g,O=u*y-p*m,R=u*b-d*m,z=u*g-h*m;return t*(C*T-w*N+S*j)-i*(_*T-w*O+S*R)+r*(_*N-C*O+S*z)-l*(_*j-C*R+w*z)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],l=e[3],u=e[4],h=e[5],d=e[6],p=e[7],m=e[8],g=e[9],b=e[10],y=e[11],_=e[12],C=e[13],w=e[14],S=e[15],T=t*h-i*u,N=t*d-r*u,j=t*p-l*u,O=i*d-r*h,R=i*p-l*h,z=r*p-l*d,M=m*C-g*_,P=m*w-b*_,G=m*S-y*_,U=g*w-b*C,Y=g*S-y*C,W=b*S-y*w,J=T*W-N*Y+j*U+O*G-R*P+z*M;if(J===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const F=1/J;return e[0]=(h*W-d*Y+p*U)*F,e[1]=(r*Y-i*W-l*U)*F,e[2]=(C*z-w*R+S*O)*F,e[3]=(b*R-g*z-y*O)*F,e[4]=(d*G-u*W-p*P)*F,e[5]=(t*W-r*G+l*P)*F,e[6]=(w*j-_*z-S*N)*F,e[7]=(m*z-b*j+y*N)*F,e[8]=(u*Y-h*G+p*M)*F,e[9]=(i*G-t*Y-l*M)*F,e[10]=(_*R-C*j+S*T)*F,e[11]=(g*j-m*R-y*T)*F,e[12]=(h*P-u*U-d*M)*F,e[13]=(t*U-i*P+r*M)*F,e[14]=(C*N-_*O-w*T)*F,e[15]=(m*O-g*N+b*T)*F,this}scale(e){const t=this.elements,i=e.x,r=e.y,l=e.z;return t[0]*=i,t[4]*=r,t[8]*=l,t[1]*=i,t[5]*=r,t[9]*=l,t[2]*=i,t[6]*=r,t[10]*=l,t[3]*=i,t[7]*=r,t[11]*=l,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),l=1-i,u=e.x,h=e.y,d=e.z,p=l*u,m=l*h;return this.set(p*u+i,p*h-r*d,p*d+r*h,0,p*h+r*d,m*h+i,m*d-r*u,0,p*d-r*h,m*d+r*u,l*d*d+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,l,u){return this.set(1,i,l,0,e,1,u,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,l=t._x,u=t._y,h=t._z,d=t._w,p=l+l,m=u+u,g=h+h,b=l*p,y=l*m,_=l*g,C=u*m,w=u*g,S=h*g,T=d*p,N=d*m,j=d*g,O=i.x,R=i.y,z=i.z;return r[0]=(1-(C+S))*O,r[1]=(y+j)*O,r[2]=(_-N)*O,r[3]=0,r[4]=(y-j)*R,r[5]=(1-(b+S))*R,r[6]=(w+T)*R,r[7]=0,r[8]=(_+N)*z,r[9]=(w-T)*z,r[10]=(1-(b+C))*z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const l=this.determinant();if(l===0)return i.set(1,1,1),t.identity(),this;let u=lc.set(r[0],r[1],r[2]).length();const h=lc.set(r[4],r[5],r[6]).length(),d=lc.set(r[8],r[9],r[10]).length();l<0&&(u=-u),nr.copy(this);const p=1/u,m=1/h,g=1/d;return nr.elements[0]*=p,nr.elements[1]*=p,nr.elements[2]*=p,nr.elements[4]*=m,nr.elements[5]*=m,nr.elements[6]*=m,nr.elements[8]*=g,nr.elements[9]*=g,nr.elements[10]*=g,t.setFromRotationMatrix(nr),i.x=u,i.y=h,i.z=d,this}makePerspective(e,t,i,r,l,u,h=jr,d=!1){const p=this.elements,m=2*l/(t-e),g=2*l/(i-r),b=(t+e)/(t-e),y=(i+r)/(i-r);let _,C;if(d)_=l/(u-l),C=u*l/(u-l);else if(h===jr)_=-(u+l)/(u-l),C=-2*u*l/(u-l);else if(h===Xp)_=-u/(u-l),C=-u*l/(u-l);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+h);return p[0]=m,p[4]=0,p[8]=b,p[12]=0,p[1]=0,p[5]=g,p[9]=y,p[13]=0,p[2]=0,p[6]=0,p[10]=_,p[14]=C,p[3]=0,p[7]=0,p[11]=-1,p[15]=0,this}
vendor: 35,926 bytes, line 79
79makeOrthographic(e,t,i,r,l,u,h=jr,d=!1){const p=this.elements,m=2/(t-e),g=2/(i-r),b=-(t+e)/(t-e),y=-(i+r)/(i-r);let _,C;if(d)_=1/(u-l),C=u/(u-l);else if(h===jr)_=-2/(u-l),C=-(u+l)/(u-l);else if(h===Xp)_=-1/(u-l),C=-l/(u-l);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+h);return p[0]=m,p[4]=0,p[8]=0,p[12]=b,p[1]=0,p[5]=g,p[9]=0,p[13]=y,p[2]=0,p[6]=0,p[10]=_,p[14]=C,p[3]=0,p[7]=0,p[11]=0,p[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const lc=new Ne,nr=new hi,F$=new Ne(0,0,0),B$=new Ne(1,1,1),so=new Ne,Vf=new Ne,vs=new Ne,lE=new hi,cE=new ru;class ja{constructor(e=0,t=0,i=0,r=ja.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,l=r[0],u=r[4],h=r[8],d=r[1],p=r[5],m=r[9],g=r[2],b=r[6],y=r[10];switch(t){case"XYZ":this._y=Math.asin(sn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-m,y),this._z=Math.atan2(-u,l)):(this._x=Math.atan2(b,p),this._z=0);break;case"YXZ":this._x=Math.asin(-sn(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(h,y),this._z=Math.atan2(d,p)):(this._y=Math.atan2(-g,l),this._z=0);break;case"ZXY":this._x=Math.asin(sn(b,-1,1)),Math.abs(b)<.9999999?(this._y=Math.atan2(-g,y),this._z=Math.atan2(-u,p)):(this._y=0,this._z=Math.atan2(d,l));break;case"ZYX":this._y=Math.asin(-sn(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(b,y),this._z=Math.atan2(d,l)):(this._x=0,this._z=Math.atan2(-u,p));break;case"YZX":this._z=Math.asin(sn(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(-m,p),this._y=Math.atan2(-g,l)):(this._x=0,this._y=Math.atan2(h,y));break;case"XZY":this._z=Math.asin(-sn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(b,p),this._y=Math.atan2(h,l)):(this._x=Math.atan2(-m,y),this._y=0);break;default:Bt("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return lE.makeRotationFromQuaternion(e),this.setFromRotationMatrix(lE,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return cE.setFromEuler(this),this.setFromQuaternion(cE,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ja.DEFAULT_ORDER="XYZ";class xC{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let H$=0;const uE=new Ne,cc=new ru,pa=new hi,Gf=new Ne,od=new Ne,V$=new Ne,G$=new ru,dE=new Ne(1,0,0),hE=new Ne(0,1,0),fE=new Ne(0,0,1),pE={type:"added"},q$={type:"removed"},uc={type:"childadded",child:null},Ax={type:"childremoved",child:null};class Rs extends su{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:H$++}),this.uuid=sh(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Rs.DEFAULT_UP.clone();const e=new Ne,t=new ja,i=new ru,r=new Ne(1,1,1);function l(){i.setFromEuler(t,!1)}function u(){t.setFromQuaternion(i,void 0,!1)}t._onChange(l),i._onChange(u),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new hi},normalMatrix:{value:new Gt}}),this.matrix=new hi,this.matrixWorld=new hi,this.matrixAutoUpdate=Rs.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Rs.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new xC,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return cc.setFromAxisAngle(e,t),this.quaternion.multiply(cc),this}rotateOnWorldAxis(e,t){return cc.setFromAxisAngle(e,t),this.quaternion.premultiply(cc),this}rotateX(e){return this.rotateOnAxis(dE,e)}rotateY(e){return this.rotateOnAxis(hE,e)}rotateZ(e){return this.rotateOnAxis(fE,e)}translateOnAxis(e,t){return uE.copy(e).applyQuaternion(this.quaternion),this.position.add(uE.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(dE,e)}translateY(e){return this.translateOnAxis(hE,e)}translateZ(e){return this.translateOnAxis(fE,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(pa.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Gf.copy(e):Gf.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),od.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?pa.lookAt(od,Gf,this.up):pa.lookAt(Gf,od,this.up),this.quaternion.setFromRotationMatrix(pa),r&&(pa.extractRotation(r.matrixWorld),cc.setFromRotationMatrix(pa),this.quaternion.premultiply(cc.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(hn("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(pE),uc.child=e,this.dispatchEvent(uc),uc.child=null):hn("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(q$),Ax.child=e,this.dispatchEvent(Ax),Ax.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),pa.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),pa.multiply(e.parent.matrixWorld)),e.applyMatrix4(pa),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(pE),uc.child=e,this.dispatchEvent(uc),uc.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const u=this.children[i].getObjectByProperty(e,t);if(u!==void 0)return u}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let l=0,u=r.length;l<u;l++)r[l].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(od,e,V$),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(od,G$,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,i=e.y,r=e.z,l=this.matrix.elements;l[12]+=t-l[0]*t-l[4]*i-l[8]*r,l[13]+=i-l[1]*t-l[5]*i-l[9]*r,l[14]+=r-l[2]*t-l[6]*i-l[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let l=0,u=r.length;l<u;l++)r[l].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(h=>({...h,boundingBox:h.boundingBox?h.boundingBox.toJSON():void 0,boundingSphere:h.boundingSphere?h.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(h=>({...h})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function l(h,d){return h[d.uuid]===void 0&&(h[d.uuid]=d.toJSON(e)),d.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=l(e.geometries,this.geometry);const h=this.geometry.parameters;if(h!==void 0&&h.shapes!==void 0){const d=h.shapes;if(Array.isArray(d))for(let p=0,m=d.length;p<m;p++){const g=d[p];l(e.shapes,g)}else l(e.shapes,d)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(l(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const h=[];for(let d=0,p=this.material.length;d<p;d++)h.push(l(e.materials,this.material[d]));r.material=h}else r.material=l(e.materials,this.material);if(this.children.length>0){r.children=[];for(let h=0;h<this.children.length;h++)r.children.push(this.children[h].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let h=0;h<this.animations.length;h++){const d=this.animations[h];r.animations.push(l(e.animations,d))}}if(t){const h=u(e.geometries),d=u(e.materials),p=u(e.textures),m=u(e.images),g=u(e.shapes),b=u(e.skeletons),y=u(e.animations),_=u(e.nodes);h.length>0&&(i.geometries=h),d.length>0&&(i.materials=d),p.length>0&&(i.textures=p),m.length>0&&(i.images=m),g.length>0&&(i.shapes=g),b.length>0&&(i.skeletons=b),y.length>0&&(i.animations=y),_.length>0&&(i.nodes=_)}return i.object=r,i;function u(h){const d=[];for(const p in h){const m=h[p];delete m.metadata,d.push(m)}return d}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}Rs.DEFAULT_UP=new Ne(0,1,0);Rs.DEFAULT_MATRIX_AUTO_UPDATE=!0;Rs.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class qf extends Rs{constructor(){super(),this.isGroup=!0,this.type="Group"}}const W$={type:"move"};class Rx{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new qf,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new qf,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ne,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ne),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new qf,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ne,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ne),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,l=null,u=null;const h=this._targetRay,d=this._grip,p=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(p&&e.hand){u=!0;for(const C of e.hand.values()){const w=t.getJointPose(C,i),S=this._getHandJoint(p,C);w!==null&&(S.matrix.fromArray(w.transform.matrix),S.matrix.decompose(S.position,S.rotation,S.scale),S.matrixWorldNeedsUpdate=!0,S.jointRadius=w.radius),S.visible=w!==null}const m=p.joints["index-finger-tip"],g=p.joints["thumb-tip"],b=m.position.distanceTo(g.position),y=.02,_=.005;p.inputState.pinching&&b>y+_?(p.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!p.inputState.pinching&&b<=y-_&&(p.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else d!==null&&e.gripSpace&&(l=t.getPose(e.gripSpace,i),l!==null&&(d.matrix.fromArray(l.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,l.linearVelocity?(d.hasLinearVelocity=!0,d.linearVelocity.copy(l.linearVelocity)):d.hasLinearVelocity=!1,l.angularVelocity?(d.hasAngularVelocity=!0,d.angularVelocity.copy(l.angularVelocity)):d.hasAngularVelocity=!1));h!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&l!==null&&(r=l),r!==null&&(h.matrix.fromArray(r.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,r.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(r.linearVelocity)):h.hasLinearVelocity=!1,r.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(r.angularVelocity)):h.hasAngularVelocity=!1,this.dispatchEvent(W$)))}return h!==null&&(h.visible=r!==null),d!==null&&(d.visible=l!==null),p!==null&&(p.visible=u!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new qf;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const bC={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ro={h:0,s:0,l:0},Wf={h:0,s:0,l:0};function kx(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class _n{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Gs){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,cn.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=cn.workingColorSpace){return this.r=e,this.g=t,this.b=i,cn.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=cn.workingColorSpace){if(e=P$(e,1),t=sn(t,0,1),i=sn(i,0,1),t===0)this.r=this.g=this.b=i;else{const l=i<=.5?i*(1+t):i+t-i*t,u=2*i-l;this.r=kx(u,l,e+1/3),this.g=kx(u,l,e),this.b=kx(u,l,e-1/3)}return cn.colorSpaceToWorking(this,r),this}setStyle(e,t=Gs){function i(l){l!==void 0&&parseFloat(l)<1&&Bt("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let l;const u=r[1],h=r[2];switch(u){case"rgb":case"rgba":if(l=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(h))return i(l[4]),this.setRGB(Math.min(255,parseInt(l[1],10))/255,Math.min(255,parseInt(l[2],10))/255,Math.min(255,parseInt(l[3],10))/255,t);if(l=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(h))return i(l[4]),this.setRGB(Math.min(100,parseInt(l[1],10))/100,Math.min(100,parseInt(l[2],10))/100,Math.min(100,parseInt(l[3],10))/100,t);break;case"hsl":case"hsla":if(l=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(h))return i(l[4]),this.setHSL(parseFloat(l[1])/360,parseFloat(l[2])/100,parseFloat(l[3])/100,t);break;default:Bt("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const l=r[1],u=l.length;if(u===3)return this.setRGB(parseInt(l.charAt(0),16)/15,parseInt(l.charAt(1),16)/15,parseInt(l.charAt(2),16)/15,t);if(u===6)return this.setHex(parseInt(l,16),t);Bt("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Gs){const i=bC[e.toLowerCase()];return i!==void 0?this.setHex(i,t):Bt("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Ta(e.r),this.g=Ta(e.g),this.b=Ta(e.b),this}copyLinearToSRGB(e){return this.r=jc(e.r),this.g=jc(e.g),this.b=jc(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Gs){return cn.workingToColorSpace(Ui.copy(this),e),Math.round(sn(Ui.r*255,0,255))*65536+Math.round(sn(Ui.g*255,0,255))*256+Math.round(sn(Ui.b*255,0,255))}getHexString(e=Gs){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=cn.workingColorSpace){cn.workingToColorSpace(Ui.copy(this),t);const i=Ui.r,r=Ui.g,l=Ui.b,u=Math.max(i,r,l),h=Math.min(i,r,l);let d,p;const m=(h+u)/2;if(h===u)d=0,p=0;else{const g=u-h;switch(p=m<=.5?g/(u+h):g/(2-u-h),u){case i:d=(r-l)/g+(r<l?6:0);break;case r:d=(l-i)/g+2;break;case l:d=(i-r)/g+4;break}d/=6}return e.h=d,e.s=p,e.l=m,e}getRGB(e,t=cn.workingColorSpace){return cn.workingToColorSpace(Ui.copy(this),t),e.r=Ui.r,e.g=Ui.g,e.b=Ui.b,e}getStyle(e=Gs){cn.workingToColorSpace(Ui.copy(this),e);const t=Ui.r,i=Ui.g,r=Ui.b;return e!==Gs?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(ro),this.setHSL(ro.h+e,ro.s+t,ro.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(ro),e.getHSL(Wf);const i=Ex(ro.h,Wf.h,t),r=Ex(ro.s,Wf.s,t),l=Ex(ro.l,Wf.l,t);return this.setHSL(i,r,l),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,l=e.elements;return this.r=l[0]*t+l[3]*i+l[6]*r,this.g=l[1]*t+l[4]*i+l[7]*r,this.b=l[2]*t+l[5]*i+l[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Ui=new _n;_n.NAMES=bC;class X$ extends Rs{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new ja,this.environmentIntensity=1,this.environmentRotation=new ja,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const ir=new Ne,ma=new Ne,jx=new Ne,ga=new Ne,dc=new Ne,hc=new Ne,mE=new Ne,Lx=new Ne,Px=new Ne,Ox=new Ne,Dx=new Kn,Ux=new Kn,Ix=new Kn;class dr{constructor(e=new Ne,t=new Ne,i=new Ne){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),ir.subVectors(e,t),r.cross(ir);const l=r.lengthSq();return l>0?r.multiplyScalar(1/Math.sqrt(l)):r.set(0,0,0)}static getBarycoord(e,t,i,r,l){ir.subVectors(r,t),ma.subVectors(i,t),jx.subVectors(e,t);const u=ir.dot(ir),h=ir.dot(ma),d=ir.dot(jx),p=ma.dot(ma),m=ma.dot(jx),g=u*p-h*h;if(g===0)return l.set(0,0,0),null;const b=1/g,y=(p*d-h*m)*b,_=(u*m-h*d)*b;return l.set(1-y-_,_,y)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,ga)===null?!1:ga.x>=0&&ga.y>=0&&ga.x+ga.y<=1}static getInterpolation(e,t,i,r,l,u,h,d){return this.getBarycoord(e,t,i,r,ga)===null?(d.x=0,d.y=0,"z"in d&&(d.z=0),"w"in d&&(d.w=0),null):(d.setScalar(0),d.addScaledVector(l,ga.x),d.addScaledVector(u,ga.y),d.addScaledVector(h,ga.z),d)}static getInterpolatedAttribute(e,t,i,r,l,u){return Dx.setScalar(0),Ux.setScalar(0),Ix.setScalar(0),Dx.fromBufferAttribute(e,t),Ux.fromBufferAttribute(e,i),Ix.fromBufferAttribute(e,r),u.setScalar(0),u.addScaledVector(Dx,l.x),u.addScaledVector(Ux,l.y),u.addScaledVector(Ix,l.z),u}static isFrontFacing(e,t,i,r){return ir.subVectors(i,t),ma.subVectors(e,t),ir.cross(ma).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ir.subVectors(this.c,this.b),ma.subVectors(this.a,this.b),ir.cross(ma).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return dr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return dr.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,l){return dr.getInterpolation(e,this.a,this.b,this.c,t,i,r,l)}containsPoint(e){return dr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return dr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,l=this.c;let u,h;dc.subVectors(r,i),hc.subVectors(l,i),Lx.subVectors(e,i);const d=dc.dot(Lx),p=hc.dot(Lx);if(d<=0&&p<=0)return t.copy(i);Px.subVectors(e,r);const m=dc.dot(Px),g=hc.dot(Px);if(m>=0&&g<=m)return t.copy(r);const b=d*g-m*p;if(b<=0&&d>=0&&m<=0)return u=d/(d-m),t.copy(i).addScaledVector(dc,u);Ox.subVectors(e,l);const y=dc.dot(Ox),_=hc.dot(Ox);if(_>=0&&y<=_)return t.copy(l);const C=y*p-d*_;if(C<=0&&p>=0&&_<=0)return h=p/(p-_),t.copy(i).addScaledVector(hc,h);const w=m*_-y*g;if(w<=0&&g-m>=0&&y-_>=0)return mE.subVectors(l,r),h=(g-m)/(g-m+(y-_)),t.copy(r).addScaledVector(mE,h);const S=1/(w+C+b);return u=C*S,h=b*S,t.copy(i).addScaledVector(dc,u).addScaledVector(hc,h)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class rh{constructor(e=new Ne(1/0,1/0,1/0),t=new Ne(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(sr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(sr.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=sr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const l=i.getAttribute("position");if(t===!0&&l!==void 0&&e.isInstancedMesh!==!0)for(let u=0,h=l.count;u<h;u++)e.isMesh===!0?e.getVertexPosition(u,sr):sr.fromBufferAttribute(l,u),sr.applyMatrix4(e.matrixWorld),this.expandByPoint(sr);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Xf.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Xf.copy(i.boundingBox)),Xf.applyMatrix4(e.matrixWorld),this.union(Xf)}const r=e.children;for(let l=0,u=r.length;l<u;l++)this.expandByObject(r[l],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,sr),sr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ld),Yf.subVectors(this.max,ld),fc.subVectors(e.a,ld),pc.subVectors(e.b,ld),mc.subVectors(e.c,ld),ao.subVectors(pc,fc),oo.subVectors(mc,pc),Wo.subVectors(fc,mc);let t=[0,-ao.z,ao.y,0,-oo.z,oo.y,0,-Wo.z,Wo.y,ao.z,0,-ao.x,oo.z,0,-oo.x,Wo.z,0,-Wo.x,-ao.y,ao.x,0,-oo.y,oo.x,0,-Wo.y,Wo.x,0];return!zx(t,fc,pc,mc,Yf)||(t=[1,0,0,0,1,0,0,0,1],!zx(t,fc,pc,mc,Yf))?!1:(Kf.crossVectors(ao,oo),t=[Kf.x,Kf.y,Kf.z],zx(t,fc,pc,mc,Yf))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,sr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(sr).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(xa[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),xa[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),xa[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),xa[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),xa[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),xa[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),xa[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),xa[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(xa),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}
vendor: 4,181 bytes, line 79
79const xa=[new Ne,new Ne,new Ne,new Ne,new Ne,new Ne,new Ne,new Ne],sr=new Ne,Xf=new rh,fc=new Ne,pc=new Ne,mc=new Ne,ao=new Ne,oo=new Ne,Wo=new Ne,ld=new Ne,Yf=new Ne,Kf=new Ne,Xo=new Ne;function zx(n,e,t,i,r){for(let l=0,u=n.length-3;l<=u;l+=3){Xo.fromArray(n,l);const h=r.x*Math.abs(Xo.x)+r.y*Math.abs(Xo.y)+r.z*Math.abs(Xo.z),d=e.dot(Xo),p=t.dot(Xo),m=i.dot(Xo);if(Math.max(-Math.max(d,p,m),Math.min(d,p,m))>h)return!1}return!0}const ai=new Ne,Zf=new Cn;let Y$=0;class gr{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Y$++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=tE,this.updateRanges=[],this.gpuType=kr,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,l=this.itemSize;r<l;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Zf.fromBufferAttribute(this,t),Zf.applyMatrix3(e),this.setXY(t,Zf.x,Zf.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)ai.fromBufferAttribute(this,t),ai.applyMatrix3(e),this.setXYZ(t,ai.x,ai.y,ai.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)ai.fromBufferAttribute(this,t),ai.applyMatrix4(e),this.setXYZ(t,ai.x,ai.y,ai.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)ai.fromBufferAttribute(this,t),ai.applyNormalMatrix(e),this.setXYZ(t,ai.x,ai.y,ai.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)ai.fromBufferAttribute(this,t),ai.transformDirection(e),this.setXYZ(t,ai.x,ai.y,ai.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=ad(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=ss(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ad(t,this.array)),t}setX(e,t){return this.normalized&&(t=ss(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ad(t,this.array)),t}setY(e,t){return this.normalized&&(t=ss(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=ad(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ss(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=ad(t,this.array)),t}setW(e,t){return this.normalized&&(t=ss(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=ss(t,this.array),i=ss(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=ss(t,this.array),i=ss(i,this.array),r=ss(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,l){return e*=this.itemSize,this.normalized&&(t=ss(t,this.array),i=ss(i,this.array),r=ss(r,this.array),l=ss(l,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=l,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==tE&&(e.usage=this.usage),e}}class vC extends gr{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class yC extends gr{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class Ma extends gr{constructor(e,t,i){super(new Float32Array(e),t,i)}}
vendor: 14,251 bytes, line 79
79const K$=new rh,cd=new Ne,$x=new Ne;class dy{constructor(e=new Ne,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):K$.setFromPoints(e).getCenter(i);let r=0;for(let l=0,u=e.length;l<u;l++)r=Math.max(r,i.distanceToSquared(e[l]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;cd.subVectors(e,this.center);const t=cd.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(cd,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):($x.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(cd.copy(e.center).add($x)),this.expandByPoint(cd.copy(e.center).sub($x))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let Z$=0;const Bs=new hi,Fx=new Rs,gc=new Ne,ys=new rh,ud=new rh,_i=new Ne;class Xr extends su{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Z$++}),this.uuid=sh(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(R$(e)?yC:vC)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const l=new Gt().getNormalMatrix(e);i.applyNormalMatrix(l),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Bs.makeRotationFromQuaternion(e),this.applyMatrix4(Bs),this}rotateX(e){return Bs.makeRotationX(e),this.applyMatrix4(Bs),this}rotateY(e){return Bs.makeRotationY(e),this.applyMatrix4(Bs),this}rotateZ(e){return Bs.makeRotationZ(e),this.applyMatrix4(Bs),this}translate(e,t,i){return Bs.makeTranslation(e,t,i),this.applyMatrix4(Bs),this}scale(e,t,i){return Bs.makeScale(e,t,i),this.applyMatrix4(Bs),this}lookAt(e){return Fx.lookAt(e),Fx.updateMatrix(),this.applyMatrix4(Fx.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(gc).negate(),this.translate(gc.x,gc.y,gc.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let r=0,l=e.length;r<l;r++){const u=e[r];i.push(u.x,u.y,u.z||0)}this.setAttribute("position",new Ma(i,3))}else{const i=Math.min(e.length,t.count);for(let r=0;r<i;r++){const l=e[r];t.setXYZ(r,l.x,l.y,l.z||0)}e.length>t.count&&Bt("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new rh);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){hn("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Ne(-1/0,-1/0,-1/0),new Ne(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const l=t[i];ys.setFromBufferAttribute(l),this.morphTargetsRelative?(_i.addVectors(this.boundingBox.min,ys.min),this.boundingBox.expandByPoint(_i),_i.addVectors(this.boundingBox.max,ys.max),this.boundingBox.expandByPoint(_i)):(this.boundingBox.expandByPoint(ys.min),this.boundingBox.expandByPoint(ys.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&hn('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new dy);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){hn("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Ne,1/0);return}if(e){const i=this.boundingSphere.center;if(ys.setFromBufferAttribute(e),t)for(let l=0,u=t.length;l<u;l++){const h=t[l];ud.setFromBufferAttribute(h),this.morphTargetsRelative?(_i.addVectors(ys.min,ud.min),ys.expandByPoint(_i),_i.addVectors(ys.max,ud.max),ys.expandByPoint(_i)):(ys.expandByPoint(ud.min),ys.expandByPoint(ud.max))}ys.getCenter(i);let r=0;for(let l=0,u=e.count;l<u;l++)_i.fromBufferAttribute(e,l),r=Math.max(r,i.distanceToSquared(_i));if(t)for(let l=0,u=t.length;l<u;l++){const h=t[l],d=this.morphTargetsRelative;for(let p=0,m=h.count;p<m;p++)_i.fromBufferAttribute(h,p),d&&(gc.fromBufferAttribute(e,p),_i.add(gc)),r=Math.max(r,i.distanceToSquared(_i))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&hn('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){hn("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,l=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new gr(new Float32Array(4*i.count),4));const u=this.getAttribute("tangent"),h=[],d=[];for(let M=0;M<i.count;M++)h[M]=new Ne,d[M]=new Ne;const p=new Ne,m=new Ne,g=new Ne,b=new Cn,y=new Cn,_=new Cn,C=new Ne,w=new Ne;function S(M,P,G){p.fromBufferAttribute(i,M),m.fromBufferAttribute(i,P),g.fromBufferAttribute(i,G),b.fromBufferAttribute(l,M),y.fromBufferAttribute(l,P),_.fromBufferAttribute(l,G),m.sub(p),g.sub(p),y.sub(b),_.sub(b);const U=1/(y.x*_.y-_.x*y.y);isFinite(U)&&(C.copy(m).multiplyScalar(_.y).addScaledVector(g,-y.y).multiplyScalar(U),w.copy(g).multiplyScalar(y.x).addScaledVector(m,-_.x).multiplyScalar(U),h[M].add(C),h[P].add(C),h[G].add(C),d[M].add(w),d[P].add(w),d[G].add(w))}let T=this.groups;T.length===0&&(T=[{start:0,count:e.count}]);for(let M=0,P=T.length;M<P;++M){const G=T[M],U=G.start,Y=G.count;for(let W=U,J=U+Y;W<J;W+=3)S(e.getX(W+0),e.getX(W+1),e.getX(W+2))}const N=new Ne,j=new Ne,O=new Ne,R=new Ne;function z(M){O.fromBufferAttribute(r,M),R.copy(O);const P=h[M];N.copy(P),N.sub(O.multiplyScalar(O.dot(P))).normalize(),j.crossVectors(R,P);const U=j.dot(d[M])<0?-1:1;u.setXYZW(M,N.x,N.y,N.z,U)}for(let M=0,P=T.length;M<P;++M){const G=T[M],U=G.start,Y=G.count;for(let W=U,J=U+Y;W<J;W+=3)z(e.getX(W+0)),z(e.getX(W+1)),z(e.getX(W+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new gr(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let b=0,y=i.count;b<y;b++)i.setXYZ(b,0,0,0);const r=new Ne,l=new Ne,u=new Ne,h=new Ne,d=new Ne,p=new Ne,m=new Ne,g=new Ne;if(e)for(let b=0,y=e.count;b<y;b+=3){const _=e.getX(b+0),C=e.getX(b+1),w=e.getX(b+2);r.fromBufferAttribute(t,_),l.fromBufferAttribute(t,C),u.fromBufferAttribute(t,w),m.subVectors(u,l),g.subVectors(r,l),m.cross(g),h.fromBufferAttribute(i,_),d.fromBufferAttribute(i,C),p.fromBufferAttribute(i,w),h.add(m),d.add(m),p.add(m),i.setXYZ(_,h.x,h.y,h.z),i.setXYZ(C,d.x,d.y,d.z),i.setXYZ(w,p.x,p.y,p.z)}else for(let b=0,y=t.count;b<y;b+=3)r.fromBufferAttribute(t,b+0),l.fromBufferAttribute(t,b+1),u.fromBufferAttribute(t,b+2),m.subVectors(u,l),g.subVectors(r,l),m.cross(g),i.setXYZ(b+0,m.x,m.y,m.z),i.setXYZ(b+1,m.x,m.y,m.z),i.setXYZ(b+2,m.x,m.y,m.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)_i.fromBufferAttribute(e,t),_i.normalize(),e.setXYZ(t,_i.x,_i.y,_i.z)}toNonIndexed(){function e(h,d){const p=h.array,m=h.itemSize,g=h.normalized,b=new p.constructor(d.length*m);let y=0,_=0;for(let C=0,w=d.length;C<w;C++){h.isInterleavedBufferAttribute?y=d[C]*h.data.stride+h.offset:y=d[C]*m;for(let S=0;S<m;S++)b[_++]=p[y++]}return new gr(b,m,g)}if(this.index===null)return Bt("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Xr,i=this.index.array,r=this.attributes;for(const h in r){const d=r[h],p=e(d,i);t.setAttribute(h,p)}const l=this.morphAttributes;for(const h in l){const d=[],p=l[h];for(let m=0,g=p.length;m<g;m++){const b=p[m],y=e(b,i);d.push(y)}t.morphAttributes[h]=d}t.morphTargetsRelative=this.morphTargetsRelative;const u=this.groups;for(let h=0,d=u.length;h<d;h++){const p=u[h];t.addGroup(p.start,p.count,p.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const d=this.parameters;for(const p in d)d[p]!==void 0&&(e[p]=d[p]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const d in i){const p=i[d];e.data.attributes[d]=p.toJSON(e.data)}const r={};let l=!1;for(const d in this.morphAttributes){const p=this.morphAttributes[d],m=[];for(let g=0,b=p.length;g<b;g++){const y=p[g];m.push(y.toJSON(e.data))}m.length>0&&(r[d]=m,l=!0)}l&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const u=this.groups;u.length>0&&(e.data.groups=JSON.parse(JSON.stringify(u)));const h=this.boundingSphere;return h!==null&&(e.data.boundingSphere=h.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const r=e.attributes;for(const p in r){const m=r[p];this.setAttribute(p,m.clone(t))}const l=e.morphAttributes;for(const p in l){const m=[],g=l[p];for(let b=0,y=g.length;b<y;b++)m.push(g[b].clone(t));this.morphAttributes[p]=m}this.morphTargetsRelative=e.morphTargetsRelative;const u=e.groups;for(let p=0,m=u.length;p<m;p++){const g=u[p];this.addGroup(g.start,g.count,g.materialIndex)}const h=e.boundingBox;h!==null&&(this.boundingBox=h.clone());const d=e.boundingSphere;return d!==null&&(this.boundingSphere=d.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let Q$=0;class ah extends su{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Q$++}),this.uuid=sh(),this.name="",this.type="Material",this.blending=kc,this.side=So,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Z1,this.blendDst=Q1,this.blendEquation=il,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new _n(0,0,0),this.blendAlpha=0,this.depthFunc=zc,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=eE,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ac,this.stencilZFail=ac,this.stencilZPass=ac,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){Bt(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Bt(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 6,195 bytes, line 79
79i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==kc&&(i.blending=this.blending),this.side!==So&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Z1&&(i.blendSrc=this.blendSrc),this.blendDst!==Q1&&(i.blendDst=this.blendDst),this.blendEquation!==il&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==zc&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==eE&&
vendor: 5,251 bytes, line 79
79(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ac&&(i.stencilFail=this.stencilFail),this.stencilZFail!==ac&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==ac&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(l){const u=[];for(const h in l){const d=l[h];delete d.metadata,u.push(d)}return u}if(t){const l=r(e.textures),u=r(e.images);l.length>0&&(i.textures=l),u.length>0&&(i.images=u)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let l=0;l!==r;++l)i[l]=t[l].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const ba=new Ne,Bx=new Ne,Qf=new Ne,lo=new Ne,Hx=new Ne,Jf=new Ne,Vx=new Ne;class J${constructor(e=new Ne,t=new Ne(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ba)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ba.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ba.copy(this.origin).addScaledVector(this.direction,t),ba.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Bx.copy(e).add(t).multiplyScalar(.5),Qf.copy(t).sub(e).normalize(),lo.copy(this.origin).sub(Bx);const l=e.distanceTo(t)*.5,u=-this.direction.dot(Qf),h=lo.dot(this.direction),d=-lo.dot(Qf),p=lo.lengthSq(),m=Math.abs(1-u*u);let g,b,y,_;if(m>0)if(g=u*d-h,b=u*h-d,_=l*m,g>=0)if(b>=-_)if(b<=_){const C=1/m;g*=C,b*=C,y=g*(g+u*b+2*h)+b*(u*g+b+2*d)+p}else b=l,g=Math.max(0,-(u*b+h)),y=-g*g+b*(b+2*d)+p;else b=-l,g=Math.max(0,-(u*b+h)),y=-g*g+b*(b+2*d)+p;else b<=-_?(g=Math.max(0,-(-u*l+h)),b=g>0?-l:Math.min(Math.max(-l,-d),l),y=-g*g+b*(b+2*d)+p):b<=_?(g=0,b=Math.min(Math.max(-l,-d),l),y=b*(b+2*d)+p):(g=Math.max(0,-(u*l+h)),b=g>0?l:Math.min(Math.max(-l,-d),l),y=-g*g+b*(b+2*d)+p);else b=u>0?-l:l,g=Math.max(0,-(u*b+h)),y=-g*g+b*(b+2*d)+p;
vendor: 18,634 bytes, lines 79-83
79return i&&i.copy(this.origin).addScaledVector(this.direction,g),r&&r.copy(Bx).addScaledVector(Qf,b),y}intersectSphere(e,t){ba.subVectors(e.center,this.origin);const i=ba.dot(this.direction),r=ba.dot(ba)-i*i,l=e.radius*e.radius;if(r>l)return null;const u=Math.sqrt(l-r),h=i-u,d=i+u;return d<0?null:h<0?this.at(d,t):this.at(h,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,l,u,h,d;const p=1/this.direction.x,m=1/this.direction.y,g=1/this.direction.z,b=this.origin;return p>=0?(i=(e.min.x-b.x)*p,r=(e.max.x-b.x)*p):(i=(e.max.x-b.x)*p,r=(e.min.x-b.x)*p),m>=0?(l=(e.min.y-b.y)*m,u=(e.max.y-b.y)*m):(l=(e.max.y-b.y)*m,u=(e.min.y-b.y)*m),i>u||l>r||((l>i||isNaN(i))&&(i=l),(u<r||isNaN(r))&&(r=u),g>=0?(h=(e.min.z-b.z)*g,d=(e.max.z-b.z)*g):(h=(e.max.z-b.z)*g,d=(e.min.z-b.z)*g),i>d||h>r)||((h>i||i!==i)&&(i=h),(d<r||r!==r)&&(r=d),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,ba)!==null}intersectTriangle(e,t,i,r,l){Hx.subVectors(t,e),Jf.subVectors(i,e),Vx.crossVectors(Hx,Jf);let u=this.direction.dot(Vx),h;if(u>0){if(r)return null;h=1}else if(u<0)h=-1,u=-u;else return null;lo.subVectors(this.origin,e);const d=h*this.direction.dot(Jf.crossVectors(lo,Jf));if(d<0)return null;const p=h*this.direction.dot(Hx.cross(lo));if(p<0||d+p>u)return null;const m=-h*lo.dot(Vx);return m<0?null:this.at(m/u,l)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class _C extends ah{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new _n(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ja,this.combine=J4,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const gE=new hi,Yo=new J$,ep=new dy,xE=new Ne,tp=new Ne,np=new Ne,ip=new Ne,Gx=new Ne,sp=new Ne,bE=new Ne,rp=new Ne;class Vr extends Rs{constructor(e=new Xr,t=new _C){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let l=0,u=r.length;l<u;l++){const h=r[l].name||String(l);this.morphTargetInfluences.push(0),this.morphTargetDictionary[h]=l}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,l=i.morphAttributes.position,u=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const h=this.morphTargetInfluences;if(l&&h){sp.set(0,0,0);for(let d=0,p=l.length;d<p;d++){const m=h[d],g=l[d];m!==0&&(Gx.fromBufferAttribute(g,e),u?sp.addScaledVector(Gx,m):sp.addScaledVector(Gx.sub(t),m))}t.add(sp)}return t}raycast(e,t){const i=this.geometry,r=this.material,l=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),ep.copy(i.boundingSphere),ep.applyMatrix4(l),Yo.copy(e.ray).recast(e.near),!(ep.containsPoint(Yo.origin)===!1&&(Yo.intersectSphere(ep,xE)===null||Yo.origin.distanceToSquared(xE)>(e.far-e.near)**2))&&(gE.copy(l).invert(),Yo.copy(e.ray).applyMatrix4(gE),!(i.boundingBox!==null&&Yo.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Yo)))}_computeIntersections(e,t,i){let r;const l=this.geometry,u=this.material,h=l.index,d=l.attributes.position,p=l.attributes.uv,m=l.attributes.uv1,g=l.attributes.normal,b=l.groups,y=l.drawRange;if(h!==null)if(Array.isArray(u))for(let _=0,C=b.length;_<C;_++){const w=b[_],S=u[w.materialIndex],T=Math.max(w.start,y.start),N=Math.min(h.count,Math.min(w.start+w.count,y.start+y.count));for(let j=T,O=N;j<O;j+=3){const R=h.getX(j),z=h.getX(j+1),M=h.getX(j+2);r=ap(this,S,e,i,p,m,g,R,z,M),r&&(r.faceIndex=Math.floor(j/3),r.face.materialIndex=w.materialIndex,t.push(r))}}else{const _=Math.max(0,y.start),C=Math.min(h.count,y.start+y.count);for(let w=_,S=C;w<S;w+=3){const T=h.getX(w),N=h.getX(w+1),j=h.getX(w+2);r=ap(this,u,e,i,p,m,g,T,N,j),r&&(r.faceIndex=Math.floor(w/3),t.push(r))}}else if(d!==void 0)if(Array.isArray(u))for(let _=0,C=b.length;_<C;_++){const w=b[_],S=u[w.materialIndex],T=Math.max(w.start,y.start),N=Math.min(d.count,Math.min(w.start+w.count,y.start+y.count));for(let j=T,O=N;j<O;j+=3){const R=j,z=j+1,M=j+2;r=ap(this,S,e,i,p,m,g,R,z,M),r&&(r.faceIndex=Math.floor(j/3),r.face.materialIndex=w.materialIndex,t.push(r))}}else{const _=Math.max(0,y.start),C=Math.min(d.count,y.start+y.count);for(let w=_,S=C;w<S;w+=3){const T=w,N=w+1,j=w+2;r=ap(this,u,e,i,p,m,g,T,N,j),r&&(r.faceIndex=Math.floor(w/3),t.push(r))}}}}function eF(n,e,t,i,r,l,u,h){let d;if(e.side===os?d=i.intersectTriangle(u,l,r,!0,h):d=i.intersectTriangle(r,l,u,e.side===So,h),d===null)return null;rp.copy(h),rp.applyMatrix4(n.matrixWorld);const p=t.ray.origin.distanceTo(rp);return p<t.near||p>t.far?null:{distance:p,point:rp.clone(),object:n}}function ap(n,e,t,i,r,l,u,h,d,p){n.getVertexPosition(h,tp),n.getVertexPosition(d,np),n.getVertexPosition(p,ip);const m=eF(n,e,t,i,tp,np,ip,bE);if(m){const g=new Ne;dr.getBarycoord(bE,tp,np,ip,g),r&&(m.uv=dr.getInterpolatedAttribute(r,h,d,p,g,new Cn)),l&&(m.uv1=dr.getInterpolatedAttribute(l,h,d,p,g,new Cn)),u&&(m.normal=dr.getInterpolatedAttribute(u,h,d,p,g,new Ne),m.normal.dot(i.direction)>0&&m.normal.multiplyScalar(-1));const b={a:h,b:d,c:p,normal:new Ne,materialIndex:0};dr.getNormal(tp,np,ip,b.normal),m.face=b,m.barycoord=g}return m}class tF extends Yi{constructor(e=null,t=1,i=1,r,l,u,h,d,p=Ri,m=Ri,g,b){super(null,u,h,d,p,m,r,l,g,b),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const qx=new Ne,nF=new Ne,iF=new Gt;class el{constructor(e=new Ne(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=qx.subVectors(i,t).cross(nF.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(qx),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const l=-(e.start.dot(this.normal)+this.constant)/r;return l<0||l>1?null:t.copy(e.start).addScaledVector(i,l)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||iF.getNormalMatrix(e),r=this.coplanarPoint(qx).applyMatrix4(e),l=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(l),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Ko=new dy,sF=new Cn(.5,.5),op=new Ne;class wC{constructor(e=new el,t=new el,i=new el,r=new el,l=new el,u=new el){this.planes=[e,t,i,r,l,u]}set(e,t,i,r,l,u){const h=this.planes;return h[0].copy(e),h[1].copy(t),h[2].copy(i),h[3].copy(r),h[4].copy(l),h[5].copy(u),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=jr,i=!1){const r=this.planes,l=e.elements,u=l[0],h=l[1],d=l[2],p=l[3],m=l[4],g=l[5],b=l[6],y=l[7],_=l[8],C=l[9],w=l[10],S=l[11],T=l[12],N=l[13],j=l[14],O=l[15];if(r[0].setComponents(p-u,y-m,S-_,O-T).normalize(),r[1].setComponents(p+u,y+m,S+_,O+T).normalize(),r[2].setComponents(p+h,y+g,S+C,O+N).normalize(),r[3].setComponents(p-h,y-g,S-C,O-N).normalize(),i)r[4].setComponents(d,b,w,j).normalize(),r[5].setComponents(p-d,y-b,S-w,O-j).normalize();else if(r[4].setComponents(p-d,y-b,S-w,O-j).normalize(),t===jr)r[5].setComponents(p+d,y+b,S+w,O+j).normalize();else if(t===Xp)r[5].setComponents(d,b,w,j).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ko.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ko.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ko)}intersectsSprite(e){Ko.center.set(0,0,0);const t=sF.distanceTo(e.center);return Ko.radius=.7071067811865476+t,Ko.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ko)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let l=0;l<6;l++)if(t[l].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(op.x=r.normal.x>0?e.max.x:e.min.x,op.y=r.normal.y>0?e.max.y:e.min.y,op.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(op)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class SC extends Yi{constructor(e=[],t=fl,i,r,l,u,h,d,p,m){super(e,t,i,r,l,u,h,d,p,m),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Xd extends Yi{constructor(e,t,i=Hr,r,l,u,h=Ri,d=Ri,p,m=ka,g=1){if(m!==ka&&m!==ll)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const b={width:e,height:t,depth:g};super(b,r,l,u,h,d,m,i,p),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new uy(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class rF extends Xd{constructor(e,t=Hr,i=fl,r,l,u=Ri,h=Ri,d,p=ka){const m={width:e,height:e,depth:1},g=[m,m,m,m,m,m];super(e,e,t,i,r,l,u,h,d,p),this.image=g,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class EC extends Yi{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class oh extends Xr{constructor(e=1,t=1,i=1,r=1,l=1,u=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:l,depthSegments:u};const h=this;r=Math.floor(r),l=Math.floor(l),u=Math.floor(u);const d=[],p=[],m=[],g=[];let b=0,y=0;_("z","y","x",-1,-1,i,t,e,u,l,0),_("z","y","x",1,-1,i,t,-e,u,l,1),_("x","z","y",1,1,e,i,t,r,u,2),_("x","z","y",1,-1,e,i,-t,r,u,3),_("x","y","z",1,-1,e,t,i,r,l,4),_("x","y","z",-1,-1,e,t,-i,r,l,5),this.setIndex(d),this.setAttribute("position",new Ma(p,3)),this.setAttribute("normal",new Ma(m,3)),this.setAttribute("uv",new Ma(g,2));function _(C,w,S,T,N,j,O,R,z,M,P){const G=j/z,U=O/M,Y=j/2,W=O/2,J=R/2,F=z+1,$=M+1;let V=0,se=0;const ue=new Ne;for(let Ce=0;Ce<$;Ce++){const D=Ce*U-W;for(let H=0;H<F;H++){const Z=H*G-Y;ue[C]=Z*T,ue[w]=D*N,ue[S]=J,p.push(ue.x,ue.y,ue.z),ue[C]=0,ue[w]=0,ue[S]=R>0?1:-1,m.push(ue.x,ue.y,ue.z),g.push(H/z),g.push(1-Ce/M),V+=1}}for(let Ce=0;Ce<M;Ce++)for(let D=0;D<z;D++){const H=b+D+F*Ce,Z=b+D+F*(Ce+1),Ee=b+(D+1)+F*(Ce+1),je=b+(D+1)+F*Ce;d.push(H,Z,je),d.push(Z,Ee,je),se+=6}h.addGroup(y,se,P),y+=se,b+=V}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new oh(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Rm extends Xr{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const l=e/2,u=t/2,h=Math.floor(i),d=Math.floor(r),p=h+1,m=d+1,g=e/h,b=t/d,y=[],_=[],C=[],w=[];for(let S=0;S<m;S++){const T=S*b-u;for(let N=0;N<p;N++){const j=N*g-l;_.push(j,-T,0),C.push(0,0,1),w.push(N/h),w.push(1-S/d)}}for(let S=0;S<d;S++)for(let T=0;T<h;T++){const N=T+p*S,j=T+p*(S+1),O=T+1+p*(S+1),R=T+1+p*S;y.push(N,j,R),y.push(j,O,R)}this.setIndex(y),this.setAttribute("position",new Ma(_,3)),this.setAttribute("normal",new Ma(C,3)),this.setAttribute("uv",new Ma(w,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Rm(e.width,e.height,e.widthSegments,e.heightSegments)}}function Hc(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(Bt("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function qi(n){const e={};for(let t=0;t<n.length;t++){const i=Hc(n[t]);for(const r in i)e[r]=i[r]}return e}function aF(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function CC(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:cn.workingColorSpace}const oF={clone:Hc,merge:qi};var lF=`void main() { 80 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 81}`,cF=`void main() { 82 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 83}`;class Gr extends ah{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=lF,this.fragmentShader=cF,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Hc(e.uniforms),this.uniformsGroups=aF(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const u=this.uniforms[r].value;u&&u.isTexture?t.uniforms[r]={type:"t",value:u.toJSON(e).uuid}:u&&u.isColor?t.uniforms[r]={type:"c",value:u.getHex()}:u&&u.isVector2?t.uniforms[r]={type:"v2",value:u.toArray()}:u&&u.isVector3?t.uniforms[r]={type:"v3",value:u.toArray()}:u&&u.isVector4?t.uniforms[r]={type:"v4",value:u.toArray()}:u&&u.isMatrix3?t.uniforms[r]={type:"m3",value:u.toArray()}:u&&u.isMatrix4?t.uniforms[r]={type:"m4",value:u.toArray()}:t.uniforms[r]={value:u}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class NC extends Gr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class uF extends ah{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=_$,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class dF extends ah{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const lp=new Ne,cp=new ru,Nr=new Ne;
vendor: 4,872 bytes, line 83
83class TC extends Rs{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new hi,this.projectionMatrix=new hi,this.projectionMatrixInverse=new hi,this.coordinateSystem=jr,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(lp,cp,Nr),Nr.x===1&&Nr.y===1&&Nr.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(lp,cp,Nr.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(lp,cp,Nr),Nr.x===1&&Nr.y===1&&Nr.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(lp,cp,Nr.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const co=new Ne,vE=new Cn,yE=new Cn;class cr extends TC{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=$b*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Sx*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return $b*2*Math.atan(Math.tan(Sx*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){co.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(co.x,co.y).multiplyScalar(-e/co.z),co.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(co.x,co.y).multiplyScalar(-e/co.z)}getViewSize(e,t){return this.getViewBounds(e,vE,yE),t.subVectors(yE,vE)}setViewOffset(e,t,i,r,l,u){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=l,this.view.height=u,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Sx*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,l=-.5*r;const u=this.view;if(this.view!==null&&this.view.enabled){const d=u.fullWidth,p=u.fullHeight;l+=u.offsetX*r/d,t-=u.offsetY*i/p,r*=u.width/d,i*=u.height/p}const h=this.filmOffset;h!==0&&(l+=e*h/this.getFilmWidth()),this.projectionMatrix.makePerspective(l,l+r,t,t-i,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class hy extends TC{constructor(e=-1,t=1,i=1,r=-1,l=.1,u=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=l,this.far=u,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,l,u){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=l,this.view.height=u,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let l=i-e,u=i+e,h=r+t,d=r-t;if(this.view!==null&&this.view.enabled){const p=(this.right-this.left)/this.view.fullWidth/this.zoom,m=(this.top-this.bottom)/this.view.fullHeight/this.zoom;l+=p*this.view.offsetX,u=l+p*this.view.width,h-=m*this.view.offsetY,d=h-m*this.view.height}
vendor: 6,793 bytes, line 83
83this.projectionMatrix.makeOrthographic(l,u,h,d,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const xc=-90,bc=1;class hF extends Rs{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new cr(xc,bc,e,t);r.layers=this.layers,this.add(r);const l=new cr(xc,bc,e,t);l.layers=this.layers,this.add(l);const u=new cr(xc,bc,e,t);u.layers=this.layers,this.add(u);const h=new cr(xc,bc,e,t);h.layers=this.layers,this.add(h);const d=new cr(xc,bc,e,t);d.layers=this.layers,this.add(d);const p=new cr(xc,bc,e,t);p.layers=this.layers,this.add(p)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,l,u,h,d]=t;for(const p of t)this.remove(p);if(e===jr)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),l.up.set(0,0,-1),l.lookAt(0,1,0),u.up.set(0,0,1),u.lookAt(0,-1,0),h.up.set(0,1,0),h.lookAt(0,0,1),d.up.set(0,1,0),d.lookAt(0,0,-1);else if(e===Xp)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),l.up.set(0,0,1),l.lookAt(0,1,0),u.up.set(0,0,-1),u.lookAt(0,-1,0),h.up.set(0,-1,0),h.lookAt(0,0,1),d.up.set(0,-1,0),d.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const p of t)this.add(p),p.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[l,u,h,d,p,m]=this.children,g=e.getRenderTarget(),b=e.getActiveCubeFace(),y=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const C=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let w=!1;e.isWebGLRenderer===!0?w=e.state.buffers.depth.getReversed():w=e.reversedDepthBuffer,e.setRenderTarget(i,0,r),w&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(i,1,r),w&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(i,2,r),w&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(i,3,r),w&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),e.setRenderTarget(i,4,r),w&&e.autoClear===!1&&e.clearDepth(),e.render(t,p),i.texture.generateMipmaps=C,e.setRenderTarget(i,5,r),w&&e.autoClear===!1&&e.clearDepth(),e.render(t,m),e.setRenderTarget(g,b,y),e.xr.enabled=_,i.texture.needsPMREMUpdate=!0}}class fF extends cr{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}function _E(n,e,t,i){const r=pF(i);switch(t){case hC:return n*e;case pC:return n*e/r.components*r.byteLength;case ry:return n*e/r.components*r.byteLength;case Fc:return n*e*2/r.components*r.byteLength;case ay:return n*e*2/r.components*r.byteLength;case fC:return n*e*3/r.components*r.byteLength;case hr:return n*e*4/r.components*r.byteLength;case oy:return n*e*4/r.components*r.byteLength;case Sp:case Ep:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Cp:case Np:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case cb:case db:return Math.max(n,16)*Math.max(e,8)/4;case lb:case ub:return Math.max(n,8)*Math.max(e,8)/2;case hb:case fb:case mb:case gb:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case pb:case xb:case bb:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case vb:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case yb:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case _b:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case wb:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Sb:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Eb:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case Cb:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case Nb:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Tb:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case Mb:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Ab:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Rb:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case kb:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case jb:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case Lb:case Pb:case Ob:return Math.ceil(n/4)*Math.ceil(e/4)*16;case Db:case Ub:return Math.ceil(n/4)*Math.ceil(e/4)*8;case Ib:case zb:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function pF(n){switch(n){case Ws:case lC:return{byteLength:1,components:1};case qd:case cC:case Ra:return{byteLength:2,components:1};case iy:case sy:return{byteLength:2,components:4};case Hr:case ny:case kr:return{byteLength:4,components:1};case uC:case dC:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ty}}));typeof window<"u"&&(window.__THREE__?Bt("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ty);function MC(){let n=null,e=!1,t=null,i=null;function r(l,u){t(l,u),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(l){t=l},setContext:function(l){n=l}}}function mF(n){const e=new WeakMap;function t(h,d){const p=h.array,m=h.usage,g=p.byteLength,b=n.createBuffer();n.bindBuffer(d,b),n.bufferData(d,p,m),h.onUploadCallback();let y;if(p instanceof Float32Array)y=n.FLOAT;else if(typeof Float16Array<"u"&&p instanceof Float16Array)y=n.HALF_FLOAT;else if(p instanceof Uint16Array)h.isFloat16BufferAttribute?y=n.HALF_FLOAT:y=n.UNSIGNED_SHORT;else if(p instanceof Int16Array)y=n.SHORT;else if(p instanceof Uint32Array)y=n.UNSIGNED_INT;else if(p instanceof Int32Array)y=n.INT;else if(p instanceof Int8Array)y=n.BYTE;else if(p instanceof Uint8Array)y=n.UNSIGNED_BYTE;else if(p instanceof Uint8ClampedArray)y=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+p);return{buffer:b,type:y,bytesPerElement:p.BYTES_PER_ELEMENT,version:h.version,size:g}}function i(h,d,p){const m=d.array,g=d.updateRanges;if(n.bindBuffer(p,h),g.length===0)n.bufferSubData(p,0,m);else{g.sort((y,_)=>y.start-_.start);let b=0;for(let y=1;y<g.length;y++){const _=g[b],C=g[y];C.start<=_.start+_.count+1?_.count=Math.max(_.count,C.start+C.count-_.start):(++b,g[b]=C)}g.length=b+1;for(let y=0,_=g.length;y<_;y++){const C=g[y];n.bufferSubData(p,C.start*m.BYTES_PER_ELEMENT,m,C.start,C.count)}
vendor: 4,945 bytes, lines 83-196
83d.clearUpdateRanges()}d.onUploadCallback()}function r(h){return h.isInterleavedBufferAttribute&&(h=h.data),e.get(h)}function l(h){h.isInterleavedBufferAttribute&&(h=h.data);const d=e.get(h);d&&(n.deleteBuffer(d.buffer),e.delete(h))}function u(h,d){if(h.isInterleavedBufferAttribute&&(h=h.data),h.isGLBufferAttribute){const m=e.get(h);(!m||m.version<h.version)&&e.set(h,{buffer:h.buffer,type:h.type,bytesPerElement:h.elementSize,version:h.version});return}const p=e.get(h);if(p===void 0)e.set(h,t(h,d));else if(p.version<h.version){if(p.size!==h.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(p.buffer,h,d),p.version=h.version}}return{get:r,remove:l,update:u}}var gF=`#ifdef USE_ALPHAHASH 84 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 85#endif`,xF=`#ifdef USE_ALPHAHASH 86 const float ALPHA_HASH_SCALE = 0.05; 87 float hash2D( vec2 value ) { 88 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 89 } 90 float hash3D( vec3 value ) { 91 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 92 } 93 float getAlphaHashThreshold( vec3 position ) { 94 float maxDeriv = max( 95 length( dFdx( position.xyz ) ), 96 length( dFdy( position.xyz ) ) 97 ); 98 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 99 vec2 pixScales = vec2( 100 exp2( floor( log2( pixScale ) ) ), 101 exp2( ceil( log2( pixScale ) ) ) 102 ); 103 vec2 alpha = vec2( 104 hash3D( floor( pixScales.x * position.xyz ) ), 105 hash3D( floor( pixScales.y * position.xyz ) ) 106 ); 107 float lerpFactor = fract( log2( pixScale ) ); 108 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 109 float a = min( lerpFactor, 1.0 - lerpFactor ); 110 vec3 cases = vec3( 111 x * x / ( 2.0 * a * ( 1.0 - a ) ), 112 ( x - 0.5 * a ) / ( 1.0 - a ), 113 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 114 ); 115 float threshold = ( x < ( 1.0 - a ) ) 116 ? ( ( x < a ) ? cases.x : cases.y ) 117 : cases.z; 118 return clamp( threshold , 1.0e-6, 1.0 ); 119 } 120#endif`,bF=`#ifdef USE_ALPHAMAP 121 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 122#endif`,vF=`#ifdef USE_ALPHAMAP 123 uniform sampler2D alphaMap; 124#endif`,yF=`#ifdef USE_ALPHATEST 125 #ifdef ALPHA_TO_COVERAGE 126 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 127 if ( diffuseColor.a == 0.0 ) discard; 128 #else 129 if ( diffuseColor.a < alphaTest ) discard; 130 #endif 131#endif`,_F=`#ifdef USE_ALPHATEST 132 uniform float alphaTest; 133#endif`,wF=`#ifdef USE_AOMAP 134 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 135 reflectedLight.indirectDiffuse *= ambientOcclusion; 136 #if defined( USE_CLEARCOAT ) 137 clearcoatSpecularIndirect *= ambientOcclusion; 138 #endif 139 #if defined( USE_SHEEN ) 140 sheenSpecularIndirect *= ambientOcclusion; 141 #endif 142 #if defined( USE_ENVMAP ) && defined( STANDARD ) 143 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 144 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 145 #endif 146#endif`,SF=`#ifdef USE_AOMAP 147 uniform sampler2D aoMap; 148 uniform float aoMapIntensity; 149#endif`,EF=`#ifdef USE_BATCHING 150 #if ! defined( GL_ANGLE_multi_draw ) 151 #define gl_DrawID _gl_DrawID 152 uniform int _gl_DrawID; 153 #endif 154 uniform highp sampler2D batchingTexture; 155 uniform highp usampler2D batchingIdTexture; 156 mat4 getBatchingMatrix( const in float i ) { 157 int size = textureSize( batchingTexture, 0 ).x; 158 int j = int( i ) * 4; 159 int x = j % size; 160 int y = j / size; 161 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 162 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 163 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 164 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 165 return mat4( v1, v2, v3, v4 ); 166 } 167 float getIndirectIndex( const in int i ) { 168 int size = textureSize( batchingIdTexture, 0 ).x; 169 int x = i % size; 170 int y = i / size; 171 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 172 } 173#endif 174#ifdef USE_BATCHING_COLOR 175 uniform sampler2D batchingColorTexture; 176 vec4 getBatchingColor( const in float i ) { 177 int size = textureSize( batchingColorTexture, 0 ).x; 178 int j = int( i ); 179 int x = j % size; 180 int y = j / size; 181 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ); 182 } 183#endif`,CF=`#ifdef USE_BATCHING 184 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 185#endif`,NF=`vec3 transformed = vec3( position ); 186#ifdef USE_ALPHAHASH 187 vPosition = vec3( position ); 188#endif`,TF=`vec3 objectNormal = vec3( normal ); 189#ifdef USE_TANGENT 190 vec3 objectTangent = vec3( tangent.xyz ); 191#endif`,MF=`float G_BlinnPhong_Implicit( ) { 192 return 0.25; 193} 194float D_BlinnPhong( const in float shininess, const in float dotNH ) { 195 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 196}
197vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 198 vec3 halfDir = normalize( lightDir + viewDir ); 199 float dotNH = saturate( dot( normal, halfDir ) ); 200 float dotVH = saturate( dot( viewDir, halfDir ) ); 201 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 202 float G = G_BlinnPhong_Implicit( ); 203 float D = D_BlinnPhong( shininess, dotNH ); 204 return F * ( G * D ); 205} // validated`,AF=`#ifdef USE_IRIDESCENCE 206 const mat3 XYZ_TO_REC709 = mat3( 207 3.2404542, -0.9692660, 0.0556434, 208 -1.5371385, 1.8760108, -0.2040259, 209 -0.4985314, 0.0415560, 1.0572252 210 ); 211 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 212 vec3 sqrtF0 = sqrt( fresnel0 ); 213 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 214 } 215 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 216 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 217 } 218 float IorToFresnel0( float transmittedIor, float incidentIor ) { 219 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 220 } 221 vec3 evalSensitivity( float OPD, vec3 shift ) { 222 float phase = 2.0 * PI * OPD * 1.0e-9; 223 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 224 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 225 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 226 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 227 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 228 xyz /= 1.0685e-7; 229 vec3 rgb = XYZ_TO_REC709 * xyz; 230 return rgb; 231 } 232 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 233 vec3 I; 234 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 235 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 236 float cosTheta2Sq = 1.0 - sinTheta2Sq; 237 if ( cosTheta2Sq < 0.0 ) { 238 return vec3( 1.0 ); 239 } 240 float cosTheta2 = sqrt( cosTheta2Sq ); 241 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); 242 float R12 = F_Schlick( R0, 1.0, cosTheta1 );
243 float T121 = 1.0 - R12; 244 float phi12 = 0.0; 245 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 246 float phi21 = PI - phi12; 247 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 248 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 249 vec3 phi23 = vec3( 0.0 ); 250 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 251 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 252 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 253 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 254 vec3 phi = vec3( phi21 ) + phi23; 255 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 256 vec3 r123 = sqrt( R123 ); 257 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 258 vec3 C0 = R12 + Rs; 259 I = C0; 260 vec3 Cm = Rs - T121; 261 for ( int m = 1; m <= 2; ++ m ) { 262 Cm *= r123; 263 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 264 I += Cm * Sm; 265 } 266 return max( I, vec3( 0.0 ) ); 267 } 268#endif`,RF=`#ifdef USE_BUMPMAP 269 uniform sampler2D bumpMap; 270 uniform float bumpScale; 271 vec2 dHdxy_fwd() { 272 vec2 dSTdx = dFdx( vBumpMapUv ); 273 vec2 dSTdy = dFdy( vBumpMapUv ); 274 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 275 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 276 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 277 return vec2( dBx, dBy ); 278 } 279 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 280 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 281 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 282 vec3 vN = surf_norm; 283 vec3 R1 = cross( vSigmaY, vN ); 284 vec3 R2 = cross( vN, vSigmaX ); 285 float fDet = dot( vSigmaX, R1 ) * faceDirection; 286 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 287 return normalize( abs( fDet ) * surf_norm - vGrad ); 288 } 289#endif`,kF=`#if NUM_CLIPPING_PLANES > 0 290 vec4 plane; 291 #ifdef ALPHA_TO_COVERAGE 292 float distanceToPlane, distanceGradient; 293 float clipOpacity = 1.0; 294 #pragma unroll_loop_start 295 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 296 plane = clippingPlanes[ i ]; 297 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 298 distanceGradient = fwidth( distanceToPlane ) / 2.0; 299 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 300 if ( clipOpacity == 0.0 ) discard; 301 } 302 #pragma unroll_loop_end 303 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 304 float unionClipOpacity = 1.0; 305 #pragma unroll_loop_start 306 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 307 plane = clippingPlanes[ i ]; 308 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 309 distanceGradient = fwidth( distanceToPlane ) / 2.0; 310 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 311 } 312 #pragma unroll_loop_end 313 clipOpacity *= 1.0 - unionClipOpacity; 314 #endif 315 diffuseColor.a *= clipOpacity; 316 if ( diffuseColor.a == 0.0 ) discard; 317 #else 318 #pragma unroll_loop_start 319 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 320 plane = clippingPlanes[ i ]; 321 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 322 } 323 #pragma unroll_loop_end 324 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 325 bool clipped = true; 326 #pragma unroll_loop_start 327 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 328 plane = clippingPlanes[ i ]; 329 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 330 } 331 #pragma unroll_loop_end 332 if ( clipped ) discard; 333 #endif 334 #endif 335#endif`,jF=`#if NUM_CLIPPING_PLANES > 0 336 varying vec3 vClipPosition; 337 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 338#endif`,LF=`#if NUM_CLIPPING_PLANES > 0 339 varying vec3 vClipPosition; 340#endif`,PF=`#if NUM_CLIPPING_PLANES > 0 341 vClipPosition = - mvPosition.xyz; 342#endif`,OF=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) 343 diffuseColor *= vColor; 344#endif`,DF=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) 345 varying vec4 vColor; 346#endif`,UF=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 347 varying vec4 vColor; 348#endif`,IF=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 349 vColor = vec4( 1.0 ); 350#endif 351#ifdef USE_COLOR_ALPHA 352 vColor *= color; 353#elif defined( USE_COLOR ) 354 vColor.rgb *= color; 355#endif 356#ifdef USE_INSTANCING_COLOR 357 vColor.rgb *= instanceColor.rgb; 358#endif 359#ifdef USE_BATCHING_COLOR 360 vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); 361#endif`,zF=`#define PI 3.141592653589793 362#define PI2 6.283185307179586 363#define PI_HALF 1.5707963267948966 364#define RECIPROCAL_PI 0.3183098861837907 365#define RECIPROCAL_PI2 0.15915494309189535 366#define EPSILON 1e-6 367#ifndef saturate 368#define saturate( a ) clamp( a, 0.0, 1.0 ) 369#endif 370#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 371float pow2( const in float x ) { return x*x; } 372vec3 pow2( const in vec3 x ) { return x*x; } 373float pow3( const in float x ) { return x*x*x; } 374float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 375float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 376float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 377highp float rand( const in vec2 uv ) { 378 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 379 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 380 return fract( sin( sn ) * c ); 381} 382#ifdef HIGH_PRECISION 383 float precisionSafeLength( vec3 v ) { return length( v ); } 384#else 385 float precisionSafeLength( vec3 v ) { 386 float maxComponent = max3( abs( v ) ); 387 return length( v / maxComponent ) * maxComponent; 388 } 389#endif 390struct IncidentLight { 391 vec3 color; 392 vec3 direction; 393 bool visible; 394}; 395struct ReflectedLight { 396 vec3 directDiffuse; 397 vec3 directSpecular; 398 vec3 indirectDiffuse; 399 vec3 indirectSpecular; 400}; 401#ifdef USE_ALPHAHASH 402 varying vec3 vPosition; 403#endif 404vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 405 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 406} 407vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 408 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 409} 410bool isPerspectiveMatrix( mat4 m ) { 411 return m[ 2 ][ 3 ] == - 1.0; 412} 413vec2 equirectUv( in vec3 dir ) { 414 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 415 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 416 return vec2( u, v ); 417}
418vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 419 return RECIPROCAL_PI * diffuseColor; 420} 421vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 422 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 423 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 424} 425float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 426 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 427 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 428} // validated`,$F=`#ifdef ENVMAP_TYPE_CUBE_UV 429 #define cubeUV_minMipLevel 4.0 430 #define cubeUV_minTileSize 16.0 431 float getFace( vec3 direction ) { 432 vec3 absDirection = abs( direction ); 433 float face = - 1.0; 434 if ( absDirection.x > absDirection.z ) { 435 if ( absDirection.x > absDirection.y ) 436 face = direction.x > 0.0 ? 0.0 : 3.0; 437 else 438 face = direction.y > 0.0 ? 1.0 : 4.0; 439 } else { 440 if ( absDirection.z > absDirection.y ) 441 face = direction.z > 0.0 ? 2.0 : 5.0; 442 else 443 face = direction.y > 0.0 ? 1.0 : 4.0; 444 } 445 return face; 446 } 447 vec2 getUV( vec3 direction, float face ) { 448 vec2 uv; 449 if ( face == 0.0 ) { 450 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 451 } else if ( face == 1.0 ) { 452 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 453 } else if ( face == 2.0 ) { 454 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 455 } else if ( face == 3.0 ) { 456 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 457 } else if ( face == 4.0 ) { 458 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 459 } else { 460 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 461 } 462 return 0.5 * ( uv + 1.0 ); 463 } 464 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 465 float face = getFace( direction ); 466 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 467 mipInt = max( mipInt, cubeUV_minMipLevel ); 468 float faceSize = exp2( mipInt ); 469 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 470 if ( face > 2.0 ) { 471 uv.y += faceSize; 472 face -= 3.0; 473 } 474 uv.x += face * faceSize; 475 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 476 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 477 uv.x *= CUBEUV_TEXEL_WIDTH; 478 uv.y *= CUBEUV_TEXEL_HEIGHT; 479 #ifdef texture2DGradEXT 480 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 481 #else 482 return texture2D( envMap, uv ).rgb; 483 #endif 484 } 485 #define cubeUV_r0 1.0 486 #define cubeUV_m0 - 2.0 487 #define cubeUV_r1 0.8 488 #define cubeUV_m1 - 1.0 489 #define cubeUV_r4 0.4 490 #define cubeUV_m4 2.0 491 #define cubeUV_r5 0.305 492 #define cubeUV_m5 3.0 493 #define cubeUV_r6 0.21 494 #define cubeUV_m6 4.0 495 float roughnessToMip( float roughness ) { 496 float mip = 0.0; 497 if ( roughness >= cubeUV_r1 ) { 498 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 499 } else if ( roughness >= cubeUV_r4 ) { 500 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 501 } else if ( roughness >= cubeUV_r5 ) { 502 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 503 } else if ( roughness >= cubeUV_r6 ) { 504 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 505 } else { 506 mip = - 2.0 * log2( 1.16 * roughness ); } 507 return mip; 508 } 509 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 510 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 511 float mipF = fract( mip ); 512 float mipInt = floor( mip ); 513 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 514 if ( mipF == 0.0 ) { 515 return vec4( color0, 1.0 ); 516 } else { 517 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 518 return vec4( mix( color0, color1, mipF ), 1.0 ); 519 } 520 } 521#endif`,FF=`vec3 transformedNormal = objectNormal; 522#ifdef USE_TANGENT 523 vec3 transformedTangent = objectTangent; 524#endif 525#ifdef USE_BATCHING 526 mat3 bm = mat3( batchingMatrix ); 527 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 528 transformedNormal = bm * transformedNormal; 529 #ifdef USE_TANGENT 530 transformedTangent = bm * transformedTangent; 531 #endif 532#endif 533#ifdef USE_INSTANCING 534 mat3 im = mat3( instanceMatrix ); 535 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 536 transformedNormal = im * transformedNormal; 537 #ifdef USE_TANGENT 538 transformedTangent = im * transformedTangent; 539 #endif 540#endif 541transformedNormal = normalMatrix * transformedNormal; 542#ifdef FLIP_SIDED 543 transformedNormal = - transformedNormal; 544#endif 545#ifdef USE_TANGENT 546 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 547 #ifdef FLIP_SIDED 548 transformedTangent = - transformedTangent; 549 #endif 550#endif`,BF=`#ifdef USE_DISPLACEMENTMAP 551 uniform sampler2D displacementMap; 552 uniform float displacementScale; 553 uniform float displacementBias; 554#endif`,HF=`#ifdef USE_DISPLACEMENTMAP 555 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
555placementBias ); 556#endif`,VF=`#ifdef USE_EMISSIVEMAP 557 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 558 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 559 emissiveColor = sRGBTransferEOTF( emissiveColor ); 560 #endif 561 totalEmissiveRadiance *= emissiveColor.rgb; 562#endif`,GF=`#ifdef USE_EMISSIVEMAP 563 uniform sampler2D emissiveMap; 564#endif`,qF="gl_FragColor = linearToOutputTexel( gl_FragColor );",WF=`vec4 LinearTransferOETF( in vec4 value ) { 565 return value; 566} 567vec4 sRGBTransferEOTF( in vec4 value ) { 568 return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); 569} 570vec4 sRGBTransferOETF( in vec4 value ) { 571 return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); 572}`,XF=`#ifdef USE_ENVMAP 573 #ifdef ENV_WORLDPOS 574 vec3 cameraToFrag; 575 if ( isOrthographic ) { 576 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 577 } else { 578 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 579 } 580 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 581 #ifdef ENVMAP_MODE_REFLECTION 582 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 583 #else 584 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 585 #endif 586 #else 587 vec3 reflectVec = vReflect; 588 #endif 589 #ifdef ENVMAP_TYPE_CUBE 590 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 591 #ifdef ENVMAP_BLENDING_MULTIPLY 592 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 593 #elif defined( ENVMAP_BLENDING_MIX ) 594 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 595 #elif defined( ENVMAP_BLENDING_ADD ) 596 outgoingLight += envColor.xyz * specularStrength * reflectivity; 597 #endif 598 #endif 599#endif`,YF=`#ifdef USE_ENVMAP 600 uniform float envMapIntensity; 601 uniform float flipEnvMap; 602 uniform mat3 envMapRotation; 603 #ifdef ENVMAP_TYPE_CUBE 604 uniform samplerCube envMap; 605 #else 606 uniform sampler2D envMap; 607 #endif 608#endif`,KF=`#ifdef USE_ENVMAP 609 uniform float reflectivity; 610 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 611 #define ENV_WORLDPOS 612 #endif 613 #ifdef ENV_WORLDPOS 614 varying vec3 vWorldPosition; 615 uniform float refractionRatio; 616 #else 617 varying vec3 vReflect; 618 #endif 619#endif`,ZF=`#ifdef USE_ENVMAP 620 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 621 #define ENV_WORLDPOS 622 #endif 623 #ifdef ENV_WORLDPOS 624 625 varying vec3 vWorldPosition; 626 #else 627 varying vec3 vReflect; 628 uniform float refractionRatio; 629 #endif 630#endif`,QF=`#ifdef USE_ENVMAP 631 #ifdef ENV_WORLDPOS 632 vWorldPosition = worldPosition.xyz; 633 #else 634 vec3 cameraToVertex; 635 if ( isOrthographic ) { 636 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 637 } else {
638 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 639 } 640 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 641 #ifdef ENVMAP_MODE_REFLECTION 642 vReflect = reflect( cameraToVertex, worldNormal ); 643 #else 644 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 645 #endif 646 #endif 647#endif`,JF=`#ifdef USE_FOG 648 vFogDepth = - mvPosition.z; 649#endif`,eB=`#ifdef USE_FOG 650 varying float vFogDepth; 651#endif`,tB=`#ifdef USE_FOG 652 #ifdef FOG_EXP2 653 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 654 #else 655 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 656 #endif 657 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 658#endif`,nB=`#ifdef USE_FOG 659 uniform vec3 fogColor; 660 varying float vFogDepth; 661 #ifdef FOG_EXP2 662 uniform float fogDensity; 663 #else 664 uniform float fogNear; 665 uniform float fogFar; 666 #endif 667#endif`,iB=`#ifdef USE_GRADIENTMAP 668 uniform sampler2D gradientMap; 669#endif 670vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 671 float dotNL = dot( normal, lightDirection ); 672 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 673 #ifdef USE_GRADIENTMAP 674 return vec3( texture2D( gradientMap, coord ).r ); 675 #else 676 vec2 fw = fwidth( coord ) * 0.5; 677 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 678 #endif 679}`,sB=`#ifdef USE_LIGHTMAP 680 uniform sampler2D lightMap; 681 uniform float lightMapIntensity; 682#endif`,rB=`LambertMaterial material; 683material.diffuseColor = diffuseColor.rgb; 684material.specularStrength = specularStrength;`,aB=`varying vec3 vViewPosition; 685struct LambertMaterial { 686 vec3 diffuseColor; 687 float specularStrength; 688}; 689void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 690 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 691 vec3 irradiance = dotNL * directLight.color; 692 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 693} 694void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 695 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 696} 697#define RE_Direct RE_Direct_Lambert 698#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,oB=`uniform bool receiveShadow; 699uniform vec3 ambientLightColor; 700#if defined( USE_LIGHT_PROBES ) 701 uniform vec3 lightProbe[ 9 ]; 702#endif 703vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 704 float x = normal.x, y = normal.y, z = normal.z; 705 vec3 result = shCoefficients[ 0 ] * 0.886227; 706 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 707 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 708 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 709 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 710 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 711 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 712 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 713 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 714 return result; 715} 716vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 717 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 718 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 719 return irradiance; 720} 721vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 722 vec3 irradiance = ambientLightColor; 723 return irradiance; 724} 725float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 726 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 727 if ( cutoffDistance > 0.0 ) { 728 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 729 } 730 return distanceFalloff; 731} 732float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 733 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 734} 735#if NUM_DIR_LIGHTS > 0 736 struct DirectionalLight { 737 vec3 direction; 738 vec3 color; 739 }; 740 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 741 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 742 light.color = directionalLight.color; 743 light.direction = directionalLight.direction; 744 light.visible = true; 745 } 746#endif 747#if NUM_POINT_LIGHTS > 0 748 struct PointLight { 749 vec3 position; 750 vec3 color; 751 float distance; 752 float decay; 753 }; 754 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 755 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 756 vec3 lVector = pointLight.position - geometryPosition; 757 light.direction = normalize( lVector ); 758 float lightDistance = length( lVector ); 759 light.color = pointLight.color; 760 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 761 light.visible = ( light.color != vec3( 0.0 ) ); 762 } 763#endif
764#if NUM_SPOT_LIGHTS > 0 765 struct SpotLight { 766 vec3 position; 767 vec3 direction; 768 vec3 color; 769 float distance; 770 float decay; 771 float coneCos; 772 float penumbraCos; 773 }; 774 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 775 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 776 vec3 lVector = spotLight.position - geometryPosition; 777 light.direction = normalize( lVector ); 778 float angleCos = dot( light.direction, spotLight.direction ); 779 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 780 if ( spotAttenuation > 0.0 ) { 781 float lightDistance = length( lVector ); 782 light.color = spotLight.color * spotAttenuation; 783 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 784 light.visible = ( light.color != vec3( 0.0 ) ); 785 } else { 786 light.color = vec3( 0.0 ); 787 light.visible = false; 788 } 789 } 790#endif 791#if NUM_RECT_AREA_LIGHTS > 0 792 struct RectAreaLight { 793 vec3 color; 794 vec3 position; 795 vec3 halfWidth; 796 vec3 halfHeight; 797 }; 798 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 799 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 800#endif 801#if NUM_HEMI_LIGHTS > 0 802 struct HemisphereLight { 803 vec3 direction; 804 vec3 skyColor; 805 vec3 groundColor; 806 }; 807 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 808 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 809 float dotNL = dot( normal, hemiLight.direction ); 810 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 811 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 812 return irradiance; 813 } 814#endif`,lB=`#ifdef USE_ENVMAP 815 vec3 getIBLIrradiance( const in vec3 normal ) { 816 #ifdef ENVMAP_TYPE_CUBE_UV 817 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 818 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 819 return PI * envMapColor.rgb * envMapIntensity; 820 #else 821 return vec3( 0.0 ); 822 #endif 823 } 824 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 825 #ifdef ENVMAP_TYPE_CUBE_UV 826 vec3 reflectVec = reflect( - viewDir, normal ); 827 reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); 828 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 829 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 830 return envMapColor.rgb * envMapIntensity; 831 #else 832 return vec3( 0.0 ); 833 #endif 834 } 835 #ifdef USE_ANISOTROPY 836 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 837 #ifdef ENVMAP_TYPE_CUBE_UV 838 vec3 bentNormal = cross( bitangent, viewDir ); 839 bentNormal = normalize( cross( bentNormal, bitangent ) ); 840 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 841 return getIBLRadiance( viewDir, bentNormal, roughness ); 842 #else 843 return vec3( 0.0 ); 844 #endif 845 } 846 #endif 847#endif`,cB=`ToonMaterial material; 848material.diffuseColor = diffuseColor.rgb;`,uB=`varying vec3 vViewPosition; 849struct ToonMaterial { 850 vec3 diffuseColor; 851}; 852void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 853 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 854 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 855} 856void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 857 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 858} 859#define RE_Direct RE_Direct_Toon 860#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,dB=`BlinnPhongMaterial material; 861material.diffuseColor = diffuseColor.rgb; 862material.specularColor = specular; 863material.specularShininess = shininess; 864material.specularStrength = specularStrength;`,hB=`varying vec3 vViewPosition; 865struct BlinnPhongMaterial { 866 vec3 diffuseColor; 867 vec3 specularColor; 868 float specularShininess; 869 float specularStrength; 870}; 871void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
872 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 873 vec3 irradiance = dotNL * directLight.color; 874 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 875 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 876} 877void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 878 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 879} 880#define RE_Direct RE_Direct_BlinnPhong 881#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,fB=`PhysicalMaterial material; 882material.diffuseColor = diffuseColor.rgb; 883material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 884material.metalness = metalnessFactor; 885vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 886float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 887material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 888material.roughness = min( material.roughness, 1.0 ); 889#ifdef IOR 890 material.ior = ior; 891 #ifdef USE_SPECULAR 892 float specularIntensityFactor = specularIntensity; 893 vec3 specularColorFactor = specularColor; 894 #ifdef USE_SPECULAR_COLORMAP 895 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 896 #endif 897 #ifdef USE_SPECULAR_INTENSITYMAP 898 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 899 #endif 900 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 901 #else 902 float specularIntensityFactor = 1.0; 903 vec3 specularColorFactor = vec3( 1.0 ); 904 material.specularF90 = 1.0; 905 #endif 906 material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; 907 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 908#else 909 material.specularColor = vec3( 0.04 ); 910 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 911 material.specularF90 = 1.0; 912#endif 913#ifdef USE_CLEARCOAT 914 material.clearcoat = clearcoat; 915 material.clearcoatRoughness = clearcoatRoughness; 916 material.clearcoatF0 = vec3( 0.04 ); 917 material.clearcoatF90 = 1.0; 918 #ifdef USE_CLEARCOATMAP 919 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 920 #endif 921 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 922 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 923 #endif 924 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 925 material.clearcoatRoughness += geometryRoughness; 926 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 927#endif 928#ifdef USE_DISPERSION 929 material.dispersion = dispersion; 930#endif 931#ifdef USE_IRIDESCENCE 932 material.iridescence = iridescence; 933 material.iridescenceIOR = iridescenceIOR; 934 #ifdef USE_IRIDESCENCEMAP 935 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 936 #endif 937 #ifdef USE_IRIDESCENCE_THICKNESSMAP 938 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 939 #else 940 material.iridescenceThickness = iridescenceThicknessMaximum; 941 #endif 942#endif 943#ifdef USE_SHEEN 944 material.sheenColor = sheenColor; 945 #ifdef USE_SHEEN_COLORMAP 946 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 947 #endif 948 material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); 949 #ifdef USE_SHEEN_ROUGHNESSMAP 950 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 951 #endif 952#endif 953#ifdef USE_ANISOTROPY 954 #ifdef USE_ANISOTROPYMAP 955 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 956 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 957 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 958 #else 959 vec2 anisotropyV = anisotropyVector; 960 #endif 961 material.anisotropy = length( anisotropyV ); 962 if( material.anisotropy == 0.0 ) { 963 anisotropyV = vec2( 1.0, 0.0 ); 964 } else { 965 anisotropyV /= material.anisotropy; 966 material.anisotropy = saturate( material.anisotropy ); 967 } 968 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
969 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 970 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 971#endif`,pB
vendor: 9,654 bytes, lines 971-1202
971=`uniform sampler2D dfgLUT; 972struct PhysicalMaterial { 973 vec3 diffuseColor; 974 vec3 diffuseContribution; 975 vec3 specularColor; 976 vec3 specularColorBlended; 977 float roughness; 978 float metalness; 979 float specularF90; 980 float dispersion; 981 #ifdef USE_CLEARCOAT 982 float clearcoat; 983 float clearcoatRoughness; 984 vec3 clearcoatF0; 985 float clearcoatF90; 986 #endif 987 #ifdef USE_IRIDESCENCE 988 float iridescence; 989 float iridescenceIOR; 990 float iridescenceThickness; 991 vec3 iridescenceFresnel; 992 vec3 iridescenceF0; 993 vec3 iridescenceFresnelDielectric; 994 vec3 iridescenceFresnelMetallic; 995 #endif 996 #ifdef USE_SHEEN 997 vec3 sheenColor; 998 float sheenRoughness; 999 #endif 1000 #ifdef IOR 1001 float ior; 1002 #endif 1003 #ifdef USE_TRANSMISSION 1004 float transmission; 1005 float transmissionAlpha; 1006 float thickness; 1007 float attenuationDistance; 1008 vec3 attenuationColor; 1009 #endif 1010 #ifdef USE_ANISOTROPY 1011 float anisotropy; 1012 float alphaT; 1013 vec3 anisotropyT; 1014 vec3 anisotropyB; 1015 #endif 1016}; 1017vec3 clearcoatSpecularDirect = vec3( 0.0 ); 1018vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 1019vec3 sheenSpecularDirect = vec3( 0.0 ); 1020vec3 sheenSpecularIndirect = vec3(0.0 ); 1021vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 1022 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 1023 float x2 = x * x; 1024 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 1025 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 1026} 1027float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 1028 float a2 = pow2( alpha ); 1029 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 1030 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 1031 return 0.5 / max( gv + gl, EPSILON ); 1032} 1033float D_GGX( const in float alpha, const in float dotNH ) { 1034 float a2 = pow2( alpha ); 1035 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1036 return RECIPROCAL_PI * a2 / pow2( denom ); 1037} 1038#ifdef USE_ANISOTROPY 1039 float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { 1040 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1041 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1042 float v = 0.5 / ( gv + gl ); 1043 return v; 1044 } 1045 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1046 float a2 = alphaT * alphaB; 1047 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1048 highp float v2 = dot( v, v ); 1049 float w2 = a2 / v2; 1050 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1051 } 1052#endif 1053#ifdef USE_CLEARCOAT 1054 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1055 vec3 f0 = material.clearcoatF0; 1056 float f90 = material.clearcoatF90; 1057 float roughness = material.clearcoatRoughness; 1058 float alpha = pow2( roughness ); 1059 vec3 halfDir = normalize( lightDir + viewDir ); 1060 float dotNL = saturate( dot( normal, lightDir ) ); 1061 float dotNV = saturate( dot( normal, viewDir ) ); 1062 float dotNH = saturate( dot( normal, halfDir ) ); 1063 float dotVH = saturate( dot( viewDir, halfDir ) ); 1064 vec3 F = F_Schlick( f0, f90, dotVH ); 1065 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1066 float D = D_GGX( alpha, dotNH ); 1067 return F * ( V * D ); 1068 } 1069#endif 1070vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1071 vec3 f0 = material.specularColorBlended; 1072 float f90 = material.specularF90; 1073 float roughness = material.roughness; 1074 float alpha = pow2( roughness ); 1075 vec3 halfDir = normalize( lightDir + viewDir ); 1076 float dotNL = saturate( dot( normal, lightDir ) ); 1077 float dotNV = saturate( dot( normal, viewDir ) ); 1078 float dotNH = saturate( dot( normal, halfDir ) ); 1079 float dotVH = saturate( dot( viewDir, halfDir ) ); 1080 vec3 F = F_Schlick( f0, f90, dotVH ); 1081 #ifdef USE_IRIDESCENCE 1082 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1083 #endif 1084 #ifdef USE_ANISOTROPY 1085 float dotTL = dot( material.anisotropyT, lightDir ); 1086 float dotTV = dot( material.anisotropyT, viewDir ); 1087 float dotTH = dot( material.anisotropyT, halfDir ); 1088 float dotBL = dot( material.anisotropyB, lightDir ); 1089 float dotBV = dot( material.anisotropyB, viewDir ); 1090 float dotBH = dot( material.anisotropyB, halfDir ); 1091 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1092 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1093 #else 1094 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1095 float D = D_GGX( alpha, dotNH ); 1096 #endif 1097 return F * ( V * D ); 1098} 1099vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1100 const float LUT_SIZE = 64.0; 1101 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1102 const float LUT_BIAS = 0.5 / LUT_SIZE; 1103 float dotNV = saturate( dot( N, V ) ); 1104 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1105 uv = uv * LUT_SCALE + LUT_BIAS; 1106 return uv; 1107} 1108float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1109 float l = length( f ); 1110 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1111} 1112vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1113 float x = dot( v1, v2 ); 1114 float y = abs( x ); 1115 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1116 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1117 float v = a / b; 1118 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1119 return cross( v1, v2 ) * theta_sintheta; 1120} 1121vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1122 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1123 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1124 vec3 lightNormal = cross( v1, v2 ); 1125 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1126 vec3 T1, T2; 1127 T1 = normalize( V - N * dot( V, N ) ); 1128 T2 = - cross( N, T1 ); 1129 mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); 1130 vec3 coords[ 4 ]; 1131 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1132 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1133 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1134 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1135 coords[ 0 ] = normalize( coords[ 0 ] ); 1136 coords[ 1 ] = normalize( coords[ 1 ] ); 1137 coords[ 2 ] = normalize( coords[ 2 ] ); 1138 coords[ 3 ] = normalize( coords[ 3 ] ); 1139 vec3 vectorFormFactor = vec3( 0.0 ); 1140 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1141 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1142 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1143 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1144 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1145 return vec3( result ); 1146} 1147#if defined( USE_SHEEN ) 1148float D_Charlie( float roughness, float dotNH ) { 1149 float alpha = pow2( roughness ); 1150 float invAlpha = 1.0 / alpha; 1151 float cos2h = dotNH * dotNH; 1152 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1153 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1154} 1155float V_Neubelt( float dotNV, float dotNL ) { 1156 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1157} 1158vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1159 vec3 halfDir = normalize( lightDir + viewDir ); 1160 float dotNL = saturate( dot( normal, lightDir ) ); 1161 float dotNV = saturate( dot( normal, viewDir ) ); 1162 float dotNH = saturate( dot( normal, halfDir ) ); 1163 float D = D_Charlie( sheenRoughness, dotNH ); 1164 float V = V_Neubelt( dotNV, dotNL ); 1165 return sheenColor * ( D * V ); 1166} 1167#endif 1168float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1169 float dotNV = saturate( dot( normal, viewDir ) ); 1170 float r2 = roughness * roughness; 1171 float rInv = 1.0 / ( roughness + 0.1 ); 1172 float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; 1173 float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; 1174 float DG = exp( a * dotNV + b ); 1175 return saturate( DG ); 1176} 1177vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1178 float dotNV = saturate( dot( normal, viewDir ) ); 1179 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1180 return specularColor * fab.x + specularF90 * fab.y; 1181} 1182#ifdef USE_IRIDESCENCE 1183void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 1184#else 1185void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 1186#endif 1187 float dotNV = saturate( dot( normal, viewDir ) ); 1188 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 1189 #ifdef USE_IRIDESCENCE 1190 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1191 #else 1192 vec3 Fr = specularColor; 1193 #endif 1194 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1195 float Ess = fab.x + fab.y; 1196 float Ems = 1.0 - Ess; 1197 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1198 singleScatter += FssEss; 1199 multiScatter += Fms * Ems; 1200} 1201vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1202 vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
vendor: 8,354 bytes, lines 1203-1332
1203 float dotNL = saturate( dot( normal, lightDir ) ); 1204 float dotNV = saturate( dot( normal, viewDir ) ); 1205 vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; 1206 vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; 1207 vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; 1208 vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; 1209 float Ess_V = dfgV.x + dfgV.y; 1210 float Ess_L = dfgL.x + dfgL.y; 1211 float Ems_V = 1.0 - Ess_V; 1212 float Ems_L = 1.0 - Ess_L; 1213 vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; 1214 vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); 1215 float compensationFactor = Ems_V * Ems_L; 1216 vec3 multiScatter = Fms * compensationFactor; 1217 return singleScatter + multiScatter; 1218} 1219#if NUM_RECT_AREA_LIGHTS > 0 1220 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1221 vec3 normal = geometryNormal; 1222 vec3 viewDir = geometryViewDir; 1223 vec3 position = geometryPosition; 1224 vec3 lightPos = rectAreaLight.position; 1225 vec3 halfWidth = rectAreaLight.halfWidth; 1226 vec3 halfHeight = rectAreaLight.halfHeight; 1227 vec3 lightColor = rectAreaLight.color; 1228 float roughness = material.roughness; 1229 vec3 rectCoords[ 4 ]; 1230 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1231 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1232 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1233 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1234 vec4 t1 = texture2D( ltc_1, uv ); 1235 vec4 t2 = texture2D( ltc_2, uv ); 1236 mat3 mInv = mat3( 1237 vec3( t1.x, 0, t1.y ), 1238 vec3( 0, 1, 0 ), 1239 vec3( t1.z, 0, t1.w ) 1240 ); 1241 vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); 1242 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1243 reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1244 #ifdef USE_CLEARCOAT 1245 vec3 Ncc = geometryClearcoatNormal; 1246 vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); 1247 vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); 1248 vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); 1249 mat3 mInvClearcoat = mat3( 1250 vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), 1251 vec3( 0, 1, 0 ), 1252 vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) 1253 ); 1254 vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; 1255 clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); 1256 #endif 1257 } 1258#endif 1259void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1260 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1261 vec3 irradiance = dotNL * directLight.color; 1262 #ifdef USE_CLEARCOAT 1263 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1264 vec3 ccIrradiance = dotNLcc * directLight.color; 1265 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1266 #endif 1267 #ifdef USE_SHEEN 1268 1269 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1270 1271 float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1272 float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); 1273 1274 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); 1275 1276 irradiance *= sheenEnergyComp; 1277 1278 #endif 1279 reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); 1280 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); 1281} 1282void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1283 vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); 1284 #ifdef USE_SHEEN 1285 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1286 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1287 diffuse *= sheenEnergyComp; 1288 #endif 1289 reflectedLight.indirectDiffuse += diffuse; 1290} 1291void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { 1292 #ifdef USE_CLEARCOAT 1293 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1294 #endif 1295 #ifdef USE_SHEEN 1296 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; 1297 #endif 1298 vec3 singleScatteringDielectric = vec3( 0.0 ); 1299 vec3 multiScatteringDielectric = vec3( 0.0 ); 1300 vec3 singleScatteringMetallic = vec3( 0.0 ); 1301 vec3 multiScatteringMetallic = vec3( 0.0 ); 1302 #ifdef USE_IRIDESCENCE 1303 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 1304 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 1305 #else 1306 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 1307 computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 1308 #endif 1309 vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); 1310 vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); 1311 vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; 1312 vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); 1313 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1314 vec3 indirectSpecular = radiance * singleScattering; 1315 indirectSpecular += multiScattering * cosineWeightedIrradiance; 1316 vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; 1317 #ifdef USE_SHEEN 1318 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1319 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 1320 indirectSpecular *= sheenEnergyComp; 1321 indirectDiffuse *= sheenEnergyComp; 1322 #endif 1323 reflectedLight.indirectSpecular += indirectSpecular; 1324 reflectedLight.indirectDiffuse += indirectDiffuse; 1325} 1326#define RE_Direct RE_Direct_Physical 1327#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1328#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1329#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1330float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1331 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1332}`,
1332mB=` 1333vec3 geometryPosition = - vViewPosition; 1334vec3 geometryNormal = normal; 1335vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1336vec3 geometryClearcoatNormal = vec3( 0.0 ); 1337#ifdef USE_CLEARCOAT 1338 geometryClearcoatNormal = clearcoatNormal; 1339#endif 1340#ifdef USE_IRIDESCENCE 1341 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1342 if ( material.iridescenceThickness == 0.0 ) { 1343 material.iridescence = 0.0; 1344 } else { 1345 material.iridescence = saturate( material.iridescence ); 1346 } 1347 if ( material.iridescence > 0.0 ) { 1348 material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1349 material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); 1350 material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); 1351 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1352 } 1353#endif 1354IncidentLight directLight; 1355#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1356 PointLight pointLight; 1357 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1358 PointLightShadow pointLightShadow; 1359 #endif 1360 #pragma unroll_loop_start 1361 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1362 pointLight = pointLights[ i ]; 1363 getPointLightInfo( pointLight, geometryPosition, directLight ); 1364 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 1365 pointLightShadow = pointLightShadows[ i ]; 1366 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1367 #endif 1368 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1369 } 1370 #pragma unroll_loop_end 1371#endif 1372#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1373 SpotLight spotLight; 1374 vec4 spotColor; 1375 vec3 spotLightCoord; 1376 bool inSpotLightMap; 1377 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1378 SpotLightShadow spotLightShadow; 1379 #endif 1380 #pragma unroll_loop_start 1381 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1382 spotLight = spotLights[ i ]; 1383 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1384 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1385 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1386 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1387 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1388 #else 1389 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1390 #endif 1391 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1392 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1393 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1394 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1395 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1396 #endif 1397 #undef SPOT_LIGHT_MAP_INDEX 1398 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1399 spotLightShadow = spotLightShadows[ i ]; 1400 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1401 #endif 1402 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1403 } 1404 #pragma unroll_loop_end 1405#endif 1406#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1407 DirectionalLight directionalLight; 1408 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1409 DirectionalLightShadow directionalLightShadow; 1410 #endif 1411 #pragma unroll_loop_start 1412 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1413 directionalLight = directionalLights[ i ]; 1414 getDirectionalLightInfo( directionalLight, directLight ); 1415 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1416 directionalLightShadow = directionalLightShadows[ i ]; 1417 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1418 #endif 1419 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1420 } 1421 #pragma unroll_loop_end 1422#endif 1423#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1424 RectAreaLight rectAreaLight; 1425 #pragma unroll_loop_start 1426 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1427 rectAreaLight = rectAreaLights[ i ]; 1428 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1429 } 1430 #pragma unroll_loop_end 1431#endif 1432#if defined( RE_IndirectDiffuse ) 1433 vec3 iblIrradiance = vec3( 0.0 ); 1434 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1435 #if defined( USE_LIGHT_PROBES ) 1436 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1437 #endif 1438 #if ( NUM_HEMI_LIGHTS > 0 ) 1439 #pragma unroll_loop_start 1440 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1441 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1442 } 1443 #pragma unroll_loop_end 1444 #endif 1445#endif 1446#if defined( RE_IndirectSpecular ) 1447 vec3 radiance = vec3( 0.0 ); 1448 vec3 clearcoatRadiance = vec3( 0.0 ); 1449#endif`,gB=`#if defined( RE_IndirectDiffuse ) 1450 #ifdef USE_LIGHTMAP 1451 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1452 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1453 irradiance += lightMapIrradiance; 1454 #endif 1455 #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) 1456 #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) 1457 iblIrradiance += getIBLIrradiance( geometryNormal ); 1458 #endif 1459 #endif 1460#endif 1461#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1462 #ifdef USE_ANISOTROPY 1463 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1464 #else 1465 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1466 #endif 1467 #ifdef USE_CLEARCOAT 1468 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1469 #endif 1470#endif`,xB=`#if defined( RE_IndirectDiffuse ) 1471 #if defined( LAMBERT ) || defined( PHONG ) 1472 irradiance += iblIrradiance; 1473 #endif 1474 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1475#endif 1476#if defined( RE_IndirectSpecular ) 1477 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1478#endif`,bB=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1479 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1480#endif`,vB=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1481 uniform float logDepthBufFC; 1482 varying float vFragDepth; 1483 varying float vIsPerspective; 1484#endif`,yB=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1485 varying float vFragDepth; 1486 varying float vIsPerspective; 1487#endif`,_B=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1488 vFragDepth = 1.0 + gl_Position.w; 1489 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1490#endif`,wB=`#ifdef USE_MAP 1491 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1492 #ifdef DECODE_VIDEO_TEXTURE 1493 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1494 #endif 1495 diffuseColor *= sampledDiffuseColor; 1496#endif`,SB=`#ifdef USE_MAP 1497 uniform sampler2D map; 1498#endif`,EB=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1499 #if defined( USE_POINTS_UV ) 1500 vec2 uv = vUv; 1501 #else 1502 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1503 #endif 1504#endif 1505#ifdef USE_MAP 1506 diffuseColor *= texture2D( map, uv ); 1507#endif 1508#ifdef USE_ALPHAMAP 1509 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1510#endif`,CB=`#if defined( USE_POINTS_UV ) 1511 varying vec2 vUv; 1512#else 1513 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1514 uniform mat3 uvTransform; 1515 #endif 1516#endif 1517#ifdef USE_MAP 1518 uniform sampler2D map; 1519#endif 1520#ifdef USE_ALPHAMAP 1521 uniform sampler2D alphaMap; 1522#endif`,NB=`float metalnessFactor = metalness; 1523#ifdef USE_METALNESSMAP 1524 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1525 metalnessFactor *= texelMetalness.b; 1526#endif`,TB=`#ifdef USE_METALNESSMAP 1527 uniform sampler2D metalnessMap; 1528#endif`,MB=`#ifdef USE_INSTANCING_MORPH 1529 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1530 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1531 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1532 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1533 } 1534#endif`,AB=`#if defined( USE_MORPHCOLORS ) 1535 vColor *= morphTargetBaseInfluence; 1536 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1537 #if defined( USE_COLOR_ALPHA ) 1538 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1539 #elif defined( USE_COLOR ) 1540 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1541 #endif 1542 } 1543#endif`,RB=`#ifdef USE_MORPHNORMALS 1544 objectNormal *= morphTargetBaseInfluence; 1545 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1546 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1547 } 1548#endif`,kB=`#ifdef USE_MORPHTARGETS 1549 #ifndef USE_INSTANCING_MORPH 1550 uniform float morphTargetBaseInfluence; 1551 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1552 #endif 1553 uniform sampler2DArray morphTargetsTexture; 1554 uniform ivec2 morphTargetsTextureSize; 1555 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1556 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1557 int y = texelIndex / morphTargetsTextureSize.x; 1558 int x = texelIndex - y * morphTargetsTextureSize.x; 1559 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1560 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1561 } 1562#endif`,jB=`#ifdef USE_MORPHTARGETS 1563 transformed *= morphTargetBaseInfluence; 1564 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1565 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1566 } 1567#endif`,LB=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1568#ifdef FLAT_SHADED 1569 vec3 fdx = dFdx( vViewPosition ); 1570 vec3 fdy = dFdy( vViewPosition ); 1571 vec3 normal = normalize( cross( fdx, fdy ) ); 1572#else 1573 vec3 normal = normalize( vNormal ); 1574 #ifdef DOUBLE_SIDED 1575 normal *= faceDirection; 1576 #endif 1577#endif 1578#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1579 #ifdef USE_TANGENT 1580 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1581 #else 1582 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1583 #if defined( USE_NORMALMAP ) 1584 vNormalMapUv 1585 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1586 vClearcoatNormalMapUv 1587 #else 1588 vUv 1589 #endif 1590 ); 1591 #endif 1592 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1593 tbn[0] *= faceDirection; 1594 tbn[1] *= faceDirection; 1595 #endif 1596#endif 1597#ifdef USE_CLEARCOAT_NORMALMAP 1598 #ifdef USE_TANGENT 1599 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1600 #else 1601 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1602 #endif 1603 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1604 tbn2[0] *= faceDirection; 1605 tbn2[1] *= faceDirection; 1606 #endif 1607#endif 1608vec3 nonPerturbedNormal = normal;`,PB=`#ifdef USE_NORMALMAP_OBJECTSPACE 1609 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1610 #ifdef FLIP_SIDED 1611 normal = - normal; 1612 #endif 1613 #ifdef DOUBLE_SIDED 1614 normal = normal * faceDirection; 1615 #endif 1616 normal = normalize( normalMatrix * normal ); 1617#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1618 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1619 mapN.xy *= normalScale; 1620 normal = normalize( tbn * mapN ); 1621#elif defined( USE_BUMPMAP )
1622 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1623#endif`,OB=`#ifndef FLAT_SHADED 1624 varying vec3 vNormal; 1625 #ifdef USE_TANGENT 1626 varying vec3 vTangent; 1627 varying vec3 vBitangent; 1628 #endif 1629#endif`,DB=`#ifndef FLAT_SHADED 1630 varying vec3 vNormal; 1631 #ifdef USE_TANGENT 1632 varying vec3 vTangent; 1633 varying vec3 vBitangent; 1634 #endif 1635#endif`,UB=`#ifndef FLAT_SHADED 1636 vNormal = normalize( transformedNormal ); 1637 #ifdef USE_TANGENT 1638 vTangent = normalize( transformedTangent ); 1639 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1640 #endif 1641#endif`,IB=`#ifdef USE_NORMALMAP 1642 uniform sampler2D normalMap; 1643 uniform vec2 normalScale; 1644#endif 1645#ifdef USE_NORMALMAP_OBJECTSPACE 1646 uniform mat3 normalMatrix; 1647#endif 1648#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1649 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1650 vec3 q0 = dFdx( eye_pos.xyz ); 1651 vec3 q1 = dFdy( eye_pos.xyz ); 1652 vec2 st0 = dFdx( uv.st ); 1653 vec2 st1 = dFdy( uv.st ); 1654 vec3 N = surf_norm; 1655 vec3 q1perp = cross( q1, N ); 1656 vec3 q0perp = cross( N, q0 ); 1657 vec3 T = q1perp * st0.x + q0perp * st1.x; 1658 vec3 B = q1perp * st0.y + q0perp * st1.y; 1659 float det = max( dot( T, T ), dot( B, B ) ); 1660 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1661 return mat3( T * scale, B * scale, N ); 1662 } 1663#endif`,zB=`#ifdef USE_CLEARCOAT 1664 vec3 clearcoatNormal = nonPerturbedNormal; 1665#endif`,$B=`#ifdef USE_CLEARCOAT_NORMALMAP 1666 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1667 clearcoatMapN.xy *= clearcoatNormalScale; 1668 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1669#endif`,FB=`#ifdef USE_CLEARCOATMAP 1670 uniform sampler2D clearcoatMap; 1671#endif 1672#ifdef USE_CLEARCOAT_NORMALMAP 1673 uniform sampler2D clearcoatNormalMap; 1674 uniform vec2 clearcoatNormalScale; 1675#endif 1676#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1677 uniform sampler2D clearcoatRoughnessMap; 1678#endif`,BB=`#ifdef USE_IRIDESCENCEMAP 1679 uniform sampler2D iridescenceMap; 1680#endif 1681#ifdef USE_IRIDESCENCE_THICKNESSMAP 1682 uniform sampler2D iridescenceThicknessMap; 1683#endif`,HB=`#ifdef OPAQUE 1684diffuseColor.a = 1.0; 1685#endif 1686#ifdef USE_TRANSMISSION 1687diffuseColor.a *= material.transmissionAlpha; 1688#endif 1689gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,VB=`vec3 packNormalToRGB( const in vec3 normal ) { 1690 return normalize( normal ) * 0.5 + 0.5; 1691} 1692vec3 unpackRGBToNormal( const in vec3 rgb ) { 1693 return 2.0 * rgb.xyz - 1.0; 1694} 1695const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1696const float Inv255 = 1. / 255.; 1697const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1698const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1699const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1700const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1701vec4 packDepthToRGBA( const in float v ) { 1702 if( v <= 0.0 ) 1703 return vec4( 0., 0., 0., 0. ); 1704 if( v >= 1.0 ) 1705 return vec4( 1., 1., 1., 1. ); 1706 float vuf; 1707 float af = modf( v * PackFactors.a, vuf ); 1708 float bf = modf( vuf * ShiftRight8, vuf ); 1709 float gf = modf( vuf * ShiftRight8, vuf ); 1710 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1711} 1712vec3 packDepthToRGB( const in float v ) { 1713 if( v <= 0.0 ) 1714 return vec3( 0., 0., 0. ); 1715 if( v >= 1.0 ) 1716 return vec3( 1., 1., 1. ); 1717 float vuf; 1718 float bf = modf( v * PackFactors.b, vuf ); 1719 float gf = modf( vuf * ShiftRight8, vuf ); 1720 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1721} 1722vec2 packDepthToRG( const in float v ) { 1723 if( v <= 0.0 ) 1724 return vec2( 0., 0. ); 1725 if( v >= 1.0 ) 1726 return vec2( 1., 1. ); 1727 float vuf; 1728 float gf = modf( v * 256., vuf ); 1729 return vec2( vuf * Inv255, gf ); 1730} 1731float unpackRGBAToDepth( const in vec4 v ) { 1732 return dot( v, UnpackFactors4 ); 1733} 1734float unpackRGBToDepth( const in vec3 v ) { 1735 return dot( v, UnpackFactors3 ); 1736} 1737float unpackRGToDepth( const in vec2 v ) { 1738 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1739} 1740vec4 pack2HalfToRGBA( const in vec2 v ) {
1741 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1742 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1743} 1744vec2 unpackRGBATo2Half( const in vec4 v ) { 1745 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1746} 1747float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1748 return ( viewZ + near ) / ( near - far ); 1749} 1750float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1751 #ifdef USE_REVERSED_DEPTH_BUFFER 1752 1753 return depth * ( far - near ) - far; 1754 #else 1755 return depth * ( near - far ) - near; 1756 #endif 1757} 1758float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1759 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1760} 1761float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1762 1763 #ifdef USE_REVERSED_DEPTH_BUFFER 1764 return ( near * far ) / ( ( near - far ) * depth - near ); 1765 #else 1766 return ( near * far ) / ( ( far - near ) * depth - far ); 1767 #endif 1768}`,GB=`#ifdef PREMULTIPLIED_ALPHA 1769 gl_FragColor.rgb *= gl_FragColor.a; 1770#endif`,qB=`vec4 mvPosition = vec4( transformed, 1.0 ); 1771#ifdef USE_BATCHING 1772 mvPosition = batchingMatrix * mvPosition; 1773#endif 1774#ifdef USE_INSTANCING 1775 mvPosition = instanceMatrix * mvPosition; 1776#endif 1777mvPosition = modelViewMatrix * mvPosition; 1778gl_Position = projectionMatrix * mvPosition;`,WB=`#ifdef DITHERING 1779 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1780#endif`,XB=`#ifdef DITHERING 1781 vec3 dithering( vec3 color ) { 1782 float grid_position = rand( gl_FragCoord.xy ); 1783 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1784 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1785 return color + dither_shift_RGB; 1786 } 1787#endif`,YB=`float roughnessFactor = roughness; 1788#ifdef USE_ROUGHNESSMAP 1789 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1790 roughnessFactor *= texelRoughness.g; 1791#endif`,KB=`#ifdef USE_ROUGHNESSMAP 1792 uniform sampler2D roughnessMap; 1793#endif`,ZB=`#if NUM_SPOT_LIGHT_COORDS > 0 1794 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1795#endif 1796#if NUM_SPOT_LIGHT_MAPS > 0 1797 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1798#endif 1799#ifdef USE_SHADOWMAP 1800 #if NUM_DIR_LIGHT_SHADOWS > 0 1801 #if defined( SHADOWMAP_TYPE_PCF ) 1802 uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1803 #else 1804 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1805 #endif 1806 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1807 struct DirectionalLightShadow { 1808 float shadowIntensity; 1809 float shadowBias; 1810 float shadowNormalBias; 1811 float shadowRadius; 1812 vec2 shadowMapSize; 1813 }; 1814 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1815 #endif 1816 #if NUM_SPOT_LIGHT_SHADOWS > 0 1817 #if defined( SHADOWMAP_TYPE_PCF ) 1818 uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1819 #else 1820 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1821 #endif 1822 struct SpotLightShadow { 1823 float shadowIntensity; 1824 float shadowBias; 1825 float shadowNormalBias; 1826 float shadowRadius; 1827 vec2 shadowMapSize; 1828 }; 1829 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1830 #endif 1831 #if NUM_POINT_LIGHT_SHADOWS > 0 1832 #if defined( SHADOWMAP_TYPE_PCF ) 1833 uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1834 #elif defined( SHADOWMAP_TYPE_BASIC ) 1835 uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1836 #endif 1837 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1838 struct PointLightShadow { 1839 float shadowIntensity; 1840 float shadowBias; 1841 float shadowNormalBias; 1842 float shadowRadius; 1843 vec2 shadowMapSize; 1844 float shadowCameraNear; 1845 float shadowCameraFar; 1846 }; 1847 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1848 #endif 1849 #if defined( SHADOWMAP_TYPE_PCF ) 1850 float interleavedGradientNoise( vec2 position ) { 1851 return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); 1852 } 1853 vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { 1854 const float goldenAngle = 2.399963229728653; 1855 float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); 1856 float theta = float( sampleIndex ) * goldenAngle + phi; 1857 return vec2( cos( theta ), sin( theta ) ) * r; 1858 } 1859 #endif 1860 #if defined( SHADOWMAP_TYPE_PCF ) 1861 float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1862 float shadow = 1.0; 1863 shadowCoord.xyz /= shadowCoord.w; 1864 shadowCoord.z += shadowBias; 1865 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1866 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1867 if ( frustumTest ) { 1868 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1869 float radius = shadowRadius * texelSize.x; 1870 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; 1871 shadow = ( 1872 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + 1873 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + 1874 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + 1875 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + 1876 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) 1877 ) * 0.2; 1878 } 1879 return mix( 1.0, shadow, shadowIntensity ); 1880 } 1881 #elif defined( SHADOWMAP_TYPE_VSM ) 1882 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1883 float shadow = 1.0; 1884 shadowCoord.xyz /= shadowCoord.w; 1885 #ifdef USE_REVERSED_DEPTH_BUFFER 1886 shadowCoord.z -= shadowBias; 1887 #else 1888 shadowCoord.z += shadowBias; 1889 #endif 1890 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1891 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1892 if ( frustumTest ) { 1893 vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; 1894 float mean = distribution.x; 1895 float variance = distribution.y * distribution.y; 1896 #ifdef USE_REVERSED_DEPTH_BUFFER 1897 float hard_shadow = step( mean, shadowCoord.z ); 1898 #else 1899 float hard_shadow = step( shadowCoord.z, mean ); 1900 #endif 1901 1902 if ( hard_shadow == 1.0 ) { 1903 shadow = 1.0; 1904 } else { 1905 variance = max( variance, 0.0000001 ); 1906 float d = shadowCoord.z - mean; 1907 float p_max = variance / ( variance + d * d ); 1908 p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); 1909 shadow = max( hard_shadow, p_max ); 1910 } 1911 } 1912 return mix( 1.0, shadow, shadowIntensity ); 1913 } 1914 #else 1915 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1916 float shadow = 1.0; 1917 shadowCoord.xyz /= shadowCoord.w; 1918 #ifdef USE_REVERSED_DEPTH_BUFFER 1919 shadowCoord.z -= shadowBias; 1920 #else 1921 shadowCoord.z += shadowBias; 1922 #endif 1923 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1924 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1925 if ( frustumTest ) { 1926 float depth = texture2D( shadowMap, shadowCoord.xy ).r; 1927 #ifdef USE_REVERSED_DEPTH_BUFFER 1928 shadow = step( depth, shadowCoord.z ); 1929 #else 1930 shadow = step( shadowCoord.z, depth ); 1931 #endif 1932 } 1933 return mix( 1.0, shadow, shadowIntensity ); 1934 } 1935 #endif 1936 #if NUM_POINT_LIGHT_SHADOWS > 0 1937 #if defined( SHADOWMAP_TYPE_PCF ) 1938 float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1939 float shadow = 1.0; 1940 vec3 lightToPosition = shadowCoord.xyz; 1941 vec3 bd3D = normalize( lightToPosition ); 1942 vec3 absVec = abs( lightToPosition ); 1943 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 1944 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 1945 #ifdef USE_REVERSED_DEPTH_BUFFER 1946 float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1947 dp -= shadowBias; 1948 #else 1949 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 1950 dp += shadowBias; 1951 #endif 1952 float texelSize = shadowRadius / shadowMapSize.x; 1953 vec3 absDir = abs( bd3D ); 1954 vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); 1955 tangent = normalize( cross( bd3D, tangent ) ); 1956 vec3 bitangent = cross( bd3D, tangent ); 1957 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; 1958 vec2 sample0 = vogelDiskSample( 0, 5, phi ); 1959 vec2 sample1 = vogelDiskSample( 1, 5, phi ); 1960 vec2 sample2 = vogelDiskSample( 2, 5, phi ); 1961 vec2 sample3 = vogelDiskSample( 3, 5, phi ); 1962 vec2 sample4 = vogelDiskSample( 4, 5, phi ); 1963 shadow = ( 1964 texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + 1965 texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + 1966 texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + 1967 texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + 1968 texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) 1969 ) * 0.2; 1970 } 1971 return mix( 1.0, shadow, shadowIntensity ); 1972 } 1973 #elif defined( SHADOWMAP_TYPE_BASIC ) 1974 float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1975 float shadow = 1.0; 1976 vec3 lightToPosition = shadowCoord.xyz; 1977 vec3 absVec = abs( lightToPosition ); 1978 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 1979 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 1980 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 1981 dp += shadowBias; 1982 vec3 bd3D = normalize( lightToPosition ); 1983 float depth = textureCube( shadowMap, bd3D ).r; 1984 #ifdef USE_REVERSED_DEPTH_BUFFER 1985 depth = 1.0 - depth; 1986 #endif 1987 shadow = step( dp, depth ); 1988 } 1989 return mix( 1.0, shadow, shadowIntensity ); 1990 } 1991 #endif 1992 #endif 1993#endif`,QB=`#if NUM_SPOT_LIGHT_COORDS > 0 1994 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1995 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1996#endif 1997#ifdef USE_SHADOWMAP 1998 #if NUM_DIR_LIGHT_SHADOWS > 0 1999 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 2000 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 2001 struct DirectionalLightShadow { 2002 float shadowIntensity; 2003 float shadowBias; 2004 float shadowNormalBias; 2005 float shadowRadius; 2006 vec2 shadowMapSize; 2007 }; 2008 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 2009 #endif 2010 #if NUM_SPOT_LIGHT_SHADOWS > 0 2011 struct SpotLightShadow { 2012 float shadowIntensity; 2013 float shadowBias; 2014 float shadowNormalBias; 2015 float shadowRadius; 2016 vec2 shadowMapSize; 2017 }; 2018 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 2019 #endif 2020 #if NUM_POINT_LIGHT_SHADOWS > 0 2021 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 2022 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 2023 struct PointLightShadow { 2024 float shadowIntensity; 2025 float shadowBias; 2026 float shadowNormalBias; 2027 float shadowRadius; 2028 vec2 shadowMapSize; 2029 float shadowCameraNear; 2030 float shadowCameraFar; 2031 }; 2032 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 2033 #endif 2034#endif`,JB=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 2035 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 2036 vec4 shadowWorldPosition; 2037#endif 2038#if defined( USE_SHADOWMAP ) 2039 #if NUM_DIR_LIGHT_SHADOWS > 0 2040 #pragma unroll_loop_start 2041 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2042 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 2043 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 2044 } 2045 #pragma unroll_loop_end 2046 #endif 2047 #if NUM_POINT_LIGHT_SHADOWS > 0 2048 #pragma unroll_loop_start 2049 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2050 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 2051 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 2052 } 2053 #pragma unroll_loop_end 2054 #endif 2055#endif
2056#if NUM_SPOT_LIGHT_COORDS > 0 2057 #pragma unroll_loop_start 2058 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 2059 shadowWorldPosition = worldPosition; 2060 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 2061 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 2062 #endif 2063 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 2064 } 2065 #pragma unroll_loop_end 2066#endif`,eH=`float getShadowMask() { 2067 float shadow = 1.0; 2068 #ifdef USE_SHADOWMAP 2069 #if NUM_DIR_LIGHT_SHADOWS > 0 2070 DirectionalLightShadow directionalLight; 2071 #pragma unroll_loop_start 2072 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2073 directionalLight = directionalLightShadows[ i ]; 2074 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 2075 } 2076 #pragma unroll_loop_end 2077 #endif 2078 #if NUM_SPOT_LIGHT_SHADOWS > 0 2079 SpotLightShadow spotLight; 2080 #pragma unroll_loop_start 2081 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 2082 spotLight = spotLightShadows[ i ]; 2083 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 2084 } 2085 #pragma unroll_loop_end 2086 #endif 2087 #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 2088 PointLightShadow pointLight; 2089 #pragma unroll_loop_start 2090 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2091 pointLight = pointLightShadows[ i ]; 2092 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 2093 } 2094 #pragma unroll_loop_end 2095 #endif 2096 #endif 2097 return shadow; 2098}`,tH=`#ifdef USE_SKINNING 2099 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 2100 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 2101 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 2102 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 2103#endif`,nH=`#ifdef USE_SKINNING 2104 uniform mat4 bindMatrix; 2105 uniform mat4 bindMatrixInverse; 2106 uniform highp sampler2D boneTexture; 2107 mat4 getBoneMatrix( const in float i ) { 2108 int size = textureSize( boneTexture, 0 ).x; 2109 int j = int( i ) * 4; 2110 int x = j % size; 2111 int y = j / size; 2112 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2113 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2114 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2115 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2116 return mat4( v1, v2, v3, v4 ); 2117 } 2118#endif`,iH=`#ifdef USE_SKINNING 2119 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2120 vec4 skinned = vec4( 0.0 ); 2121 skinned += boneMatX * skinVertex * skinWeight.x; 2122 skinned += boneMatY * skinVertex * skinWeight.y; 2123 skinned += boneMatZ * skinVertex * skinWeight.z; 2124 skinned += boneMatW * skinVertex * skinWeight.w; 2125 transformed = ( bindMatrixInverse * skinned ).xyz; 2126#endif`,sH=`#ifdef USE_SKINNING 2127 mat4 skinMatrix = mat4( 0.0 ); 2128 skinMatrix += skinWeight.x * boneMatX; 2129 skinMatrix += skinWeight.y * boneMatY; 2130 skinMatrix += skinWeight.z * boneMatZ; 2131 skinMatrix += skinWeight.w * boneMatW; 2132 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2133 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2134 #ifdef USE_TANGENT 2135 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2136 #endif 2137#endif`,rH=`float specularStrength; 2138#ifdef USE_SPECULARMAP 2139 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2140 specularStrength = texelSpecular.r; 2141#else 2142 specularStrength = 1.0; 2143#endif`,aH=`#ifdef USE_SPECULARMAP 2144 uniform sampler2D specularMap; 2145#endif`,oH=`#if defined( TONE_MAPPING ) 2146 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2147#endif`,lH=`#ifndef saturate 2148#define saturate( a ) clamp( a, 0.0, 1.0 ) 2149#endif 2150uniform float toneMappingExposure; 2151vec3 LinearToneMapping( vec3 color ) { 2152 return saturate( toneMappingExposure * color ); 2153} 2154vec3 ReinhardToneMapping( vec3 color ) { 2155 color *= toneMappingExposure; 2156 return saturate( color / ( vec3( 1.0 ) + color ) ); 2157} 2158vec3 CineonToneMapping( vec3 color ) { 2159 color *= toneMappingExposure; 2160 color = max( vec3( 0.0 ), color - 0.004 ); 2161 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2162} 2163vec3 RRTAndODTFit( vec3 v ) { 2164 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2165 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2166 return a / b; 2167} 2168vec3 ACESFilmicToneMapping( vec3 color ) { 2169 const mat3 ACESInputMat = mat3( 2170 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2171 vec3( 0.04823, 0.01566, 0.83777 ) 2172 ); 2173 const mat3 ACESOutputMat = mat3( 2174 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2175 vec3( -0.07367, -0.00605, 1.07602 ) 2176 ); 2177 color *= toneMappingExposure / 0.6; 2178 color = ACESInputMat * color; 2179 color = RRTAndODTFit( color ); 2180 color = ACESOutputMat * color; 2181 return saturate( color ); 2182} 2183const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2184 vec3( 1.6605, - 0.1246, - 0.0182 ), 2185 vec3( - 0.5876, 1.1329, - 0.1006 ), 2186 vec3( - 0.0728, - 0.0083, 1.1187 ) 2187); 2188const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2189 vec3( 0.6274, 0.0691, 0.0164 ), 2190 vec3( 0.3293, 0.9195, 0.0880 ), 2191 vec3( 0.0433, 0.0113, 0.8956 ) 2192); 2193vec3 agxDefaultContrastApprox( vec3 x ) { 2194 vec3 x2 = x * x; 2195 vec3 x4 = x2 * x2; 2196 return + 15.5 * x4 * x2 2197 - 40.14 * x4 * x 2198 + 31.96 * x4 2199 - 6.868 * x2 * x 2200 + 0.4298 * x2 2201 + 0.1191 * x 2202 - 0.00232; 2203} 2204vec3 AgXToneMapping( vec3 color ) { 2205 const mat3 AgXInsetMatrix = mat3( 2206 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2207 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2208 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2209 );
2210 const mat3 AgXOutsetMatrix = mat3( 2211 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2212 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2213 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2214 ); 2215 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2216 color *= toneMappingExposure; 2217 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2218 color = AgXInsetMatrix * color; 2219 color = max( color, 1e-10 ); color = log2( color ); 2220 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2221 color = clamp( color, 0.0, 1.0 ); 2222 color = agxDefaultContrastApprox( color ); 2223 color = AgXOutsetMatrix * color; 2224 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2225 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2226 color = clamp( color, 0.0, 1.0 ); 2227 return color; 2228} 2229vec3 NeutralToneMapping( vec3 color ) { 2230 const float StartCompression = 0.8 - 0.04; 2231 const float Desaturation = 0.15; 2232 color *= toneMappingExposure; 2233 float x = min( color.r, min( color.g, color.b ) ); 2234 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2235 color -= offset; 2236 float peak = max( color.r, max( color.g, color.b ) ); 2237 if ( peak < StartCompression ) return color; 2238 float d = 1. - StartCompression; 2239 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2240 color *= newPeak / peak; 2241 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2242 return mix( color, vec3( newPeak ), g ); 2243} 2244vec3 CustomToneMapping( vec3 color ) { return color; }`,cH=`#ifdef USE_TRANSMISSION 2245 material.transmission = transmission; 2246 material.transmissionAlpha = 1.0; 2247 material.thickness = thickness; 2248 material.attenuationDistance = attenuationDistance; 2249 material.attenuationColor = attenuationColor; 2250 #ifdef USE_TRANSMISSIONMAP 2251 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2252 #endif 2253 #ifdef USE_THICKNESSMAP 2254 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2255 #endif 2256 vec3 pos = vWorldPosition; 2257 vec3 v = normalize( cameraPosition - pos ); 2258 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2259 vec4 transmitted = getIBLVolumeRefraction( 2260 n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, 2261 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2262 material.attenuationColor, material.attenuationDistance ); 2263 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2264 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2265#endif`,uH=`#ifdef USE_TRANSMISSION 2266 uniform float transmission; 2267 uniform float thickness; 2268 uniform float attenuationDistance; 2269 uniform vec3 attenuationColor; 2270 #ifdef USE_TRANSMISSIONMAP 2271 uniform sampler2D transmissionMap; 2272 #endif 2273 #ifdef USE_THICKNESSMAP 2274 uniform sampler2D thicknessMap; 2275 #endif 2276 uniform vec2 transmissionSamplerSize; 2277 uniform sampler2D transmissionSamplerMap; 2278 uniform mat4 modelMatrix; 2279 uniform mat4 projectionMatrix; 2280 varying vec3 vWorldPosition; 2281 float w0( float a ) { 2282 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2283 } 2284 float w1( float a ) { 2285 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2286 } 2287 float w2( float a ){ 2288 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2289 } 2290 float w3( float a ) { 2291 return ( 1.0 / 6.0 ) * ( a * a * a ); 2292 } 2293 float g0( float a ) { 2294 return w0( a ) + w1( a ); 2295 } 2296 float g1( float a ) { 2297 return w2( a ) + w3( a ); 2298 } 2299 float h0( float a ) { 2300 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2301 } 2302 float h1( float a ) { 2303 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2304 } 2305 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2306 uv = uv * texelSize.zw + 0.5; 2307 vec2 iuv = floor( uv ); 2308 vec2 fuv = fract( uv ); 2309 float g0x = g0( fuv.x ); 2310 float g1x = g1( fuv.x ); 2311 float h0x = h0( fuv.x ); 2312 float h1x = h1( fuv.x ); 2313 float h0y = h0( fuv.y ); 2314 float h1y = h1( fuv.y ); 2315 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2316 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2317 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2318 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2319 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2320 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2321 } 2322 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2323 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2324 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2325 vec2 fLodSizeInv = 1.0 / fLodSize; 2326 vec2 cLodSizeInv = 1.0 / cLodSize; 2327 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2328 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2329 return mix( fSample, cSample, fract( lod ) ); 2330 } 2331 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2332 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2333 vec3 modelScale; 2334 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2335 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2336 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2337 return normalize( refractionVector ) * thickness * modelScale; 2338 } 2339 float applyIorToRoughness( const in float roughness, const in float ior ) { 2340 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2341 } 2342 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2343 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2344 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2345 } 2346 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2347 if ( isinf( attenuationDistance ) ) { 2348 return vec3( 1.0 ); 2349 } else { 2350 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2351 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2352 } 2353 } 2354 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2355 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2356 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2357 const in vec3 attenuationColor, const in float attenuationDistance ) { 2358 vec4 transmittedLight; 2359 vec3 transmittance; 2360 #ifdef USE_DISPERSION 2361 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2362 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2363 for ( int i = 0; i < 3; i ++ ) { 2364 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2365 vec3 refractedRayExit = position + transmissionRay; 2366 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2367 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2368 refractionCoords += 1.0; 2369 refractionCoords /= 2.0; 2370 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2371 transmittedLight[ i ] = transmissionSample[ i ]; 2372 transmittedLight.a += transmissionSample.a; 2373 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2374 } 2375 transmittedLight.a /= 3.0; 2376 #else 2377 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2378 vec3 refractedRayExit = position + transmissionRay; 2379 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2380 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2381 refractionCoords += 1.0; 2382 refractionCoords /= 2.0; 2383 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2384 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2385 #endif 2386 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2387 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2388 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2389 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2390 } 2391#endif`,dH=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2392 varying vec2 vUv; 2393#endif 2394#ifdef USE_MAP 2395 varying vec2 vMapUv; 2396#endif 2397#ifdef USE_ALPHAMAP
2398 varying vec2 vAlphaMapUv; 2399#endif 2400#ifdef USE_LIGHTMAP 2401 varying vec2 vLightMapUv; 2402#endif 2403#ifdef USE_AOMAP 2404 varying vec2 vAoMapUv; 2405#endif 2406#ifdef USE_BUMPMAP 2407 varying vec2 vBumpMapUv; 2408#endif 2409#ifdef USE_NORMALMAP 2410 varying vec2 vNormalMapUv; 2411#endif 2412#ifdef USE_EMISSIVEMAP 2413 varying vec2 vEmissiveMapUv; 2414#endif 2415#ifdef USE_METALNESSMAP 2416 varying vec2 vMetalnessMapUv; 2417#endif 2418#ifdef USE_ROUGHNESSMAP 2419 varying vec2 vRoughnessMapUv; 2420#endif 2421#ifdef USE_ANISOTROPYMAP 2422 varying vec2 vAnisotropyMapUv; 2423#endif 2424#ifdef USE_CLEARCOATMAP 2425 varying vec2 vClearcoatMapUv; 2426#endif 2427#ifdef USE_CLEARCOAT_NORMALMAP 2428 varying vec2 vClearcoatNormalMapUv; 2429#endif 2430#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2431 varying vec2 vClearcoatRoughnessMapUv; 2432#endif 2433#ifdef USE_IRIDESCENCEMAP 2434 varying vec2 vIridescenceMapUv; 2435#endif 2436#ifdef USE_IRIDESCENCE_THICKNESSMAP 2437 varying vec2 vIridescenceThicknessMapUv; 2438#endif 2439#ifdef USE_SHEEN_COLORMAP 2440 varying vec2 vSheenColorMapUv; 2441#endif 2442#ifdef USE_SHEEN_ROUGHNESSMAP 2443 varying vec2 vSheenRoughnessMapUv; 2444#endif 2445#ifdef USE_SPECULARMAP 2446 varying vec2 vSpecularMapUv; 2447#endif 2448#ifdef USE_SPECULAR_COLORMAP 2449 varying vec2 vSpecularColorMapUv; 2450#endif 2451#ifdef USE_SPECULAR_INTENSITYMAP 2452 varying vec2 vSpecularIntensityMapUv; 2453#endif 2454#ifdef USE_TRANSMISSIONMAP 2455 uniform mat3 transmissionMapTransform; 2456 varying vec2 vTransmissionMapUv; 2457#endif 2458#ifdef USE_THICKNESSMAP 2459 uniform mat3 thicknessMapTransform; 2460 varying vec2 vThicknessMapUv; 2461#endif`,hH=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2462 varying vec2 vUv; 2463#endif 2464#ifdef USE_MAP 2465 uniform mat3 mapTransform; 2466 varying vec2 vMapUv; 2467#endif 2468#ifdef USE_ALPHAMAP 2469 uniform mat3 alphaMapTransform; 2470 varying vec2 vAlphaMapUv; 2471#endif 2472#ifdef USE_LIGHTMAP 2473 uniform mat3 lightMapTransform; 2474 varying vec2 vLightMapUv; 2475#endif 2476#ifdef USE_AOMAP 2477 uniform mat3 aoMapTransform; 2478 varying vec2 vAoMapUv; 2479#endif 2480#ifdef USE_BUMPMAP 2481 uniform mat3 bumpMapTransform; 2482 varying vec2 vBumpMapUv; 2483#endif 2484#ifdef USE_NORMALMAP 2485 uniform mat3 normalMapTransform; 2486 varying vec2 vNormalMapUv; 2487#endif 2488#ifdef USE_DISPLACEMENTMAP 2489 uniform mat3 displacementMapTransform; 2490 varying vec2 vDisplacementMapUv; 2491#endif 2492#ifdef USE_EMISSIVEMAP 2493 uniform mat3 emissiveMapTransform; 2494 varying vec2 vEmissiveMapUv; 2495#endif 2496#ifdef USE_METALNESSMAP 2497 uniform mat3 metalnessMapTransform; 2498 varying vec2 vMetalnessMapUv; 2499#endif 2500#ifdef USE_ROUGHNESSMAP 2501 uniform mat3 roughnessMapTransform; 2502 varying vec2 vRoughnessMapUv; 2503#endif 2504#ifdef USE_ANISOTROPYMAP 2505 uniform mat3 anisotropyMapTransform; 2506 varying vec2 vAnisotropyMapUv; 2507#endif 2508#ifdef USE_CLEARCOATMAP 2509 uniform mat3 clearcoatMapTransform; 2510 varying vec2 vClearcoatMapUv; 2511#endif 2512#ifdef USE_CLEARCOAT_NORMALMAP 2513 uniform mat3 clearcoatNormalMapTransform; 2514 varying vec2 vClearcoatNormalMapUv; 2515#endif 2516#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2517 uniform mat3 clearcoatRoughnessMapTransform; 2518 varying vec2 vClearcoatRoughnessMapUv; 2519#endif 2520#ifdef USE_SHEEN_COLORMAP 2521 uniform mat3 sheenColorMapTransform; 2522 varying vec2 vSheenColorMapUv; 2523#endif 2524#ifdef USE_SHEEN_ROUGHNESSMAP 2525 uniform mat3 sheenRoughnessMapTransform; 2526 varying vec2 vSheenRoughnessMapUv; 2527#endif 2528#ifdef USE_IRIDESCENCEMAP 2529 uniform mat3 iridescenceMapTransform; 2530 varying vec2 vIridescenceMapUv; 2531#endif 2532#ifdef USE_IRIDESCENCE_THICKNESSMAP 2533 uniform mat3 iridescenceThicknessMapTransform; 2534 varying vec2 vIridescenceThicknessMapUv; 2535#endif 2536#ifdef USE_SPECULARMAP 2537 uniform mat3 specularMapTransform; 2538 varying vec2 vSpecularMapUv; 2539#endif 2540#ifdef USE_SPECULAR_COLORMAP 2541 uniform mat3 specularColorMapTransform; 2542 varying vec2 vSpecularColorMapUv; 2543#endif 2544#ifdef USE_SPECULAR_INTENSITYMAP 2545 uniform mat3 specularIntensityMapTransform; 2546 varying vec2 vSpecularIntensityMapUv; 2547#endif 2548#ifdef USE_TRANSMISSIONMAP 2549 uniform mat3 transmissionMapTransform; 2550 varying vec2 vTransmissionMapUv; 2551#endif 2552#ifdef USE_THICKNESSMAP 2553 uniform mat3 thicknessMapTransform; 2554 varying vec2 vThicknessMapUv; 2555#endif`,fH=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2556 vUv = vec3( uv, 1 ).xy; 2557#endif 2558#ifdef USE_MAP 2559 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2560#endif 2561#ifdef USE_ALPHAMAP 2562 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2563#endif 2564#ifdef USE_LIGHTMAP 2565 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2566#endif 2567#ifdef USE_AOMAP 2568 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2569#endif 2570#ifdef USE_BUMPMAP 2571 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2572#endif 2573#ifdef USE_NORMALMAP 2574 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2575#endif 2576#ifdef USE_DISPLACEMENTMAP 2577 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2578#endif 2579#ifdef USE_EMISSIVEMAP 2580 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2581#endif 2582#ifdef USE_METALNESSMAP 2583 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2584#endif 2585#ifdef USE_ROUGHNESSMAP 2586 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2587#endif 2588#ifdef USE_ANISOTROPYMAP 2589 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2590#endif 2591#ifdef USE_CLEARCOATMAP 2592 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2593#endif 2594#ifdef USE_CLEARCOAT_NORMALMAP 2595 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2596#endif 2597#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2598 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2599#endif
2600#ifdef USE_IRIDESCENCEMAP 2601 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2602#endif 2603#ifdef USE_IRIDESCENCE_THICKNESSMAP 2604 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2605#endif 2606#ifdef USE_SHEEN_COLORMAP 2607 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2608#endif 2609#ifdef USE_SHEEN_ROUGHNESSMAP 2610 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2611#endif 2612#ifdef USE_SPECULARMAP 2613 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2614#endif 2615#ifdef USE_SPECULAR_COLORMAP 2616 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2617#endif 2618#ifdef USE_SPECULAR_INTENSITYMAP 2619 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2620#endif 2621#ifdef USE_TRANSMISSIONMAP 2622 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2623#endif 2624#ifdef USE_THICKNESSMAP 2625 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2626#endif`,pH=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2627 vec4 worldPosition = vec4( transformed, 1.0 ); 2628 #ifdef USE_BATCHING 2629 worldPosition = batchingMatrix * worldPosition; 2630 #endif 2631 #ifdef USE_INSTANCING 2632 worldPosition = instanceMatrix * worldPosition; 2633 #endif 2634 worldPosition = modelMatrix * worldPosition; 2635#endif`;const mH=`varying vec2 vUv; 2636uniform mat3 uvTransform; 2637void main() { 2638 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2639 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2640}`,gH=`uniform sampler2D t2D; 2641uniform float backgroundIntensity; 2642varying vec2 vUv; 2643void main() { 2644 vec4 texColor = texture2D( t2D, vUv ); 2645 #ifdef DECODE_VIDEO_TEXTURE 2646 texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); 2647 #endif 2648 texColor.rgb *= backgroundIntensity; 2649 gl_FragColor = texColor; 2650 #include <tonemapping_fragment> 2651 #include <colorspace_fragment> 2652}`,xH=`varying vec3 vWorldDirection; 2653#include <common> 2654void main() { 2655 vWorldDirection = transformDirection( position, modelMatrix ); 2656 #include <begin_vertex> 2657 #include <project_vertex> 2658 gl_Position.z = gl_Position.w; 2659}`,bH=`#ifdef ENVMAP_TYPE_CUBE 2660 uniform samplerCube envMap; 2661#elif defined( ENVMAP_TYPE_CUBE_UV ) 2662 uniform sampler2D envMap; 2663#endif 2664uniform float flipEnvMap; 2665uniform float backgroundBlurriness; 2666uniform float backgroundIntensity; 2667uniform mat3 backgroundRotation; 2668varying vec3 vWorldDirection; 2669#include <cube_uv_reflection_fragment> 2670void main() { 2671 #ifdef ENVMAP_TYPE_CUBE 2672 vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2673 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2674 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2675 #else 2676 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2677 #endif 2678 texColor.rgb *= backgroundIntensity; 2679 gl_FragColor = texColor; 2680 #include <tonemapping_fragment> 2681 #include <colorspace_fragment> 2682}`,vH=`varying vec3 vWorldDirection; 2683#include <common> 2684void main() { 2685 vWorldDirection = transformDirection( position, modelMatrix ); 2686 #include <begin_vertex> 2687 #include <project_vertex> 2688 gl_Position.z = gl_Position.w; 2689}`,yH=`uniform samplerCube tCube; 2690uniform float tFlip; 2691uniform float opacity; 2692varying vec3 vWorldDirection; 2693void main() { 2694 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2695 gl_FragColor = texColor; 2696 gl_FragColor.a *= opacity; 2697 #include <tonemapping_fragment> 2698 #include <colorspace_fragment> 2699}`,_H=`#include <common> 2700#include <batching_pars_vertex> 2701#include <uv_pars_vertex> 2702#include <displacementmap_pars_vertex> 2703#include <morphtarget_pars_vertex> 2704#include <skinning_pars_vertex> 2705#include <logdepthbuf_pars_vertex> 2706#include <clipping_planes_pars_vertex> 2707varying vec2 vHighPrecisionZW; 2708void main() { 2709 #include <uv_vertex> 2710 #include <batching_vertex> 2711 #include <skinbase_vertex> 2712 #include <morphinstance_vertex> 2713 #ifdef USE_DISPLACEMENTMAP 2714 #include <beginnormal_vertex> 2715 #include <morphnormal_vertex> 2716 #include <skinnormal_vertex> 2717 #endif 2718 #include <begin_vertex> 2719 #include <morphtarget_vertex> 2720 #include <skinning_vertex> 2721 #include <displacementmap_vertex> 2722 #include <project_vertex> 2723 #include <logdepthbuf_vertex> 2724 #include <clipping_planes_vertex> 2725 vHighPrecisionZW = gl_Position.zw; 2726}`,wH=`#if DEPTH_PACKING == 3200 2727 uniform float opacity; 2728#endif 2729#include <common> 2730#include <packing> 2731#include <uv_pars_fragment> 2732#include <map_pars_fragment> 2733#include <alphamap_pars_fragment> 2734#include <alphatest_pars_fragment> 2735#include <alphahash_pars_fragment> 2736#include <logdepthbuf_pars_fragment> 2737#include <clipping_planes_pars_fragment> 2738varying vec2 vHighPrecisionZW; 2739void main() { 2740 vec4 diffuseColor = vec4( 1.0 ); 2741 #include <clipping_planes_fragment> 2742 #if DEPTH_PACKING == 3200 2743 diffuseColor.a = opacity; 2744 #endif 2745 #include <map_fragment> 2746 #include <alphamap_fragment> 2747 #include <alphatest_fragment> 2748 #include <alphahash_fragment> 2749 #include <logdepthbuf_fragment> 2750 #ifdef USE_REVERSED_DEPTH_BUFFER 2751 float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; 2752 #else 2753 float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; 2754 #endif 2755 #if DEPTH_PACKING == 3200 2756 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2757 #elif DEPTH_PACKING == 3201 2758 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2759 #elif DEPTH_PACKING == 3202 2760 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2761 #elif DEPTH_PACKING == 3203 2762 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2763 #endif 2764}`,SH=`#define DISTANCE 2765varying vec3 vWorldPosition; 2766#include <common> 2767#include <batching_pars_vertex> 2768#include <uv_pars_vertex> 2769#include <displacementmap_pars_vertex> 2770#include <morphtarget_pars_vertex> 2771#include <skinning_pars_vertex> 2772#include <clipping_planes_pars_vertex> 2773void main() { 2774 #include <uv_vertex> 2775 #include <batching_vertex> 2776 #include <skinbase_vertex> 2777 #include <morphinstance_vertex> 2778 #ifdef USE_DISPLACEMENTMAP 2779 #include <beginnormal_vertex> 2780 #include <morphnormal_vertex> 2781 #include <skinnormal_vertex> 2782 #endif 2783 #include <begin_vertex> 2784 #include <morphtarget_vertex> 2785 #include <skinning_vertex> 2786 #include <displacementmap_vertex> 2787 #include <project_vertex> 2788 #include <worldpos_vertex> 2789 #include <clipping_planes_vertex> 2790 vWorldPosition = worldPosition.xyz; 2791}`,EH=`#define DISTANCE 2792uniform vec3 referencePosition; 2793uniform float nearDistance; 2794uniform float farDistance; 2795varying vec3 vWorldPosition; 2796#include <common> 2797#include <uv_pars_fragment> 2798#include <map_pars_fragment> 2799#include <alphamap_pars_fragment> 2800#include <alphatest_pars_fragment> 2801#include <alphahash_pars_fragment> 2802#include <clipping_planes_pars_fragment> 2803void main () { 2804 vec4 diffuseColor = vec4( 1.0 ); 2805 #include <clipping_planes_fragment> 2806 #include <map_fragment> 2807 #include <alphamap_fragment> 2808 #include <alphatest_fragment> 2809 #include <alphahash_fragment> 2810 float dist = length( vWorldPosition - referencePosition ); 2811 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2812 dist = saturate( dist ); 2813 gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); 2814}`,CH=`varying vec3 vWorldDirection; 2815#include <common> 2816void main() { 2817 vWorldDirection = transformDirection( position, modelMatrix ); 2818 #include <begin_vertex> 2819 #include <project_vertex> 2820}`,NH=`uniform sampler2D tEquirect; 2821varying vec3 vWorldDirection; 2822#include <common> 2823void main() { 2824 vec3 direction = normalize( vWorldDirection ); 2825 vec2 sampleUV = equirectUv( direction ); 2826 gl_FragColor = texture2D( tEquirect, sampleUV ); 2827 #include <tonemapping_fragment> 2828 #include <colorspace_fragment> 2829}`,TH=`uniform float scale; 2830attribute float lineDistance; 2831varying float vLineDistance; 2832#include <common> 2833#include <uv_pars_vertex> 2834#include <color_pars_vertex> 2835#include <fog_pars_vertex> 2836#include <morphtarget_pars_vertex> 2837#include <logdepthbuf_pars_vertex> 2838#include <clipping_planes_pars_vertex> 2839void main() { 2840 vLineDistance = scale * lineDistance; 2841 #include <uv_vertex> 2842 #include <color_vertex> 2843 #include <morphinstance_vertex> 2844 #include <morphcolor_vertex> 2845 #include <begin_vertex> 2846 #include <morphtarget_vertex> 2847 #include <project_vertex> 2848 #include <logdepthbuf_vertex> 2849 #include <clipping_planes_vertex> 2850 #include <fog_vertex> 2851}`,MH=`uniform vec3 diffuse; 2852uniform float opacity; 2853uniform float dashSize; 2854uniform float totalSize; 2855varying float vLineDistance; 2856#include <common> 2857#include <color_pars_fragment> 2858#include <uv_pars_fragment> 2859#include <map_pars_fragment> 2860#include <fog_pars_fragment> 2861#include <logdepthbuf_pars_fragment> 2862#include <clipping_planes_pars_fragment> 2863void main() { 2864 vec4 diffuseColor = vec4( diffuse, opacity ); 2865 #include <clipping_planes_fragment> 2866 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2867 discard; 2868 } 2869 vec3 outgoingLight = vec3( 0.0 ); 2870 #include <logdepthbuf_fragment> 2871 #include <map_fragment> 2872 #include <color_fragment> 2873 outgoingLight = diffuseColor.rgb; 2874 #include <opaque_fragment> 2875 #include <tonemapping_fragment> 2876 #include <colorspace_fragment> 2877 #include <fog_fragment> 2878 #include <premultiplied_alpha_fragment> 2879}`,AH=`#include <common> 2880#include <batching_pars_vertex> 2881#include <uv_pars_vertex> 2882#include <envmap_pars_vertex> 2883#include <color_pars_vertex> 2884#include <fog_pars_vertex> 2885#include <morphtarget_pars_vertex> 2886#include <skinning_pars_vertex> 2887#include <logdepthbuf_pars_vertex> 2888#include <clipping_planes_pars_vertex> 2889void main() { 2890 #include <uv_vertex> 2891 #include <color_vertex> 2892 #include <morphinstance_vertex> 2893 #include <morphcolor_vertex> 2894 #include <batching_vertex> 2895 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2896 #include <beginnormal_vertex> 2897 #include <morphnormal_vertex> 2898 #include <skinbase_vertex> 2899 #include <skinnormal_vertex> 2900 #include <defaultnormal_vertex> 2901 #endif 2902 #include <begin_vertex> 2903 #include <morphtarget_vertex> 2904 #include <skinning_vertex> 2905 #include <project_vertex> 2906 #include <logdepthbuf_vertex> 2907 #include <clipping_planes_vertex> 2908 #include <worldpos_vertex> 2909 #include <envmap_vertex> 2910 #include <fog_vertex> 2911}`,RH=`uniform vec3 diffuse; 2912uniform float opacity; 2913#ifndef FLAT_SHADED 2914 varying vec3 vNormal; 2915#endif 2916#include <common> 2917#include <dithering_pars_fragment> 2918#include <color_pars_fragment> 2919#include <uv_pars_fragment> 2920#include <map_pars_fragment> 2921#include <alphamap_pars_fragment> 2922#include <alphatest_pars_fragment> 2923#include <alphahash_pars_fragment> 2924#include <aomap_pars_fragment> 2925#include <lightmap_pars_fragment> 2926#include <envmap_common_pars_fragment> 2927#include <envmap_pars_fragment> 2928#include <fog_pars_fragment> 2929#include <specularmap_pars_fragment> 2930#include <logdepthbuf_pars_fragment> 2931#include <clipping_planes_pars_fragment> 2932void main() { 2933 vec4 diffuseColor = vec4( diffuse, opacity ); 2934 #include <clipping_planes_fragment> 2935 #include <logdepthbuf_fragment> 2936 #include <map_fragment> 2937 #include <color_fragment> 2938 #include <alphamap_fragment> 2939 #include <alphatest_fragment> 2940 #include <alphahash_fragment> 2941 #include <specularmap_fragment> 2942 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2943 #ifdef USE_LIGHTMAP 2944 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2945 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2946 #else 2947 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2948 #endif 2949 #include <aomap_fragment> 2950 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2951 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2952 #include <envmap_fragment> 2953 #include <opaque_fragment> 2954 #include <tonemapping_fragment> 2955 #include <colorspace_fragment> 2956 #include <fog_fragment> 2957 #include <premultiplied_alpha_fragment> 2958 #include <dithering_fragment> 2959}`,kH=`#define LAMBERT 2960varying vec3 vViewPosition; 2961#include <common> 2962#include <batching_pars_vertex> 2963#include <uv_pars_vertex> 2964#include <displacementmap_pars_vertex> 2965#include <envmap_pars_vertex> 2966#include <color_pars_vertex> 2967#include <fog_pars_vertex> 2968#include <normal_pars_vertex> 2969#include <morphtarget_pars_vertex> 2970#include <skinning_pars_vertex> 2971#include <shadowmap_pars_vertex> 2972#include <logdepthbuf_pars_vertex> 2973#include <clipping_planes_pars_vertex> 2974void main() { 2975 #include <uv_vertex> 2976 #include <color_vertex> 2977 #include <morphinstance_vertex> 2978 #include <morphcolor_vertex> 2979 #include <batching_vertex> 2980 #include <beginnormal_vertex> 2981 #include <morphnormal_vertex> 2982 #include <skinbase_vertex> 2983 #include <skinnormal_vertex> 2984 #include <defaultnormal_vertex> 2985 #include <normal_vertex> 2986 #include <begin_vertex> 2987 #include <morphtarget_vertex> 2988 #include <skinning_vertex> 2989 #include <displacementmap_vertex> 2990 #include <project_vertex> 2991 #include <logdepthbuf_vertex> 2992 #include <clipping_planes_vertex> 2993 vViewPosition = - mvPosition.xyz; 2994 #include <worldpos_vertex> 2995 #include <envmap_vertex> 2996 #include <shadowmap_vertex> 2997 #include <fog_vertex> 2998}`,jH=`#define LAMBERT 2999uniform vec3 diffuse; 3000uniform vec3 emissive; 3001uniform float opacity; 3002#include <common> 3003#include <dithering_pars_fragment> 3004#include <color_pars_fragment> 3005#include <uv_pars_fragment> 3006#include <map_pars_fragment> 3007#include <alphamap_pars_fragment> 3008#include <alphatest_pars_fragment> 3009#include <alphahash_pars_fragment> 3010#include <aomap_pars_fragment> 3011#include <lightmap_pars_fragment> 3012#include <emissivemap_pars_fragment> 3013#include <cube_uv_reflection_fragment> 3014#include <envmap_common_pars_fragment> 3015#include <envmap_pars_fragment> 3016#include <envmap_physical_pars_fragment> 3017#include <fog_pars_fragment> 3018#include <bsdfs> 3019#include <lights_pars_begin> 3020#include <normal_pars_fragment> 3021#include <lights_lambert_pars_fragment> 3022#include <shadowmap_pars_fragment> 3023#include <bumpmap_pars_fragment> 3024#include <normalmap_pars_fragment> 3025#include <specularmap_pars_fragment> 3026#include <logdepthbuf_pars_fragment> 3027#include <clipping_planes_pars_fragment> 3028void main() { 3029 vec4 diffuseColor = vec4( diffuse, opacity ); 3030 #include <clipping_planes_fragment> 3031 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3032 vec3 totalEmissiveRadiance = emissive; 3033 #include <logdepthbuf_fragment> 3034 #include <map_fragment> 3035 #include <color_fragment> 3036 #include <alphamap_fragment> 3037 #include <alphatest_fragment> 3038 #include <alphahash_fragment> 3039 #include <specularmap_fragment> 3040 #include <normal_fragment_begin> 3041 #include <normal_fragment_maps> 3042 #include <emissivemap_fragment> 3043 #include <lights_lambert_fragment> 3044 #include <lights_fragment_begin> 3045 #include <lights_fragment_maps> 3046 #include <lights_fragment_end> 3047 #include <aomap_fragment> 3048 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3049 #include <envmap_fragment> 3050 #include <opaque_fragment> 3051 #include <tonemapping_fragment> 3052 #include <colorspace_fragment> 3053 #include <fog_fragment> 3054 #include <premultiplied_alpha_fragment> 3055 #include <dithering_fragment> 3056}`,LH=`#define MATCAP 3057varying vec3 vViewPosition; 3058#include <common> 3059#include <batching_pars_vertex> 3060#include <uv_pars_vertex> 3061#include <color_pars_vertex> 3062#include <displacementmap_pars_vertex> 3063#include <fog_pars_vertex> 3064#include <normal_pars_vertex> 3065#include <morphtarget_pars_vertex> 3066#include <skinning_pars_vertex> 3067#include <logdepthbuf_pars_vertex> 3068#include <clipping_planes_pars_vertex> 3069void main() { 3070 #include <uv_vertex> 3071 #include <color_vertex> 3072 #include <morphinstance_vertex> 3073 #include <morphcolor_vertex> 3074 #include <batching_vertex> 3075 #include <beginnormal_vertex> 3076 #include <morphnormal_vertex> 3077 #include <skinbase_vertex> 3078 #include <skinnormal_vertex> 3079 #include <defaultnormal_vertex> 3080 #include <normal_vertex> 3081 #include <begin_vertex> 3082 #include <morphtarget_vertex> 3083 #include <skinning_vertex> 3084 #include <displacementmap_vertex> 3085 #include <project_vertex> 3086 #include <logdepthbuf_vertex> 3087 #include <clipping_planes_vertex> 3088 #include <fog_vertex> 3089 vViewPosition = - mvPosition.xyz; 3090}`,PH=`#define MATCAP 3091uniform vec3 diffuse; 3092uniform float opacity; 3093uniform sampler2D matcap; 3094varying vec3 vViewPosition; 3095#include <common> 3096#include <dithering_pars_fragment> 3097#include <color_pars_fragment> 3098#include <uv_pars_fragment> 3099#include <map_pars_fragment> 3100#include <alphamap_pars_fragment> 3101#include <alphatest_pars_fragment> 3102#include <alphahash_pars_fragment> 3103#include <fog_pars_fragment> 3104#include <normal_pars_fragm
3104ent> 3105#include <bumpmap_pars_fragment> 3106#include <normalmap_pars_fragment> 3107#include <logdepthbuf_pars_fragment> 3108#include <clipping_planes_pars_fragment> 3109void main() { 3110 vec4 diffuseColor = vec4( diffuse, opacity ); 3111 #include <clipping_planes_fragment> 3112 #include <logdepthbuf_fragment> 3113 #include <map_fragment> 3114 #include <color_fragment> 3115 #include <alphamap_fragment> 3116 #include <alphatest_fragment> 3117 #include <alphahash_fragment> 3118 #include <normal_fragment_begin> 3119 #include <normal_fragment_maps> 3120 vec3 viewDir = normalize( vViewPosition ); 3121 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3122 vec3 y = cross( viewDir, x ); 3123 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3124 #ifdef USE_MATCAP 3125 vec4 matcapColor = texture2D( matcap, uv ); 3126 #else 3127 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3128 #endif 3129 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3130 #include <opaque_fragment> 3131 #include <tonemapping_fragment> 3132 #include <colorspace_fragment> 3133 #include <fog_fragment> 3134 #include <premultiplied_alpha_fragment> 3135 #include <dithering_fragment> 3136}`,OH=`#define NORMAL 3137#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3138 varying vec3 vViewPosition; 3139#endif 3140#include <common> 3141#include <batching_pars_vertex> 3142#include <uv_pars_vertex> 3143#include <displacementmap_pars_vertex> 3144#include <normal_pars_vertex> 3145#include <morphtarget_pars_vertex> 3146#include <skinning_pars_vertex> 3147#include <logdepthbuf_pars_vertex> 3148#include <clipping_planes_pars_vertex> 3149void main() { 3150 #include <uv_vertex> 3151 #include <batching_vertex> 3152 #include <beginnormal_vertex> 3153 #include <morphinstance_vertex> 3154 #include <morphnormal_vertex> 3155 #include <skinbase_vertex> 3156 #include <skinnormal_vertex> 3157 #include <defaultnormal_vertex> 3158 #include <normal_vertex> 3159 #include <begin_vertex> 3160 #include <morphtarget_vertex> 3161 #include <skinning_vertex> 3162 #include <displacementmap_vertex> 3163 #include <project_vertex> 3164 #include <logdepthbuf_vertex> 3165 #include <clipping_planes_vertex> 3166#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3167 vViewPosition = - mvPosition.xyz; 3168#endif 3169}`,DH=`#define NORMAL 3170uniform float opacity; 3171#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3172 varying vec3 vViewPosition; 3173#endif 3174#include <uv_pars_fragment> 3175#include <normal_pars_fragment> 3176#include <bumpmap_pars_fragment> 3177#include <normalmap_pars_fragment> 3178#include <logdepthbuf_pars_fragment> 3179#include <clipping_planes_pars_fragment> 3180void main() { 3181 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3182 #include <clipping_planes_fragment> 3183 #include <logdepthbuf_fragment> 3184 #include <normal_fragment_begin> 3185 #include <normal_fragment_maps> 3186 gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); 3187 #ifdef OPAQUE 3188 gl_FragColor.a = 1.0; 3189 #endif 3190}`,UH=`#define PHONG 3191varying vec3 vViewPosition; 3192#include <common> 3193#include <batching_pars_vertex> 3194#include <uv_pars_vertex> 3195#include <displacementmap_pars_vertex> 3196#include <envmap_pars_vertex> 3197#include <color_pars_vertex> 3198#include <fog_pars_vertex> 3199#include <normal_pars_vertex> 3200#include <morphtarget_pars_vertex> 3201#include <skinning_pars_vertex> 3202#include <shadowmap_pars_vertex> 3203#include <logdepthbuf_pars_vertex> 3204#include <clipping_planes_pars_vertex> 3205void main() { 3206 #include <uv_vertex> 3207 #include <color_vertex> 3208 #include <morphcolor_vertex> 3209 #include <batching_vertex> 3210 #include <beginnormal_vertex> 3211 #include <morphinstance_vertex> 3212 #include <morphnormal_vertex> 3213 #include <skinbase_vertex> 3214 #include <skinnormal_vertex> 3215 #include <defaultnormal_vertex> 3216 #include <normal_vertex> 3217 #include <begin_vertex> 3218 #include <morphtarget_vertex> 3219 #include <skinning_vertex> 3220 #include <displacementmap_vertex> 3221 #include <project_vertex> 3222 #include <logdepthbuf_vertex> 3223 #include <clipping_planes_vertex> 3224 vViewPosition = - mvPosition.xyz; 3225 #include <worldpos_vertex> 3226 #include <envmap_vertex> 3227 #include <shadowmap_vertex> 3228 #include <fog_vertex> 3229}`,IH=`#define PHONG 3230uniform vec3 diffuse; 3231uniform vec3 emissive; 3232uniform vec3 specular; 3233uniform float shininess; 3234uniform float opacity; 3235#include <common> 3236#include <dithering_pars_fragment> 3237#include <color_pars_fragment> 3238#include <uv_pars_fragment> 3239#include <map_pars_fragment> 3240#include <alphamap_pars_fragment> 3241#include <alphatest_pars_fragment> 3242#include <alphahash_pars_fragment> 3243#include <aomap_pars_fragment> 3244#include <lightmap_pars_fragment> 3245#include <emissivemap_pars_fragment> 3246#include <cube_uv_reflection_fragment> 3247#include <envmap_common_pars_fragment> 3248#include <envmap_pars_fragment> 3249#include <envmap_physical_pars_fragment> 3250#include <fog_pars_fragment> 3251#include <bsdfs> 3252#include <lights_pars_begin> 3253#include <normal_pars_fragment> 3254#include <lights_phong_pars_fragment> 3255#include <shadowmap_pars_fragment> 3256#include <bumpmap_pars_fragment> 3257#include <normalmap_pars_fragment> 3258#include <specularmap_pars_fragment> 3259#include <logdepthbuf_pars_fragment> 3260#include <clipping_planes_pars_fragment> 3261void main() { 3262 vec4 diffuseColor = vec4( diffuse, opacity ); 3263 #include <clipping_planes_fragment> 3264 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3265 vec3 totalEmissiveRadiance = emissive; 3266 #include <logdepthbuf_fragment> 3267 #include <map_fragment> 3268 #include <color_fragment> 3269 #include <alphamap_fragment> 3270 #include <alphatest_fragment> 3271 #include <alphahash_fragment> 3272 #include <specularmap_fragment> 3273 #include <normal_fragment_begin> 3274 #include <normal_fragment_maps> 3275 #include <emissivemap_fragment> 3276 #include <lights_phong_fragment> 3277 #include <lights_fragment_begin> 3278 #include <lights_fragment_maps> 3279 #include <lights_fragment_end> 3280 #include <aomap_fragment> 3281 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3282 #include <envmap_fragment> 3283 #include <opaque_fragment> 3284 #include <tonemapping_fragment> 3285 #include <colorspace_fragment> 3286 #include <fog_fragment> 3287 #include <premultiplied_alpha_fragment> 3288 #include <dithering_fragment> 3289}`,zH=`#define STANDARD 3290varying vec3 vViewPosition; 3291#ifdef USE_TRANSMISSION 3292 varying vec3 vWorldPosition; 3293#endif 3294#include <common> 3295#include <batching_pars_vertex> 3296#include <uv_pars_vertex> 3297#include <displacementmap_pars_vertex> 3298#include <color_pars_vertex> 3299#include <fog_pars_vertex> 3300#include <normal_pars_vertex> 3301#include <morphtarget_pars_vertex> 3302#include <skinning_pars_vertex> 3303#include <shadowmap_pars_vertex> 3304#include <logdepthbuf_pars_vertex> 3305#include <clipping_planes_pars_vertex> 3306void main() { 3307 #include <uv_vertex> 3308 #include <color_vertex> 3309 #include <morphinstance_vertex> 3310 #include <morphcolor_vertex> 3311 #include <batching_vertex> 3312 #include <beginnormal_vertex> 3313 #include <morphnormal_vertex> 3314 #include <skinbase_vertex> 3315 #include <skinnormal_vertex> 3316 #include <defaultnormal_vertex> 3317 #include <normal_vertex> 3318 #include <begin_vertex> 3319 #include <morphtarget_vertex> 3320 #include <skinning_vertex> 3321 #include <displacementmap_vertex> 3322 #include <project_vertex> 3323 #include <logdepthbuf_vertex> 3324 #include <clipping_planes_vertex> 3325 vViewPosition = - mvPosition.xyz; 3326 #include <worldpos_vertex> 3327 #include <shadowmap_vertex> 3328 #include <fog_vertex> 3329#ifdef USE_TRANSMISSION 3330 vWorldPosition = worldPosition.xyz; 3331#endif 3332}`,$H=`#define STANDARD 3333#ifdef PHYSICAL 3334 #define IOR 3335 #define USE_SPECULAR 3336#endif 3337uniform vec3 diffuse; 3338uniform vec3 emissive; 3339uniform float roughness; 3340uniform float metalness; 3341uniform float opacity; 3342#ifdef IOR 3343 uniform float ior; 3344#endif 3345#ifdef USE_SPECULAR 3346 uniform float specularIntensity; 3347 uniform vec3 specularColor; 3348 #ifdef USE_SPECULAR_COLORMAP 3349 uniform sampler2D specularColorMap; 3350 #endif 3351 #ifdef USE_SPECULAR_INTENSITYMAP 3352 uniform sampler2D specularIntensityMap; 3353 #endif 3354#endif 3355#ifdef USE_CLEARCOAT 3356 uniform float clearcoat; 3357 uniform float clearcoatRoughness; 3358#endif 3359#ifdef USE_DISPERSION 3360 uniform float dispersion; 3361#endif
3362#ifdef USE_IRIDESCENCE 3363 uniform float iridescence; 3364 uniform float iridescenceIOR; 3365 uniform float iridescenceThicknessMinimum; 3366 uniform float iridescenceThicknessMaximum; 3367#endif 3368#ifdef USE_SHEEN 3369 uniform vec3 sheenColor; 3370 uniform float sheenRoughness; 3371 #ifdef USE_SHEEN_COLORMAP 3372 uniform sampler2D sheenColorMap; 3373 #endif 3374 #ifdef USE_SHEEN_ROUGHNESSMAP 3375 uniform sampler2D sheenRoughnessMap; 3376 #endif 3377#endif 3378#ifdef USE_ANISOTROPY 3379 uniform vec2 anisotropyVector; 3380 #ifdef USE_ANISOTROPYMAP 3381 uniform sampler2D anisotropyMap; 3382 #endif 3383#endif 3384varying vec3 vViewPosition; 3385#include <common> 3386#include <dithering_pars_fragment> 3387#include <color_pars_fragment> 3388#include <uv_pars_fragment> 3389#include <map_pars_fragment> 3390#include <alphamap_pars_fragment> 3391#include <alphatest_pars_fragment> 3392#include <alphahash_pars_fragment> 3393#include <aomap_pars_fragment> 3394#include <lightmap_pars_fragment> 3395#include <emissivemap_pars_fragment> 3396#include <iridescence_fragment> 3397#include <cube_uv_reflection_fragment> 3398#include <envmap_common_pars_fragment> 3399#include <envmap_physical_pars_fragment> 3400#include <fog_pars_fragment> 3401#include <lights_pars_begin> 3402#include <normal_pars_fragment> 3403#include <lights_physical_pars_fragment> 3404#include <transmission_pars_fragment> 3405#include <shadowmap_pars_fragment> 3406#include <bumpmap_pars_fragment> 3407#include <normalmap_pars_fragment> 3408#include <clearcoat_pars_fragment> 3409#include <iridescence_pars_fragment> 3410#include <roughnessmap_pars_fragment> 3411#include <metalnessmap_pars_fragment> 3412#include <logdepthbuf_pars_fragment> 3413#include <clipping_planes_pars_fragment> 3414void main() { 3415 vec4 diffuseColor = vec4( diffuse, opacity ); 3416 #include <clipping_planes_fragment> 3417 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3418 vec3 totalEmissiveRadiance = emissive; 3419 #include <logdepthbuf_fragment> 3420 #include <map_fragment> 3421 #include <color_fragment> 3422 #include <alphamap_fragment> 3423 #include <alphatest_fragment> 3424 #include <alphahash_fragment> 3425 #include <roughnessmap_fragment> 3426 #include <metalnessmap_fragment> 3427 #include <normal_fragment_begin> 3428 #include <normal_fragment_maps> 3429 #include <clearcoat_normal_fragment_begin> 3430 #include <clearcoat_normal_fragment_maps> 3431 #include <emissivemap_fragment> 3432 #include <lights_physical_fragment> 3433 #include <lights_fragment_begin> 3434 #include <lights_fragment_maps> 3435 #include <lights_fragment_end> 3436 #include <aomap_fragment> 3437 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3438 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3439 #include <transmission_fragment> 3440 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3441 #ifdef USE_SHEEN 3442 3443 outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; 3444 3445 #endif 3446 #ifdef USE_CLEARCOAT 3447 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3448 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3449 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3450 #endif 3451 #include <opaque_fragment> 3452 #include <tonemapping_fragment> 3453 #include <colorspace_fragment> 3454 #include <fog_fragment> 3455 #include <premultiplied_alpha_fragment> 3456 #include <dithering_fragment> 3457}`,FH=`#define TOON 3458varying vec3 vViewPosition; 3459#include <common> 3460#include <batching_pars_vertex> 3461#include <uv_pars_vertex> 3462#include <displacementmap_pars_vertex> 3463#include <color_pars_vertex> 3464#include <fog_pars_vertex> 3465#include <normal_pars_vertex> 3466#include <morphtarget_pars_vertex> 3467#include <skinning_pars_vertex> 3468#include <shadowmap_pars_vertex> 3469#include <logdepthbuf_pars_vertex> 3470#include <clipping_planes_pars_vertex> 3471void main() { 3472 #include <uv_vertex> 3473 #include <color_vertex> 3474 #include <morphinstance_vertex> 3475 #include <morphcolor_vertex> 3476 #include <batching_vertex> 3477 #include <beginnormal_vertex> 3478 #include <morphnormal_vertex> 3479 #include <skinbase_vertex> 3480 #include <skinnormal_vertex> 3481 #include <defaultnormal_vertex> 3482 #include <normal_vertex> 3483 #include <begin_vertex> 3484 #include <morphtarget_vertex> 3485 #include <skinning_vertex> 3486 #include <displacementmap_vertex> 3487 #include <project_vertex> 3488 #include <logdepthbuf_vertex> 3489 #include <clipping_planes_vertex> 3490 vViewPosition = - mvPosition.xyz; 3491 #include <worldpos_vertex> 3492 #include <shadowmap_vertex> 3493 #include <fog_vertex> 3494}`,BH=`#define TOON 3495uniform vec3 diffuse; 3496uniform vec3 emissive; 3497uniform float opacity; 3498#include <common> 3499#include <dithering_pars_fragment> 3500#include <color_pars_fragment> 3501#include <uv_pars_fragment> 3502#include <map_pars_fragment> 3503#include <alphamap_pars_fragment> 3504#include <alphatest_pars_fragment> 3505#include <alphahash_pars_fragment> 3506#include <aomap_pars_fragment> 3507#include <lightmap_pars_fragment> 3508#include <emissivemap_pars_fragment> 3509#include <gradientmap_pars_fragment> 3510#include <fog_pars_fragment> 3511#include <bsdfs> 3512#include <lights_pars_begin> 3513#include <normal_pars_fragment> 3514#include <lights_toon_pars_fragment> 3515#include <shadowmap_pars_fragment> 3516#include <bumpmap_pars_fragment> 3517#include <normalmap_pars_fragment> 3518#include <logdepthbuf_pars_fragment> 3519#include <clipping_planes_pars_fragment> 3520void main() { 3521 vec4 diffuseColor = vec4( diffuse, opacity ); 3522 #include <clipping_planes_fragment> 3523 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3524 vec3 totalEmissiveRadiance = emissive; 3525 #include <logdepthbuf_fragment> 3526 #include <map_fragment> 3527 #include <color_fragment> 3528 #include <alphamap_fragment> 3529 #include <alphatest_fragment> 3530 #include <alphahash_fragment> 3531 #include <normal_fragment_begin> 3532 #include <normal_fragment_maps> 3533 #include <emissivemap_fragment> 3534 #include <lights_toon_fragment> 3535 #include <lights_fragment_begin> 3536 #include <lights_fragment_maps> 3537 #include <lights_fragment_end> 3538 #include <aomap_fragment> 3539 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3540 #include <opaque_fragment> 3541 #include <tonemapping_fragment> 3542 #include <colorspace_fragment> 3543 #include <fog_fragment> 3544 #include <premultiplied_alpha_fragment> 3545 #include <dithering_fragment> 3546}`,HH=`uniform float size; 3547uniform float scale; 3548#include <common> 3549#include <color_pars_vertex> 3550#include <fog_pars_vertex> 3551#include <morphtarget_pars_vertex> 3552#include <logdepthbuf_pars_vertex> 3553#include <clipping_planes_pars_vertex> 3554#ifdef USE_POINTS_UV 3555 varying vec2 vUv; 3556 uniform mat3 uvTransform; 3557#endif 3558void main() { 3559 #ifdef USE_POINTS_UV 3560 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3561 #endif 3562 #include <color_vertex> 3563 #include <morphinstance_vertex> 3564 #include <morphcolor_vertex> 3565 #include <begin_vertex> 3566 #include <morphtarget_vertex> 3567 #include <project_vertex> 3568 gl_PointSize = size; 3569 #ifdef USE_SIZEATTENUATION 3570 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3571 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3572 #endif 3573 #include <logdepthbuf_vertex> 3574 #include <clipping_planes_vertex> 3575 #include <worldpos_vertex> 3576 #include <fog_vertex> 3577}`,VH=`uniform vec3 diffuse; 3578uniform float opacity; 3579#include <common> 3580#include <color_pars_fragment> 3581#include <map_particle_pars_fragment> 3582#include <alphatest_pars_fragment> 3583#include <alphahash_pars_fragment> 3584#include <fog_pars_fragment> 3585#include <logdepthbuf_pars_fragment> 3586#include <clipping_planes_pars_fragment> 3587void main() { 3588 vec4 diffuseColor = vec4( diffuse, opacity ); 3589 #include <clipping_planes_fragment> 3590 vec3 outgoingLight = vec3( 0.0 ); 3591 #include <logdepthbuf_fragment> 3592 #include <map_particle_fragment> 3593 #include <color_fragment> 3594 #include <alphatest_fragment> 3595 #include <alphahash_fragment> 3596 outgoingLight = diffuseColor.rgb; 3597 #include <opaque_fragment> 3598 #include <tonemapping_fragment> 3599 #include <colorspace_fragment> 3600 #include <fog_fragment> 3601 #include <premultiplied_alpha_fragment> 3602}`,GH=`#include <common> 3603#include <batching_pars_vertex> 3604#include <fog_pars_vertex> 3605#include <morphtarget_pars_vertex> 3606#include <skinning_pars_vertex> 3607#include <logdepthbuf_pars_vertex> 3608#include <shadowmap_pars_vertex> 3609void main() { 3610 #include <batching_vertex> 3611 #include <beginnormal_vertex> 3612 #include <morphinstance_vertex> 3613 #include <morphnormal_vertex> 3614 #include <skinbase_vertex> 3615 #include <skinnormal_vertex> 3616 #include <defaultnormal_vertex> 3617 #include <begin_vertex> 3618 #include <morphtarget_vertex> 3619 #include <skinning_vertex> 3620 #include <project_vertex> 3621 #include <logdepthbuf_vertex> 3622 #include <worldpos_vertex> 3623 #include <shadowmap_vertex> 3624 #include <fog_vertex> 3625}`,qH=`uniform vec3 color; 3626uniform float opacity; 3627#include <common> 3628#include <fog_pars_fragment> 3629#include <bsdfs> 3630#include <lights_pars_begin> 3631#include <logdepthbuf_pars_fragment> 3632#include <shadowmap_pars_fragment> 3633#include <shadowmask_pars_fragment> 3634void main() { 3635 #include <logdepthbuf_fragment> 3636 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3637 #include <tonemapping_fragment> 3638 #include <colorspace_fragment> 3639 #include <fog_fragment> 3640 #include <premultiplied_alpha_fragment> 3641}`,WH=`uniform float rotation; 3642uniform vec2 center; 3643#include <common> 3644#include <uv_pars_vertex> 3645#include <fog_pars_vertex> 3646#include <logdepthbuf_pars_vertex> 3647#include <clipping_planes_pars_vertex> 3648void main() { 3649 #include <uv_vertex> 3650 vec4 mvPosition = modelViewMatrix[ 3 ]; 3651 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3652 #ifndef USE_SIZEATTENUATION 3653 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3654 if ( isPerspective ) scale *= - mvPosition.z; 3655 #endif 3656 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3657 vec2 rotatedPosition; 3658 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3659 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3660 mvPosition.xy += rotatedPosition; 3661 gl_Position = projectionMatrix * mvPosition; 3662 #include <logdepthbuf_vertex> 3663 #include <clipping_planes_vertex> 3664 #include <fog_vertex> 3665}`,XH=`uniform vec3 diffuse; 3666uniform float opacity; 3667#include <common> 3668#include <uv_pars_fragment> 3669#include <map_pars_fragment> 3670#include <alphamap_pars_fragment> 3671#include <alphatest_pars_fragment> 3672#include <alphahash_pars_fragment> 3673#include <fog_pars_fragment> 3674#include <logdepthbuf_pars_fragment> 3675#include <clipping_planes_pars_fragment> 3676void main() { 3677 vec4 diffuseColor = vec4( diffuse, opacity ); 3678 #include <clipping_planes_fragment> 3679 vec3 outgoingLight = vec3( 0.0 ); 3680 #include <logdepthbuf_fragment> 3681 #include <map_fragment> 3682 #include <alphamap_fragment> 3683 #include <alphatest_fragment> 3684 #include <alphahash_fragment> 3685 outgoingLight = diffuseColor.rgb; 3686 #include <opaque_fragment> 3687 #include <tonemapping_fragment> 3688 #include <colorspace_fragment> 3689 #include <fog_fragment> 3690}
3690`,qt={alphahash_fragment:gF,alphahash_pars_fragment:xF,alphamap_fragment:bF,alphamap_pars_fragment:vF,alphatest_fragment:yF,alphatest_pars_fragment:_F,aomap_fragment:wF,aomap_pars_fragment:SF,batching_pars_vertex:EF,batching_vertex:CF,begin_vertex:NF,beginnormal_vertex:TF,bsdfs:MF,iridescence_fragment:AF,bumpmap_pars_fragment:RF,clipping_planes_fragment:kF,clipping_planes_pars_fragment:jF,clipping_planes_pars_vertex:LF,clipping_planes_vertex:PF,color_fragment:OF,color_pars_fragment:DF,color_pars_vertex:UF,color_vertex:IF,common:zF,cube_uv_reflection_fragment:$F,defaultnormal_vertex:FF,displacementmap_pars_vertex:BF,displacementmap_vertex:HF,emissivemap_fragment:VF,emissivemap_pars_fragment:GF,colorspace_fragment:qF,colorspace_pars_fragment:WF,envmap_fragment:XF,envmap_common_pars_fragment:YF,envmap_pars_fragment:KF,envmap_pars_vertex:ZF,envmap_physical_pars_fragment:lB,envmap_vertex:QF,fog_vertex:JF,fog_pars_vertex:eB,fog_fragment:tB,fog_pars_fragment:nB,gradientmap_pars_fragment:iB,lightmap_pars_fragment:sB,lights_lambert_fragment:rB,lights_lambert_pars_fragment:aB,lights_pars_begin:oB,lights_toon_fragment:cB,lights_toon_pars_fragment:uB,lights_phong_fragment:dB,lights_phong_pars_fragment:hB,lights_physical_fragment:fB,lights_physical_pars_fragment:pB,lights_fragment_begin:mB,lights_fragment_maps:gB,lights_fragment_end:xB,logdepthbuf_fragment:bB,logdepthbuf_pars_fragment:vB,logdepthbuf_pars_vertex:yB,logdepthbuf_vertex:_B,map_fragment:wB,map_pars_fragment:SB,map_particle_fragment:EB,map_particle_pars_fragment:CB,metalnessmap_fragment:NB,metalnessmap_pars_fragment:TB,morphinstance_vertex:MB,morphcolor_vertex:AB,morphnormal_vertex:RB,morphtarget_pars_vertex:kB,morphtarget_vertex:jB,normal_fragment_begin:LB,normal_fragment_maps:PB,normal_pars_fragment:OB,normal_pars_vertex:DB,normal_vertex:UB,normalmap_pars_fragment:IB,clearcoat_normal_fragment_begin:zB,clearcoat_normal_fragment_maps:$B,clearcoat_pars_fragment:FB,iridescence_pars_fragment:BB,opaque_fragment:HB,packing:VB,premultiplied_alpha_fragment:GB,project_vertex:qB,dithering_fragment:WB,dithering_pars_fragment:XB,roughnessmap_fragment:YB,roughnessmap_pars_fragment:KB,shadowmap_pars_fragment:ZB,shadowmap_pars_vertex:QB,shadowmap_vertex:JB,shadowmask_pars_fragment:eH,skinbase_vertex:tH,skinning_pars_vertex:nH,skinning_vertex:iH,skinnormal_vertex:sH,specularmap_fragment:rH,specularmap_pars_fragment:aH,tonemapping_fragment:oH,tonemapping_pars_fragment:lH,transmission_fragment:cH,transmission_pars_fragment:uH,uv_pars_fragment:dH,uv_pars_vertex:hH,uv_vertex:fH,worldpos_vertex:pH,background_vert:mH,background_frag:gH,backgroundCube_vert:xH,backgroundCube_frag:bH,cube_vert:vH,cube_frag:yH,depth_vert:_H,depth_frag:wH,distance_vert:SH,distance_frag:EH,equirect_vert:CH,equirect_frag:NH,linedashed_vert:TH,linedashed_frag:MH,meshbasic_vert:AH,meshbasic_frag:RH,meshlambert_vert:kH,meshlambert_frag:jH,meshmatcap_vert:LH,meshmatcap_frag:PH,meshnormal_vert:OH,meshnormal_frag:DH,meshphong_vert:UH,meshphong_frag:IH,meshphysical_vert:zH,meshphysical_frag:$H,meshtoon_vert:FH,meshtoon_frag:BH,points_vert:HH,points_frag:VH,shadow_vert:GH,shadow_frag:qH,sprite_vert:WH,sprite_frag:XH},at={common:{diffuse:{value:new _n(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Gt},alphaMap:{value:null},alphaMapTransform:{value:new Gt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Gt}},envmap:{envMap:{value:null},envMapRotation:{value:new Gt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Gt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Gt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Gt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Gt},normalScale:{value:new Cn(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Gt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Gt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Gt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Gt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new _n(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new _n(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Gt},alphaTest:{value:0},uvTransform:{value:new Gt}},sprite:{diffuse:{value:new _n(16777215)},opacity:{value:1},center:{value:new Cn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Gt},alphaMap:{value:null},alphaMapTransform:{value:new Gt},alphaTest:{value:0}}},Mr={basic:{uniforms:qi([at.common,at.specularmap,at.envmap,at.aomap,at.lightmap,at.fog]),vertexShader:qt.meshbasic_vert,fragmentShader:qt.meshbasic_frag},lambert:{uniforms:qi([at.common,at.specularmap,at.envmap,at.aomap,at.lightmap,at.emissivemap,at.bumpmap,at.normalmap,at.displacementmap,at.fog,at.lights,{emissive:{value:new _n(0)},envMapIntensity:{value:1}}]),vertexShader:qt.meshlambert_vert,fragmentShader:qt.meshlambert_frag},phong:{uniforms:qi([at.common,at.specularmap,at.envmap,at.aomap,at.lightmap,at.emissivemap,at.bumpmap,at.normalmap,at.displacementmap,at.fog,at.lights,{emissive:{value:new _n(0)},specular:{value:new _n(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:qt.meshphong_vert,fragmentShader:qt.meshphong_frag},standard:{uniforms:qi([at.common,at.envmap,at.aomap,at.lightmap,at.emissivemap,at.bumpmap,at.normalmap,at.displacementmap,at.roughnessmap,at.metalnessmap,at.fog,at.lights,{emissive:{value:new _n(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:qt.meshphysical_vert,fragmentShader:qt.meshphysical_frag},toon:{uniforms:qi([at.common,at.aomap,at.lightmap,at.emissivemap,at.bumpmap,at.normalmap,at.displacementmap,at.gradientmap,at.fog,at.lights,{emissive:{value:new _n(0)}}]),vertexShader:qt.meshtoon_vert,fragmentShader:qt.meshtoon_frag},matcap:{uniforms:qi([at.common,at.bumpmap,at.normalmap,at.displacementmap,at.fog,{matc
vendor: 5,274 bytes, line 3690
3690ap:{value:null}}]),vertexShader:qt.meshmatcap_vert,fragmentShader:qt.meshmatcap_frag},points:{uniforms:qi([at.points,at.fog]),vertexShader:qt.points_vert,fragmentShader:qt.points_frag},dashed:{uniforms:qi([at.common,at.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:qt.linedashed_vert,fragmentShader:qt.linedashed_frag},depth:{uniforms:qi([at.common,at.displacementmap]),vertexShader:qt.depth_vert,fragmentShader:qt.depth_frag},normal:{uniforms:qi([at.common,at.bumpmap,at.normalmap,at.displacementmap,{opacity:{value:1}}]),vertexShader:qt.meshnormal_vert,fragmentShader:qt.meshnormal_frag},sprite:{uniforms:qi([at.sprite,at.fog]),vertexShader:qt.sprite_vert,fragmentShader:qt.sprite_frag},background:{uniforms:{uvTransform:{value:new Gt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:qt.background_vert,fragmentShader:qt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Gt}},vertexShader:qt.backgroundCube_vert,fragmentShader:qt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:qt.cube_vert,fragmentShader:qt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:qt.equirect_vert,fragmentShader:qt.equirect_frag},distance:{uniforms:qi([at.common,at.displacementmap,{referencePosition:{value:new Ne},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:qt.distance_vert,fragmentShader:qt.distance_frag},shadow:{uniforms:qi([at.lights,at.fog,{color:{value:new _n(0)},opacity:{value:1}}]),vertexShader:qt.shadow_vert,fragmentShader:qt.shadow_frag}};Mr.physical={uniforms:qi([Mr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Gt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Gt},clearcoatNormalScale:{value:new Cn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Gt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Gt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Gt},sheen:{value:0},sheenColor:{value:new _n(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Gt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Gt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Gt},transmissionSamplerSize:{value:new Cn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Gt},attenuationDistance:{value:0},attenuationColor:{value:new _n(0)},specularColor:{value:new _n(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Gt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Gt},anisotropyVector:{value:new Cn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Gt}}]),vertexShader:qt.meshphysical_vert,fragmentShader:qt.meshphysical_frag};const up={r:0,b:0,g:0},Zo=new ja,YH=new hi;function KH(n,e,t,i,r,l){const u=new _n(0);let h=r===!0?0:1,d,p,m=null,g=0,b=null;function y(T){let N=T.isScene===!0?T.background:null;if(N&&N.isTexture){const j=T.backgroundBlurriness>0;N=e.get(N,j)}return N}function _(T){let N=!1;const j=y(T);j===null?w(u,h):j&&j.isColor&&(w(j,1),N=!0);const O=n.xr.getEnvironmentBlendMode();O==="additive"?t.buffers.color.setClear(0,0,0,1,l):O==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,l),(n.autoClear||N)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function C(T,N){const j=y(N);j&&(j.isCubeTexture||j.mapping===Am)?(p===void 0&&(p=new Vr(new oh(1,1,1),new Gr({name:"BackgroundCubeMaterial",uniforms:Hc(Mr.backgroundCube.uniforms),vertexShader:Mr.backgroundCube.vertexShader,fragmentShader:Mr.backgroundCube.fragmentShader,side:os,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),p.geometry.deleteAttribute("normal"),p.geometry.deleteAttribute("uv"),p.onBeforeRender=function(O,R,z){this.matrixWorld.copyPosition(z.matrixWorld)},Object.defineProperty(p.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(p)),Zo.copy(N.backgroundRotation),Zo.x*=-1,Zo.y*=-1,Zo.z*=-1,j.isCubeTexture&&j.isRenderTargetTexture===!1&&(Zo.y*=-1,Zo.z*=-1),p.material.uniforms.envMap.value=j,p.material.uniforms.flipEnvMap.value=j.isCubeTexture&&j.isRenderTargetTexture===!1?-1:1,p.material.uniforms.backgroundBlurriness.value=N.backgroundBlurriness,p.material.uniforms.backgroundIntensity.value=N.backgroundIntensity,p.material.uniforms.backgroundRotation.value.setFromMatrix4(YH.makeRotationFromEuler(Zo)),p.material.toneMapped=cn.getTransfer(j.colorSpace)!==yn,(m!==j||g!==j.version||b!==n.toneMapping)&&(p.material.needsUpdate=!0,m=j,g=j.version,b=n.toneMapping),p.layers.enableAll(),T.unshift(p,p.geometry,p.material,0,0,null)):j&&j.isTexture&&(d===void 0&&(d=new Vr(new Rm(2,2),new Gr({name:"Backgroun
3690dMaterial",uniforms:Hc(Mr.background.uniforms),vertexShader:Mr.background.vertexShader,fragmentShader:Mr.background.fragmentShader,side:So,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(d)),d.material.uniforms.t2D.value=j,d.material.uniforms.backgroundIntensity.value=N.backgroundIntensity,d.material.toneMapped=cn.getTransfer(j.colorSpace)!==yn,j.matrixAutoUpdate===!0&&j.updateMatrix(),d.material.uniforms.uvTransform.value.copy(j.matrix),(m!==j||g!==j.version||b!==n.toneMapping)&&(d.material.needsUpdate=!0,m=j,g=j.version,b=n.toneMapping),d.layers.enableAll(),T.unshift(d,d.geometry,d.material,0,0,null))}function w(T,N){T.getRGB(up,CC(n)),t.buffers.color.setClear(up.r,up.g,up.b,N,l)}function S(){p!==void 0&&(p.geometry.dispose(),p.material.dispose(),p=void 0),d!==void 0&&(d.geometry.dispose(),d.material.dispose(),d=void 0)}return{getClearColor:function(){return u},setClearColor:function(T,N=1){u.set(T),h=N,w(u,h)},getClearAlpha:function(){return h},setClearAlpha:function(T){h=T,w(u,h)},render:_,addToRenderList:C,dispose:S}}function ZH(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=b(null);let l=r,u=!1;function h(U,Y,W,J,F){let $=!1;const V=g(U,J,W,Y);l!==V&&(l=V,p(l.object)),$=y(U,J,W,F),$&&_(U,J,W,F),F!==null&&e.update(F,n.ELEMENT_ARRAY_BUFFER),($||u)&&(u=!1,j(U,Y,W,J),F!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(F).buffer))}function d(){return n.createVertexArray()}function p(U){return n.bindVertexArray(U)}function m(U){return n.deleteVertexArray(U)}function g(U,Y,W,J){const F=J.wireframe===!0;let $=i[Y.id];$===void 0&&($={},i[Y.id]=$);const V=U.isInstancedMesh===!0?U.id:0;let se=$[V];se===void 0&&(se={},$[V]=se);let ue=se[W.id];ue===void 0&&(ue={},se[W.id]=ue);let Ce=ue[F];return Ce===void 0&&(Ce=b(d()),ue[F]=Ce),Ce}function b(U){const Y=[],W=[],J=[];for(let F=0;F<t;F++)Y[F]=0,W[F]=0,J[F]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:Y,enabledAttributes:W,attributeDivisors:J,object:U,attributes:{},index:null}}function y(U,Y,W,J){const F=l.attributes,$=Y.attributes;let V=0;const se=W.getAttributes();for(const ue in se)if(se[ue].location>=0){const D=F[ue];let H=$[ue];if(H===void 0&&(ue==="instanceMatrix"&&U.instanceMatrix&&(H=U.instanceMatrix),ue==="instanceColor"&&U.instanceColor&&(H=U.instanceColor)),D===void 0||D.attribute!==H||H&&D.data!==H.data)return!0;V++}return l.attributesNum!==V||l.index!==J}function _(U,Y,W,J){const F={},$=Y.attributes;let V=0;const se=W.getAttributes();for(const ue in se)if(se[ue].location>=0){let D=$[ue];D===void 0&&(ue==="instanceMatrix"&&U.instanceMatrix&&(D=U.instanceMatrix),ue==="instanceColor"&&U.instanceColor&&(D=U.instanceColor));const H={};H.attribute=D,D&&D.data&&(H.data=D.data),F[ue]=H,V++}l.attributes=F,l.attributesNum=V,l.index=J}function C(){const U=l.newAttributes;for(let Y=0,W=U.length;Y<W;Y++)U[Y]=0}function w(U){S(U,0)}function S(U,Y){const W=l.newAttributes,J=l.enabledAttributes,F=l.attributeDivisors;W[U]=1,J[U]===0&&(n.enableVertexAttribArray(U),J[U]=1),F[U]!==Y&&(n.vertexAttribDivisor(U,Y),F[U]=Y)}function T(){const U=l.newAttributes,Y=l.enabledAttributes;for(let W=0,J=Y.length;W<J;W++)Y[W]!==U[W]&&(n.disableVertexAttribArray(W),Y[W]=0)}function N(U,Y,W,J,F,$,V){V===!0?n.vertexAttribIPointer(U,Y,W,F,$):n.vertexAttribPointer(U,Y,W,J,F,$)}function j(U,Y,W,J){C();const F=J.attributes,$=W.getAttributes(),V=Y.defaultAttributeValues;for(const se in $){const ue=$[se];if(ue.location>=0){let Ce=F[se];if(Ce===void 0&&(se==="instanceMatrix"&&U.instanceMatrix&&(Ce=U.instanceMatrix),se==="instanceColor"&&U.instanceColor&&(Ce=U.instanceColor)),Ce!==void 0){const D=Ce.normalized,H=Ce.itemSize,Z=e.get(Ce);if(Z===void 0)continue;const Ee=Z.buffer,je=Z.type,le=Z.bytesPerElement,Se=je===n.INT||je===n.UNSIGNED_INT||Ce.gpuType===ny;if(Ce.isInterleavedBufferAttribute){const de=Ce.data,Me=de.stride,Le=Ce.offset;if(de.isInstancedInterleavedBuffer){for(let pe=0;pe<ue.locationSize;pe++)S(ue.location+pe,de.meshPerAttribute);U.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=de.meshPerAttribute*de.count)}else for(let pe=0;pe<ue.locationSize;pe++)w(ue.location+pe);n.bindBuffer(n.ARRAY_BUFFER,Ee);for(let pe=0;pe<ue.locationSize;pe++)N(ue.location+pe,H/ue.locationSize,je,D,Me*le,(Le+H/ue.locationSize*pe)*le,Se)}else{if(Ce.isInstancedBufferAttribute){for(let de=0;de<ue.locationSize;de++)S(ue.location+de,Ce.meshPerAttribute);U.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=Ce.meshPerAttribute*Ce.count)}else for(let de=0;de<ue.locationSize;de++)w(ue.location+de);n.bindBuffer(n.ARRAY_BUFFER,Ee);for(let de=0;de<ue.locationSize;de++)N(ue.location+de,H/ue.locationSize,je,D,H*le,H/ue.locationSize*de*le,Se)}}else if(V!==void 0){const D=V[se];if(D!==void 0)switch(D.length){case 2:n.vertexAttrib2fv(ue.location,D);break;case 3:n.vertexAttrib3fv(ue.location,D);break;case 4:n.vertexAttrib4fv(ue.location,D);break;default:n.vertexAttrib1fv(ue.location,D)}}}}T()}function O(){P();for(const U in i){const Y=i[U];for(const W in Y){const J=Y[W];for(const F in J){const $=J[F];for(const V in $)m($[V].object),delete $[V];delete J[F]}}delete i[U]}}function R(U){if(i[U.id]===void 0)return;const Y=i[U.id];for(const W in Y){const J=Y[W];for(const F in J){const $=J[F];for(const V in $)m($[V].object),delete $[V];delete J[F]}}delete i[U.id]}function z(U){for(const Y in i){const W=i[Y];for(const J in W){const F=W[J];if(F[U.id]===void 0)continue;const $=F[U.id];for(const V in $)m($[V].object),delete $[V];delete F[U.id]}}}function M(U){for(const Y in i){const W=i[Y],J=U.isInstancedMesh===!0?U.id:0,F=W[J];if(F!==void 0){for(const $ in F){const V=F[$];for(const se in V)m(V[se].object),delete V[se];delete F[$]}delete W[J],Object.keys(W).length===0&&delete i[Y]}}}function P(){G(),u=!0,l!==r&&(l=r,p(l.object))}function G(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:h,reset:P,resetDefaultState:G,dispose:O,releaseStatesOfGeometry:R,releaseStatesOfObject:M,releaseStatesOfProgram:z,initAttributes:C,enableAttribute:w,disableUnusedAttributes:T}}function QH(n,e,t){let i;function r(p){i=p}function l(p,m){n.drawArrays(i,p,m),t.update(m,i,1)}function u(p,m,g){g!==0&&(n.drawArraysInstanced(i,p,m,g),t.update(m,i,g))}function h(p,m,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,p,0,m,0,g);let y=0;for(let _=0;_<g;_++)y+=m[_];t.update(y,i,1)}function d(p,m,g,b){if(g===0)return;const y=e.get("WEBGL_multi_draw");if(y===null)for(let _=0;_<p.length;_++)u(p[_],m[_],b[_]);
vendor: 6,650 bytes, line 3690
3690else{y.multiDrawArraysInstancedWEBGL(i,p,0,m,0,b,0,g);let _=0;for(let C=0;C<g;C++)_+=m[C]*b[C];t.update(_,i,1)}}this.setMode=r,this.render=l,this.renderInstances=u,this.renderMultiDraw=h,this.renderMultiDrawInstances=d}function JH(n,e,t,i){let r;function l(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const z=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(z.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function u(z){return!(z!==hr&&i.convert(z)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function h(z){const M=z===Ra&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(z!==Ws&&i.convert(z)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&z!==kr&&!M)}function d(z){if(z==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";z="mediump"}return z==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let p=t.precision!==void 0?t.precision:"highp";const m=d(p);m!==p&&(Bt("WebGLRenderer:",p,"not supported, using",m,"instead."),p=m);const g=t.logarithmicDepthBuffer===!0,b=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),y=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),_=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),C=n.getParameter(n.MAX_TEXTURE_SIZE),w=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),S=n.getParameter(n.MAX_VERTEX_ATTRIBS),T=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),N=n.getParameter(n.MAX_VARYING_VECTORS),j=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),O=n.getParameter(n.MAX_SAMPLES),R=n.getParameter(n.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:l,getMaxPrecision:d,textureFormatReadable:u,textureTypeReadable:h,precision:p,logarithmicDepthBuffer:g,reversedDepthBuffer:b,maxTextures:y,maxVertexTextures:_,maxTextureSize:C,maxCubemapSize:w,maxAttributes:S,maxVertexUniforms:T,maxVaryings:N,maxFragmentUniforms:j,maxSamples:O,samples:R}}function eV(n){const e=this;let t=null,i=0,r=!1,l=!1;const u=new el,h=new Gt,d={value:null,needsUpdate:!1};this.uniform=d,this.numPlanes=0,this.numIntersection=0,this.init=function(g,b){const y=g.length!==0||b||i!==0||r;return r=b,i=g.length,y},this.beginShadows=function(){l=!0,m(null)},this.endShadows=function(){l=!1},this.setGlobalState=function(g,b){t=m(g,b,0)},this.setState=function(g,b,y){const _=g.clippingPlanes,C=g.clipIntersection,w=g.clipShadows,S=n.get(g);if(!r||_===null||_.length===0||l&&!w)l?m(null):p();else{const T=l?0:i,N=T*4;let j=S.clippingState||null;d.value=j,j=m(_,b,N,y);for(let O=0;O!==N;++O)j[O]=t[O];S.clippingState=j,this.numIntersection=C?this.numPlanes:0,this.numPlanes+=T}};function p(){d.value!==t&&(d.value=t,d.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function m(g,b,y,_){const C=g!==null?g.length:0;let w=null;if(C!==0){if(w=d.value,_!==!0||w===null){const S=y+C*4,T=b.matrixWorldInverse;h.getNormalMatrix(T),(w===null||w.length<S)&&(w=new Float32Array(S));for(let N=0,j=y;N!==C;++N,j+=4)u.copy(g[N]).applyMatrix4(T,h),u.normal.toArray(w,j),w[j+3]=u.constant}d.value=w,d.needsUpdate=!0}return e.numPlanes=C,e.numIntersection=0,w}}const xo=4,wE=[.125,.215,.35,.446,.526,.582],sl=20,tV=256,dd=new hy,SE=new _n;let Wx=null,Xx=0,Yx=0,Kx=!1;const nV=new Ne;class EE{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,i=.1,r=100,l={}){const{size:u=256,position:h=nV}=l;Wx=this._renderer.getRenderTarget(),Xx=this._renderer.getActiveCubeFace(),Yx=this._renderer.getActiveMipmapLevel(),Kx=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(u);const d=this._allocateTargets();return d.depthBuffer=!0,this._sceneToCubeUV(e,i,r,d,h),t>0&&this._blur(d,0,0,t),this._applyPMREM(d),this._cleanup(d),d}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=TE(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=NE(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Wx,Xx,Yx),this._renderer.xr.enabled=Kx,e.scissorTest=!1,vc(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===fl||e.mapping===$c?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Wx=this._renderer.getRenderTarget(),Xx=this._renderer.getActiveCubeFace(),Yx=this._renderer.getActiveMipmapLevel(),Kx=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:zi,minFilter:zi,generateMipmaps:!1,type:Ra,format:hr,colorSpace:Bc,depthBuffer:!1},r=CE(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=CE(e,t,i);const{_lodMax:l}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=iV(l)),this._blurMaterial=rV(l,e,t),this._ggxMaterial=sV(l,e,t)}return r}_compileMaterial(e){const t=new Vr(new Xr,e);this._renderer.compile(t,dd)}_sceneToCubeUV(e,t,i,r,l){const d=new cr(90,1,t,i),p=[1,-1,1,1,1,1],m=[1,1,1,-1,-1,-1],g=this._renderer,b=g.autoClear,y=g.toneMapping;g.getClearColor(SE),g.toneMapping=Dr,g.autoClear=!1,g.state.buffers.depth.getReversed()&&(g.setRenderTarget(r),g.clearDepth(),g.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Vr(new oh,new _C({name:"PMREM.Backgroun
3690d",side:os,depthWrite:!1,depthTest:!1})));const C=this._backgroundBox,w=C.material;let S=!1;const T=e.background;T?T.isColor&&(w.color.copy(T),e.background=null,S=!0):(w.color.copy(SE),S=!0);for(let N=0;N<6;N++){const j=N%3;j===0?(d.up.set(0,p[N],0),d.position.set(l.x,l.y,l.z),d.lookAt(l.x+m[N],l.y,l.z)):j===1?(d.up.set(0,0,p[N]),d.position.set(l.x,l.y,l.z),d.lookAt(l.x,l.y+m[N],l.z)):(d.up.set(0,p[N],0),d.position.set(l.x,l.y,l.z),d.lookAt(l.x,l.y,l.z+m[N]));const O=this._cubeSize;vc(r,j*O,N>2?O:0,O,O),g.setRenderTarget(r),S&&g.render(C,d),g.render(e,d)}g.toneMapping=y,g.autoClear=b,e.background=T}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===fl||e.mapping===$c;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=TE()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=NE());const l=r?this._cubemapMaterial:this._equirectMaterial,u=this._lodMeshes[0];u.material=l;const h=l.uniforms;h.envMap.value=e;const d=this._cubeSize;vc(t,0,0,3*d,2*d),i.setRenderTarget(t),i.render(u,dd)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let l=1;l<r;l++)this._applyGGXFilter(e,l-1,l);t.autoClear=i}_applyGGXFilter(e,t,i){const r=this._renderer,l=this._pingPongRenderTarget,u=this._ggxMaterial,h=this._lodMeshes[i];h.material=u;const d=u.uniforms,p=i/(this._lodMeshes.length-1),m=t/(this._lodMeshes.length-1),g=Math.sqrt(p*p-m*m),b=0+p*1.25,y=g*b,{_lodMax:_}=this,C=this._sizeLods[i],w=3*C*(i>_-xo?i-_+xo:0),S=4*(this._cubeSize-C);d.envMap.value=e.texture,d.roughness.value=y,d.mipInt.value=_-t,vc(l,w,S,3*C,2*C),r.setRenderTarget(l),r.render(h,dd),d.envMap.value=l.texture,d.roughness.value=0,d.mipInt.value=_-i,vc(e,w,S,3*C,2*C),r.setRenderTarget(e),r.render(h,dd)}_blur(e,t,i,r,l){const u=this._pingPongRenderTarget;this._halfBlur(e,u,t,i,r,"latitudinal",l),this._halfBlur(u,e,i,i,r,"longitudinal",l)}_halfBlur(e,t,i,r,l,u,h){const d=this._renderer,p=this._blurMaterial;u!=="latitudinal"&&u!=="longitudinal"&&hn("blur direction must be either latitudinal or longitudinal!");const m=3,g=this._lodMeshes[r];g.material=p;const b=p.uniforms,y=this._sizeLods[i]-1,_=isFinite(l)?Math.PI/(2*y):2*Math.PI/(2*sl-1),C=l/_,w=isFinite(l)?1+Math.floor(m*C):sl;w>sl&&Bt(`sigmaRadians, ${l}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${sl}`);const S=[];let T=0;for(let z=0;z<sl;++z){const M=z/C,P=Math.exp(-M*M/2);S.push(P),z===0?T+=P:z<w&&(T+=2*P)}for(let z=0;z<S.length;z++)S[z]=S[z]/T;b.envMap.value=e.texture,b.samples.value=w,b.weights.value=S,b.latitudinal.value=u==="latitudinal",h&&(b.poleAxis.value=h);const{_lodMax:N}=this;b.dTheta.value=_,b.mipInt.value=N-i;const j=this._sizeLods[r],O=3*j*(r>N-xo?r-N+xo:0),R=4*(this._cubeSize-j);vc(t,O,R,3*j,2*j),d.setRenderTarget(t),d.render(g,dd)}}function iV(n){const e=[],t=[],i=[];let r=n;const l=n-xo+1+wE.length;for(let u=0;u<l;u++){const h=Math.pow(2,r);e.push(h);let d=1/h;u>n-xo?d=wE[u-n+xo-1]:u===0&&(d=0),t.push(d);const p=1/(h-2),m=-p,g=1+p,b=[m,m,g,m,g,g,m,m,g,g,m,g],y=6,_=6,C=3,w=2,S=1,T=new Float32Array(C*_*y),N=new Float32Array(w*_*y),j=new Float32Array(S*_*y);for(let R=0;R<y;R++){const z=R%3*2/3-1,M=R>2?0:-1,P=[z,M,0,z+2/3,M,0,z+2/3,M+1,0,z,M,0,z+2/3,M+1,0,z,M+1,0];T.set(P,C*_*R),N.set(b,w*_*R);const G=[R,R,R,R,R,R];j.set(G,S*_*R)}const O=new Xr;O.setAttribute("position",new gr(T,C)),O.setAttribute("uv",new gr(N,w)),O.setAttribute("faceIndex",new gr(j,S)),i.push(new Vr(O,null)),r>xo&&r--}return{lodMeshes:i,sizeLods:e,sigmas:t}}function CE(n,e,t){const i=new Ur(n,e,t);return i.texture.mapping=Am,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function vc(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function sV(n,e,t){return new Gr({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:tV,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:km(),fragmentShader:` 3691 3692 precision highp float; 3693 precision highp int; 3694 3695 varying vec3 vOutputDirection; 3696 3697 uniform sampler2D envMap; 3698 uniform float roughness; 3699 uniform float mipInt; 3700 3701 #define ENVMAP_TYPE_CUBE_UV 3702 #include <cube_uv_reflection_fragment> 3703 3704 #define PI 3.14159265359 3705 3706 // Van der Corput radical inverse 3707 float radicalInverse_VdC(uint bits) { 3708 bits = (bits << 16u) | (bits >> 16u); 3709 bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); 3710 bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); 3711 bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); 3712 bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); 3713 return float(bits) * 2.3283064365386963e-10; // / 0x100000000 3714 } 3715 3716 // Hammersley sequence 3717 vec2 hammersley(uint i, uint N) { 3718 return vec2(float(i) / float(N), radicalInverse_VdC(i)); 3719 } 3720 3721 // GGX VNDF importance sampling (Eric Heitz 2018) 3722 // "Sampling the GGX Distribution of Visible Normals" 3723 // https://jcgt.org/published/0007/04/01/ 3724 vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { 3725 float alpha = roughness * roughness; 3726 3727 // Section 4.1: Orthonormal basis 3728 vec3 T1 = vec3(1.0, 0.0, 0.0); 3729 vec3 T2 = cross(V, T1); 3730 3731 // Section 4.2: Parameterization of projected area 3732 float r = sqrt(Xi.x); 3733 float phi = 2.0 * PI * Xi.y; 3734 float t1 = r * cos(phi); 3735 float t2 = r * sin(phi); 3736 float s = 0.5 * (1.0 + V.z); 3737 t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; 3738 3739 // Section 4.3: Reprojection onto hemisphere 3740 vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; 3741 3742 // Section 3.4: Transform back to ellipsoid configuration 3743 return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); 3744 } 3745 3746 void main() { 3747 vec3 N = normalize(vOutputDirection); 3748 vec3 V = N; // Assume view direction equals normal for pre-filtering 3749 3750 vec3 prefilteredColor = vec3(0.0); 3751 float totalWeight = 0.0; 3752 3753 // For very low roughness, just sample the environment directly 3754 if (roughness < 0.001) { 3755 gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); 3756 return; 3757 } 3758 3759 // Tangent space basis for VNDF sampling 3760 vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); 3761 vec3 tangent = normalize(cross(up, N)); 3762 vec3 bitangent = cross(N, tangent); 3763
3764 for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { 3765 vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); 3766 3767 // For PMREM, V = N, so in tangent space V is always (0, 0, 1) 3768 vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); 3769 3770 // Transform H back to world space 3771 vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); 3772 vec3 L = normalize(2.0 * dot(V, H) * H - V); 3773 3774 float NdotL = max(dot(N, L), 0.0); 3775 3776 if(NdotL > 0.0) { 3777 // Sample environment at fixed mip level 3778 // VNDF importance sampling handles the distribution filtering 3779 vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); 3780 3781 // Weight by NdotL for the split-sum approximation 3782 // VNDF PDF naturally accounts for the visible microfacet distribution 3783 prefilteredColor += sampleColor * NdotL; 3784 totalWeight += NdotL; 3785 } 3786 } 3787 3788 if (totalWeight > 0.0) { 3789 prefilteredColor = prefilteredColor / totalWeight; 3790 } 3791 3792 gl_FragColor = vec4(prefilteredColor, 1.0); 3793 } 3794 `,blending:Na,depthTest:!1,depthWrite:!1})}function rV(n,e,t){const i=new Float32Array(sl),r=new Ne(0,1,0);return new Gr({name:"SphericalGaussianBlur",defines:{n:sl,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:km(),fragmentShader:` 3795 3796 precision mediump float; 3797 precision mediump int; 3798 3799 varying vec3 vOutputDirection; 3800 3801 uniform sampler2D envMap; 3802 uniform int samples; 3803 uniform float weights[ n ]; 3804 uniform bool latitudinal; 3805 uniform float dTheta; 3806 uniform float mipInt; 3807 uniform vec3 poleAxis; 3808 3809 #define ENVMAP_TYPE_CUBE_UV 3810 #include <cube_uv_reflection_fragment> 3811 3812 vec3 getSample( float theta, vec3 axis ) { 3813 3814 float cosTheta = cos( theta ); 3815 // Rodrigues' axis-angle rotation 3816 vec3 sampleDirection = vOutputDirection * cosTheta 3817 + cross( axis, vOutputDirection ) * sin( theta ) 3818 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3819 3820 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3821 3822 } 3823 3824 void main() { 3825 3826 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3827 3828 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3829 3830 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3831 3832 } 3833 3834 axis = normalize( axis ); 3835 3836 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3837 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3838 3839 for ( int i = 1; i < n; i++ ) { 3840 3841 if ( i >= samples ) { 3842 3843 break; 3844 3845 } 3846 3847 float theta = dTheta * float( i ); 3848 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3849 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3850 3851 } 3852 3853 } 3854 `,blending:Na,depthTest:!1,depthWrite:!1})}function NE(){return new Gr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:km(),fragmentShader:` 3855 3856 precision mediump float; 3857 precision mediump int; 3858 3859 varying vec3 vOutputDirection; 3860 3861 uniform sampler2D envMap; 3862 3863 #include <common> 3864 3865 void main() { 3866 3867 vec3 outputDirection = normalize( vOutputDirection ); 3868 vec2 uv = equirectUv( outputDirection ); 3869 3870 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3871 3872 } 3873 `,blending:Na,depthTest:!1,depthWrite:!1})}function TE(){return new Gr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:km(),fragmentShader:` 3874 3875 precision mediump float; 3876 precision mediump int; 3877 3878 uniform float flipEnvMap; 3879 3880 varying vec3 vOutputDirection; 3881 3882 uniform samplerCube envMap; 3883 3884 void main() { 3885 3886 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3887 3888 } 3889 `,blending:Na,depthTest:!1,depthWrite:!1})}function km(){return` 3890 3891 precision mediump float; 3892 precision mediump int; 3893 3894 attribute float faceIndex; 3895 3896 varying vec3 vOutputDirection; 3897 3898 // RH coordinate system; PMREM face-indexing convention 3899 vec3 getDirection( vec2 uv, float face ) { 3900 3901 uv = 2.0 * uv - 1.0; 3902 3903 vec3 direction = vec3( uv, 1.0 ); 3904 3905 if ( face == 0.0 ) { 3906 3907 direction = direction.zyx; // ( 1, v, u ) pos x 3908 3909 } else if ( face == 1.0 ) { 3910 3911 direction = direction.xzy; 3912 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3913 3914 } else if ( face == 2.0 ) { 3915 3916 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3917 3918 } else if ( face == 3.0 ) { 3919 3920 direction = direction.zyx; 3921 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3922 3923 } else if ( face == 4.0 ) { 3924 3925 direction = direction.xzy; 3926 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3927 3928 } else if ( face == 5.0 ) { 3929 3930 direction.z *= -1.0; // ( u, v, -1 ) neg z 3931 3932 } 3933 3934 return direction; 3935 3936 } 3937 3938 void main() { 3939 3940 vOutputDirection = getDirection( uv, faceIndex ); 3941 gl_Position = vec4( position, 1.0 ); 3942 3943 } 3944 `}class AC extends Ur{constructor(e=1,t={}
vendor: 50,039 bytes, lines 3944-4076
3944){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new SC(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` 3945 3946 varying vec3 vWorldDirection; 3947 3948 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 3949 3950 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 3951 3952 } 3953 3954 void main() { 3955 3956 vWorldDirection = transformDirection( position, modelMatrix ); 3957 3958 #include <begin_vertex> 3959 #include <project_vertex> 3960 3961 } 3962 `,fragmentShader:` 3963 3964 uniform sampler2D tEquirect; 3965 3966 varying vec3 vWorldDirection; 3967 3968 #include <common> 3969 3970 void main() { 3971 3972 vec3 direction = normalize( vWorldDirection ); 3973 3974 vec2 sampleUV = equirectUv( direction ); 3975 3976 gl_FragColor = texture2D( tEquirect, sampleUV ); 3977 3978 } 3979 `},r=new oh(5,5,5),l=new Gr({name:"CubemapFromEquirect",uniforms:Hc(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:os,blending:Na});l.uniforms.tEquirect.value=t;const u=new Vr(r,l),h=t.minFilter;return t.minFilter===ol&&(t.minFilter=zi),new hF(1,10,this).update(e,u),t.minFilter=h,u.geometry.dispose(),u.material.dispose(),this}clear(e,t=!0,i=!0,r=!0){const l=e.getRenderTarget();for(let u=0;u<6;u++)e.setRenderTarget(this,u),e.clear(t,i,r);e.setRenderTarget(l)}}function aV(n){let e=new WeakMap,t=new WeakMap,i=null;function r(b,y=!1){return b==null?null:y?u(b):l(b)}function l(b){if(b&&b.isTexture){const y=b.mapping;if(y===yx||y===_x)if(e.has(b)){const _=e.get(b).texture;return h(_,b.mapping)}else{const _=b.image;if(_&&_.height>0){const C=new AC(_.height);return C.fromEquirectangularTexture(n,b),e.set(b,C),b.addEventListener("dispose",p),h(C.texture,b.mapping)}else return null}}return b}function u(b){if(b&&b.isTexture){const y=b.mapping,_=y===yx||y===_x,C=y===fl||y===$c;if(_||C){let w=t.get(b);const S=w!==void 0?w.texture.pmremVersion:0;if(b.isRenderTargetTexture&&b.pmremVersion!==S)return i===null&&(i=new EE(n)),w=_?i.fromEquirectangular(b,w):i.fromCubemap(b,w),w.texture.pmremVersion=b.pmremVersion,t.set(b,w),w.texture;if(w!==void 0)return w.texture;{const T=b.image;return _&&T&&T.height>0||C&&T&&d(T)?(i===null&&(i=new EE(n)),w=_?i.fromEquirectangular(b):i.fromCubemap(b),w.texture.pmremVersion=b.pmremVersion,t.set(b,w),b.addEventListener("dispose",m),w.texture):null}}}return b}function h(b,y){return y===yx?b.mapping=fl:y===_x&&(b.mapping=$c),b}function d(b){let y=0;const _=6;for(let C=0;C<_;C++)b[C]!==void 0&&y++;return y===_}function p(b){const y=b.target;y.removeEventListener("dispose",p);const _=e.get(y);_!==void 0&&(e.delete(y),_.dispose())}function m(b){const y=b.target;y.removeEventListener("dispose",m);const _=t.get(y);_!==void 0&&(t.delete(y),_.dispose())}function g(){e=new WeakMap,t=new WeakMap,i!==null&&(i.dispose(),i=null)}return{get:r,dispose:g}}function oV(n){const e={};function t(i){if(e[i]!==void 0)return e[i];const r=n.getExtension(i);return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){const r=t(i);return r===null&&Kp("WebGLRenderer: "+i+" extension not supported."),r}}}function lV(n,e,t,i){const r={},l=new WeakMap;function u(g){const b=g.target;b.index!==null&&e.remove(b.index);for(const _ in b.attributes)e.remove(b.attributes[_]);b.removeEventListener("dispose",u),delete r[b.id];const y=l.get(b);y&&(e.remove(y),l.delete(b)),i.releaseStatesOfGeometry(b),b.isInstancedBufferGeometry===!0&&delete b._maxInstanceCount,t.memory.geometries--}function h(g,b){return r[b.id]===!0||(b.addEventListener("dispose",u),r[b.id]=!0,t.memory.geometries++),b}function d(g){const b=g.attributes;for(const y in b)e.update(b[y],n.ARRAY_BUFFER)}function p(g){const b=[],y=g.index,_=g.attributes.position;let C=0;if(_===void 0)return;if(y!==null){const T=y.array;C=y.version;for(let N=0,j=T.length;N<j;N+=3){const O=T[N+0],R=T[N+1],z=T[N+2];b.push(O,R,R,z,z,O)}}else{const T=_.array;C=_.version;for(let N=0,j=T.length/3-1;N<j;N+=3){const O=N+0,R=N+1,z=N+2;b.push(O,R,R,z,z,O)}}const w=new(_.count>=65535?yC:vC)(b,1);w.version=C;const S=l.get(g);S&&e.remove(S),l.set(g,w)}function m(g){const b=l.get(g);if(b){const y=g.index;y!==null&&b.version<y.version&&p(g)}else p(g);return l.get(g)}return{get:h,update:d,getWireframeAttribute:m}}function cV(n,e,t){let i;function r(b){i=b}let l,u;function h(b){l=b.type,u=b.bytesPerElement}function d(b,y){n.drawElements(i,y,l,b*u),t.update(y,i,1)}function p(b,y,_){_!==0&&(n.drawElementsInstanced(i,y,l,b*u,_),t.update(y,i,_))}function m(b,y,_){if(_===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,y,0,l,b,0,_);let w=0;for(let S=0;S<_;S++)w+=y[S];t.update(w,i,1)}function g(b,y,_,C){if(_===0)return;const w=e.get("WEBGL_multi_draw");if(w===null)for(let S=0;S<b.length;S++)p(b[S]/u,y[S],C[S]);else{w.multiDrawElementsInstancedWEBGL(i,y,0,l,b,0,C,0,_);let S=0;for(let T=0;T<_;T++)S+=y[T]*C[T];t.update(S,i,1)}}this.setMode=r,this.setIndex=h,this.render=d,this.renderInstances=p,this.renderMultiDraw=m,this.renderMultiDrawInstances=g}function uV(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(l,u,h){switch(t.calls++,u){case n.TRIANGLES:t.triangles+=h*(l/3);break;case n.LINES:t.lines+=h*(l/2);break;case n.LINE_STRIP:t.lines+=h*(l-1);break;case n.LINE_LOOP:t.lines+=h*l;break;case n.POINTS:t.points+=h*l;break;default:hn("WebGLInfo: Unknown draw mode:",u);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function dV(n,e,t){const i=new WeakMap,r=new Kn;function l(u,h,d){const p=u.morphTargetInfluences,m=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,g=m!==void 0?m.length:0;let b=i.get(h);if(b===void 0||b.count!==g){let P=function(){z.dispose(),i.delete(h),h.removeEventListener("dispose",P)};b!==void 0&&b.texture.dispose();const y=h.morphAttributes.position!==void 0,_=h.morphAttributes.normal!==void 0,C=h.morphAttributes.color!==void 0,w=h.morphAttributes.position||[],S=h.morphAttributes.normal||[],T=h.morphAttributes.color||[];let N=0;y===!0&&(N=1),_===!0&&(N=2),C===!0&&(N=3);let j=h.attributes.position.count*N,O=1;j>e.maxTextureSize&&(O=Math.ceil(j/e.maxTextureSize),j=e.maxTextureSize);const R=new Float32Array(j*O*4*g),z=new gC(R,j,O,g);z.type=kr,z.needsUpdate=!0;const M=N*4;for(let G=0;G<g;G++){const U=w[G],Y=S[G],W=T[G],J=j*O*4*G;for(let F=0;F<U.count;F++){const $=F*M;y===!0&&(r.fromBufferAttribute(U,F),R[J+$+0]=r.x,R[J+$+1]=r.y,R[J+$+2]=r.z,R[J+$+3]=0),_===!0&&(r.fromBufferAttribute(Y,F),R[J+$+4]=r.x,R[J+$+5]=r.y,R[J+$+6]=r.z,R[J+$+7]=0),C===!0&&(r.fromBufferAttribute(W,F),R[J+$+8]=r.x,R[J+$+9]=r.y,R[J+$+10]=r.z,R[J+$+11]=W.itemSize===4?r.w:1)}}b={count:g,texture:z,size:new Cn(j,O)},i.set(h,b),h.addEventListener("dispose",P)}if(u.isInstancedMesh===!0&&u.morphTexture!==null)d.getUniforms().setValue(n,"morphTexture",u.morphTexture,t);else{let y=0;for(let C=0;C<p.length;C++)y+=p[C];const _=h.morphTargetsRelative?1:1-y;d.getUniforms().setValue(n,"morphTargetBaseInfluence",_),d.getUniforms().setValue(n,"morphTargetInfluences",p)}d.getUniforms().setValue(n,"morphTargetsTexture",b.texture,t),d.getUniforms().setValue(n,"morphTargetsTextureSize",b.size)}return{update:l}}function hV(n,e,t,i,r){let l=new WeakMap;function u(p){const m=r.render.frame,g=p.geometry,b=e.get(p,g);if(l.get(b)!==m&&(e.update(b),l.set(b,m)),p.isInstancedMesh&&(p.hasEventListener("dispose",d)===!1&&p.addEventListener("dispose",d),l.get(p)!==m&&(t.update(p.instanceMatrix,n.ARRAY_BUFFER),p.instanceColor!==null&&t.update(p.instanceColor,n.ARRAY_BUFFER),l.set(p,m))),p.isSkinnedMesh){const y=p.skeleton;l.get(y)!==m&&(y.update(),l.set(y,m))}return b}function h(){l=new WeakMap}function d(p){const m=p.target;m.removeEventListener("dispose",d),i.releaseStatesOfObject(m),t.remove(m.instanceMatrix),m.instanceColor!==null&&t.remove(m.instanceColor)}return{update:u,dispose:h}}const fV={[eC]:"LINEAR_TONE_MAPPING",[tC]:"REINHARD_TONE_MAPPING",[nC]:"CINEON_TONE_MAPPING",[iC]:"ACES_FILMIC_TONE_MAPPING",[rC]:"AGX_TONE_MAPPING",[aC]:"NEUTRAL_TONE_MAPPING",[sC]:"CUSTOM_TONE_MAPPING"};function pV(n,e,t,i,r){const l=new Ur(e,t,{type:n,depthBuffer:i,stencilBuffer:r}),u=new Ur(e,t,{type:Ra,depthBuffer:!1,stencilBuffer:!1}),h=new Xr;h.setAttribute("position",new Ma([-1,3,0,-1,-1,0,3,-1,0],3)),h.setAttribute("uv",new Ma([0,2,0,0,2,0],2));const d=new NC({uniforms:{tDiffuse:{value:null}},vertexShader:` 3980 precision highp float; 3981 3982 uniform mat4 modelViewMatrix; 3983 uniform mat4 projectionMatrix; 3984 3985 attribute vec3 position; 3986 attribute vec2 uv; 3987 3988 varying vec2 vUv; 3989 3990 void main() { 3991 vUv = uv; 3992 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3993 }`,fragmentShader:` 3994 precision highp float; 3995 3996 uniform sampler2D tDiffuse; 3997 3998 varying vec2 vUv; 3999 4000 #include <tonemapping_pars_fragment> 4001 #include <colorspace_pars_fragment> 4002 4003 void main() { 4004 gl_FragColor = texture2D( tDiffuse, vUv ); 4005 4006 #ifdef LINEAR_TONE_MAPPING 4007 gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); 4008 #elif defined( REINHARD_TONE_MAPPING ) 4009 gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); 4010 #elif defined( CINEON_TONE_MAPPING ) 4011 gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); 4012 #elif defined( ACES_FILMIC_TONE_MAPPING ) 4013 gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); 4014 #elif defined( AGX_TONE_MAPPING ) 4015 gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); 4016 #elif defined( NEUTRAL_TONE_MAPPING ) 4017 gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); 4018 #elif defined( CUSTOM_TONE_MAPPING ) 4019 gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); 4020 #endif 4021 4022 #ifdef SRGB_TRANSFER 4023 gl_FragColor = sRGBTransferOETF( gl_FragColor ); 4024 #endif 4025 }`,depthTest:!1,depthWrite:!1}),p=new Vr(h,d),m=new hy(-1,1,1,-1,0,1);let g=null,b=null,y=!1,_,C=null,w=[],S=!1;this.setSize=function(T,N){l.setSize(T,N),u.setSize(T,N);for(let j=0;j<w.length;j++){const O=w[j];O.setSize&&O.setSize(T,N)}},this.setEffects=function(T){w=T,S=w.length>0&&w[0].isRenderPass===!0;const N=l.width,j=l.height;for(let O=0;O<w.length;O++){const R=w[O];R.setSize&&R.setSize(N,j)}},this.begin=function(T,N){if(y||T.toneMapping===Dr&&w.length===0)return!1;if(C=N,N!==null){const j=N.width,O=N.height;(l.width!==j||l.height!==O)&&this.setSize(j,O)}return S===!1&&T.setRenderTarget(l),_=T.toneMapping,T.toneMapping=Dr,!0},this.hasRenderPass=function(){return S},this.end=function(T,N){T.toneMapping=_,y=!0;let j=l,O=u;for(let R=0;R<w.length;R++){const z=w[R];if(z.enabled!==!1&&(z.render(T,O,j,N),z.needsSwap!==!1)){const M=j;j=O,O=M}}if(g!==T.outputColorSpace||b!==T.toneMapping){g=T.outputColorSpace,b=T.toneMapping,d.defines={},cn.getTransfer(g)===yn&&(d.defines.SRGB_TRANSFER="");const R=fV[b];R&&(d.defines[R]=""),d.needsUpdate=!0}d.uniforms.tDiffuse.value=j.texture,T.setRenderTarget(C),T.render(p,m),C=null,y=!1},this.isCompositing=function(){return y},this.dispose=function(){l.dispose(),u.dispose(),h.dispose(),d.dispose()}}const RC=new Yi,Fb=new Xd(1,1),kC=new gC,jC=new $$,LC=new SC,ME=[],AE=[],RE=new Float32Array(16),kE=new Float32Array(9),jE=new Float32Array(4);function au(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let l=ME[r];if(l===void 0&&(l=new Float32Array(r),ME[r]=l),e!==0){i.toArray(l,0);for(let u=1,h=0;u!==e;++u)h+=t,n[u].toArray(l,h)}return l}function gi(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function xi(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function jm(n,e){let t=AE[e];t===void 0&&(t=new Int32Array(e),AE[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function mV(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function gV(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(gi(t,e))return;n.uniform2fv(this.addr,e),xi(t,e)}}function xV(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(gi(t,e))return;n.uniform3fv(this.addr,e),xi(t,e)}}function bV(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(gi(t,e))return;n.uniform4fv(this.addr,e),xi(t,e)}}function vV(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(gi(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),xi(t,e)}else{if(gi(t,i))return;jE.set(i),n.uniformMatrix2fv(this.addr,!1,jE),xi(t,i)}}function yV(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(gi(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),xi(t,e)}else{if(gi(t,i))return;kE.set(i),n.uniformMatrix3fv(this.addr,!1,kE),xi(t,i)}}function _V(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(gi(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),xi(t,e)}else{if(gi(t,i))return;RE.set(i),n.uniformMatrix4fv(this.addr,!1,RE),xi(t,i)}}function wV(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function SV(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(gi(t,e))return;n.uniform2iv(this.addr,e),xi(t,e)}}function EV(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(gi(t,e))return;n.uniform3iv(this.addr,e),xi(t,e)}}function CV(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(gi(t,e))return;n.uniform4iv(this.addr,e),xi(t,e)}}function NV(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function TV(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(gi(t,e))return;n.uniform2uiv(this.addr,e),xi(t,e)}}function MV(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(gi(t,e))return;n.uniform3uiv(this.addr,e),xi(t,e)}}function AV(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(gi(t,e))return;n.uniform4uiv(this.addr,e),xi(t,e)}}function RV(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r);let l;this.type===n.SAMPLER_2D_SHADOW?(Fb.compareFunction=t.isReversedDepthBuffer()?cy:ly,l=Fb):l=RC,t.setTexture2D(e||l,r)}function kV(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||jC,r)}function jV(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||LC,r)}function LV(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||kC,r)}function PV(n){switch(n){case 5126:return mV;case 35664:return gV;case 35665:return xV;case 35666:return bV;case 35674:return vV;case 35675:return yV;case 35676:return _V;case 5124:case 35670:return wV;case 35667:case 35671:return SV;case 35668:case 35672:return EV;case 35669:case 35673:return CV;case 5125:return NV;case 36294:return TV;case 36295:return MV;case 36296:return AV;case 35678:case 36198:case 36298:case 36306:case 35682:return RV;case 35679:case 36299:case 36307:return kV;case 35680:case 36300:case 36308:case 36293:return jV;case 36289:case 36303:case 36311:case 36292:return LV}}function OV(n,e){n.uniform1fv(this.addr,e)}function DV(n,e){const t=au(e,this.size,2);n.uniform2fv(this.addr,t)}function UV(n,e){const t=au(e,this.size,3);n.uniform3fv(this.addr,t)}function IV(n,e){const t=au(e,this.size,4);n.uniform4fv(this.addr,t)}function zV(n,e){const t=au(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function $V(n,e){const t=au(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function FV(n,e){const t=au(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function BV(n,e){n.uniform1iv(this.addr,e)}function HV(n,e){n.uniform2iv(this.addr,e)}function VV(n,e){n.uniform3iv(this.addr,e)}function GV(n,e){n.uniform4iv(this.addr,e)}function qV(n,e){n.uniform1uiv(this.addr,e)}function WV(n,e){n.uniform2uiv(this.addr,e)}function XV(n,e){n.uniform3uiv(this.addr,e)}function YV(n,e){n.uniform4uiv(this.addr,e)}function KV(n,e,t){const i=this.cache,r=e.length,l=jm(t,r);gi(i,l)||(n.uniform1iv(this.addr,l),xi(i,l));let u;this.type===n.SAMPLER_2D_SHADOW?u=Fb:u=RC;for(let h=0;h!==r;++h)t.setTexture2D(e[h]||u,l[h])}function ZV(n,e,t){const i=this.cache,r=e.length,l=jm(t,r);gi(i,l)||(n.uniform1iv(this.addr,l),xi(i,l));for(let u=0;u!==r;++u)t.setTexture3D(e[u]||jC,l[u])}function QV(n,e,t){const i=this.cache,r=e.length,l=jm(t,r);gi(i,l)||(n.uniform1iv(this.addr,l),xi(i,l));for(let u=0;u!==r;++u)t.setTextureCube(e[u]||LC,l[u])}function JV(n,e,t){const i=this.cache,r=e.length,l=jm(t,r);gi(i,l)||(n.uniform1iv(this.addr,l),xi(i,l));for(let u=0;u!==r;++u)t.setTexture2DArray(e[u]||kC,l[u])}function eG(n){switch(n){case 5126:return OV;case 35664:return DV;case 35665:return UV;case 35666:return IV;case 35674:return zV;case 35675:return $V;case 35676:return FV;case 5124:case 35670:return BV;case 35667:case 35671:return HV;case 35668:case 35672:return VV;case 35669:case 35673:return GV;case 5125:return qV;case 36294:return WV;case 36295:return XV;case 36296:return YV;case 35678:case 36198:case 36298:case 36306:case 35682:return KV;case 35679:case 36299:case 36307:return ZV;case 35680:case 36300:case 36308:case 36293:return QV;case 36289:case 36303:case 36311:case 36292:return JV}}class tG{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=PV(t.type)}}class nG{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=eG(t.type)}}class iG{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let l=0,u=r.length;l!==u;++l){const h=r[l];h.setValue(e,t[h.id],i)}}}const Zx=/(\w+)(\])?(\[|\.)?/g;function LE(n,e){n.seq.push(e),n.map[e.id]=e}function sG(n,e,t){const i=n.name,r=i.length;for(Zx.lastIndex=0;;){const l=Zx.exec(i),u=Zx.lastIndex;let h=l[1];const d=l[2]==="]",p=l[3];if(d&&(h=h|0),p===void 0||p==="["&&u+2===r){LE(t,p===void 0?new tG(h,n,e):new nG(h,n,e));break}else{let g=t.map[h];g===void 0&&(g=new iG(h),LE(t,g)),t=g}}}class Tp{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let u=0;u<i;++u){const h=e.getActiveUniform(t,u),d=e.getUniformLocation(t,h.name);sG(h,d,this)}const r=[],l=[];for(const u of this.seq)u.type===e.SAMPLER_2D_SHADOW||u.type===e.SAMPLER_CUBE_SHADOW||u.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(u):l.push(u);r.length>0&&(this.seq=r.concat(l))}setValue(e,t,i,r){const l=this.map[t];l!==void 0&&l.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let l=0,u=t.length;l!==u;++l){const h=t[l],d=i[h.id];d.needsUpdate!==!1&&h.setValue(e,d.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,l=e.length;r!==l;++r){const u=e[r];u.id in t&&i.push(u)}return i}}function PE(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const rG=37297;let aG=0;function oG(n,e){const t=n.split(` 4026`),i=[],r=Math.max(e-6,0),l=Math.min(e+6,t.length);for(let u=r;u<l;u++){const h=u+1;i.push(`${h===e?">":" "} ${h}: ${t[u]}`)}return i.join(` 4027`)}const OE=new Gt;function lG(n){cn._getMatrix(OE,cn.workingColorSpace,n);const e=`mat3( ${OE.elements.map(t=>t.toFixed(4))} )`;switch(cn.getTransfer(n)){case Wp:return[e,"LinearTransferOETF"];case yn:return[e,"sRGBTransferOETF"];default:return Bt("WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function DE(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),l=(n.getShaderInfoLog(e)||"").trim();if(i&&l==="")return"";const u=/ERROR: 0:(\d+)/.exec(l);if(u){const h=parseInt(u[1]);return t.toUpperCase()+` 4028 4029`+l+` 4030 4031`+oG(n.getShaderSource(e),h)}else return l}function cG(n,e){const t=lG(e);return[`vec4 ${n}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` 4032`)}const uG={[eC]:"Linear",[tC]:"Reinhard",[nC]:"Cineon",[iC]:"ACESFilmic",[rC]:"AgX",[aC]:"Neutral",[sC]:"Custom"};function dG(n,e){const t=uG[e];return t===void 0?(Bt("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+n+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const dp=new Ne;function hG(){cn.getLuminanceCoefficients(dp);const n=dp.x.toFixed(4),e=dp.y.toFixed(4),t=dp.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 4033`)}function fG(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(bd).join(` 4034`)}function pG(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` 4035`)}function mG(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const l=n.getActiveAttrib(e,r),u=l.name;let h=1;l.type===n.FLOAT_MAT2&&(h=2),l.type===n.FLOAT_MAT3&&(h=3),l.type===n.FLOAT_MAT4&&(h=4),t[u]={type:l.type,location:n.getAttribLocation(e,u),locationSize:h}}return t}function bd(n){return n!==""}function UE(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function IE(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const gG=/^[ \t]*#include +<([\w\d./]+)>/gm;function Bb(n){return n.replace(gG,bG)}const xG=new Map;function bG(n,e){let t=qt[e];if(t===void 0){const i=xG.get(e);if(i!==void 0)t=qt[i],Bt('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return Bb(t)}const vG=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function zE(n){return n.replace(vG,yG)}function yG(n,e,t,i){let r="";for(let l=parseInt(e);l<parseInt(t);l++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+l+" ]").replace(/UNROLLED_LOOP_INDEX/g,l);return r}function $E(n){let e=`precision ${n.precision} float; 4036 precision ${n.precision} int; 4037 precision ${n.precision} sampler2D; 4038 precision ${n.precision} samplerCube; 4039 precision ${n.precision} sampler3D; 4040 precision ${n.precision} sampler2DArray; 4041 precision ${n.precision} sampler2DShadow; 4042 precision ${n.precision} samplerCubeShadow; 4043 precision ${n.precision} sampler2DArrayShadow; 4044 precision ${n.precision} isampler2D; 4045 precision ${n.precision} isampler3D; 4046 precision ${n.precision} isamplerCube; 4047 precision ${n.precision} isampler2DArray; 4048 precision ${n.precision} usampler2D; 4049 precision ${n.precision} usampler3D; 4050 precision ${n.precision} usamplerCube; 4051 precision ${n.precision} usampler2DArray; 4052 `;return n.precision==="highp"?e+=` 4053#define HIGH_PRECISION`:n.precision==="mediump"?e+=` 4054#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=` 4055#define LOW_PRECISION`),e}const _G={[wp]:"SHADOWMAP_TYPE_PCF",[xd]:"SHADOWMAP_TYPE_VSM"};function wG(n){return _G[n.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const SG={[fl]:"ENVMAP_TYPE_CUBE",[$c]:"ENVMAP_TYPE_CUBE",[Am]:"ENVMAP_TYPE_CUBE_UV"};function EG(n){return n.envMap===!1?"ENVMAP_TYPE_CUBE":SG[n.envMapMode]||"ENVMAP_TYPE_CUBE"}const CG={[$c]:"ENVMAP_MODE_REFRACTION"};function NG(n){return n.envMap===!1?"ENVMAP_MODE_REFLECTION":CG[n.envMapMode]||"ENVMAP_MODE_REFLECTION"}const TG={[J4]:"ENVMAP_BLENDING_MULTIPLY",[b$]:"ENVMAP_BLENDING_MIX",[v$]:"ENVMAP_BLENDING_ADD"};function MG(n){return n.envMap===!1?"ENVMAP_BLENDING_NONE":TG[n.combine]||"ENVMAP_BLENDING_NONE"}function AG(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:i,maxMip:t}}function RG(n,e,t,i){const r=n.getContext(),l=t.defines;let u=t.vertexShader,h=t.fragmentShader;const d=wG(t),p=EG(t),m=NG(t),g=MG(t),b=AG(t),y=fG(t),_=pG(l),C=r.createProgram();let w,S,T=t.glslVersion?"#version "+t.glslVersion+` 4056`:"";t.isRawShaderMaterial?(w=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(bd).join(` 4057`),w.length>0&&(w+=` 4058`),S=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(bd).join(` 4059`),S.length>0&&(S+=` 4060`)):(w=[$E(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+m:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+d:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` 4061`].filter(bd).join(` 4062`),S=[$E(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+p:"",t.envMap?"#define "+m:"",t.envMap?"#define "+g:"",b?"#define CUBEUV_TEXEL_WIDTH "+b.texelWidth:"",b?"#define CUBEUV_TEXEL_HEIGHT "+b.texelHeight:"",b?"#define CUBEUV_MAX_MIP "+b.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+d:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Dr?"#define TONE_MAPPING":"",t.toneMapping!==Dr?qt.tonemapping_pars_fragment:"",t.toneMapping!==Dr?dG("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",qt.colorspace_pars_fragment,cG("linearToOutputTexel",t.outputColorSpace),hG(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 4063`].filter(bd).join(` 4064`)),u=Bb(u),u=UE(u,t),u=IE(u,t),h=Bb(h),h=UE(h,t),h=IE(h,t),u=zE(u),h=zE(h),t.isRawShaderMaterial!==!0&&(T=`#version 300 es 4065`,w=[y,"#define attribute in","#define varying out","#define texture2D texture"].join(` 4066`)+` 4067`+w,S=["#define varying in",t.glslVersion===nE?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===nE?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` 4068`)+` 4069`+S);const N=T+w+u,j=T+S+h,O=PE(r,r.VERTEX_SHADER,N),R=PE(r,r.FRAGMENT_SHADER,j);r.attachShader(C,O),r.attachShader(C,R),t.index0AttributeName!==void 0?r.bindAttribLocation(C,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(C,0,"position"),r.linkProgram(C);function z(U){if(n.debug.checkShaderErrors){const Y=r.getProgramInfoLog(C)||"",W=r.getShaderInfoLog(O)||"",J=r.getShaderInfoLog(R)||"",F=Y.trim(),$=W.trim(),V=J.trim();let se=!0,ue=!0;if(r.getProgramParameter(C,r.LINK_STATUS)===!1)if(se=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,C,O,R);else{const Ce=DE(r,O,"vertex"),D=DE(r,R,"fragment");hn("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(C,r.VALIDATE_STATUS)+` 4070 4071Material Name: `+U.name+` 4072Material Type: `+U.type+` 4073 4074Program Info Log: `+F+` 4075`+Ce+` 4076`+D)}else F!==""?Bt("WebGLProgram: Program Info Log:",F):($===""||V==="")&&(ue=!1);ue&&(U.diagnostics={runnable:se,programLog:F,vertexShader:{log:$,prefix:w},fragmentShader:{log:V,prefix:S}})}r.deleteShader(O),r.deleteShader(R),M=new Tp(r,C),P=mG(r,C)}let M;this.getUniforms=function(){return M===void 0&&z(this),M};let P;this.getAttributes=function(){return P===void 0&&z(this),P};let G=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return G===!1&&(G=r.getProgramParameter(C,rG)),G},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(C),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=aG++,this.cacheKey=e,this.usedTimes=1,this.program=C,this.vertexShader=O,this.fragmentShader=R,this}let kG=0;class jG{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),l=this._getShaderStage(i),u=this._getShaderCacheForMaterial(e);return u.has(r)===!1&&(u.add(r),r.usedTimes++),u.has(l)===!1&&(u.add(l),l.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new LG(e),t.set(e,i)),i}}class LG{constructor(e){this.id=kG++,this.code=e,this.usedTimes=0}}function PG(n,e,t,i,r,l){const u=new xC,h=new jG,d=new Set,p=[],m=new Map,g=i.logarithmicDepthBuffer;let b=i.precision;const y={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(M){return d.add(M),M===0?"uv":`uv${M}`}function C(M,P,G,U,Y){const W=U.fog,J=Y.geometry,F=M.isMeshStandardMaterial||M.isMeshLambertMaterial||M.isMeshPhongMaterial?U.environment:null,$=M.isMeshStandardMaterial||M.isMeshLambertMaterial&&!M.envMap||M.isMeshPhongMaterial&&!M.envMap,V=e.get(M.envMap||F,$),se=V&&V.mapping===Am?V.image.height:null,ue=y[M.type];M.precision!==null&&(b=i.getMaxPrecision(M.precision),b!==M.precision&&Bt("WebGLProgram.getParameters:",M.precision,"not supported, using",b,"instead."));const Ce=J.morphAttributes.position||J.morphAttributes.normal||J.morphAttributes.color,D=Ce!==void 0?Ce.length:0;let H=0;J.morphAttributes.position!==void 0&&(H=1),J.morphAttributes.normal!==void 0&&(H=2),J.morphAttributes.color!==void 0&&(H=3);let Z,Ee,je,le;if(ue){const ce=Mr[ue];Z=ce.vertexShader,Ee=ce.fragmentShader}else Z=M.vertexShader,Ee=M.fragmentShader,h.update(M),je=h.getVertexShaderID(M),le=h.getFragmentShaderID(M);const Se=n.getRenderTarget(),de=n.state.buffers.depth.getReversed(),Me=Y.isInstancedMesh===!0,Le=Y.isBatchedMesh===!0,pe=!!M.map,Be=!!M.matcap,We=!!V,dt=!!M.aoMap,Ct=!!M.lightMap,ut=!!M.bumpMap,kt=!!M.normalMap,K=!!M.displacementMap,Nt=!!M.emissiveMap,Tt=!!M.metalnessMap,Mt=!!M.roughnessMap,nt=M.anisotropy>0,I=M.clearcoat>0,k=M.dispersion>0,Q=M.iridescence>0,fe=M.sheen>0,be=M.transmission>0,xe=nt&&!!M.anisotropyMap,Xe=I&&!!M.clearcoatMap,$e=I&&!!M.clearcoatNormalMap,it=I&&!!M.clearcoatRoughnessMap,ht=Q&&!!M.iridescenceMap,X=Q&&!!M.iridescenceThicknessMap,oe=fe&&!!M.sheenColorMap,ke=fe&&!!M.sheenRoughnessMap,Ae=!!M.specularMap,De=!!M.specularColorMap,st=!!M.specularIntensityMap,te=be&&!!M.transmissionMap,Ie=be&&!!M.thicknessMap,Pe=!!M.gradientMap,Ze=!!M.alphaMap,ze=M.alphaTest>0,ge=!!M.alphaHash,Ye=!!M.extensions;let pt=Dr;M.toneMapped&&(Se===null||Se.isXRRenderTarget===!0)&&(pt=n.toneMapping);const Wt={shaderID:ue,shaderType:M.type,shaderName:M.name,vertexShader:Z,fragmentShader:Ee,defines:M.defines,customVertexShaderID:je,customFragmentShaderID:le,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:b,batching:Le,batchingColor:Le&&Y._colorsTexture!==null,instancing:Me,instancingColor:Me&&Y.instanceColor!==null,instancingMorph:Me&&Y.morphTexture!==null,outputColorSpace:Se===null?n.outputColorSpace:Se.isXRRenderTarget===!0?Se.texture.colorSpace:Bc,alphaToCoverage:!!M.alphaToCoverage,map:pe,matcap:Be,envMap:We,envMapMode:We&&V.mapping,envMapCubeUVHeight:se,aoMap:dt,lightMap:Ct,bumpMap:ut,normalMap:kt,displacementMap:K,emissiveMap:Nt,normalMapObjectSpace:kt&&M.normalMapType===S$,normalMapTangentSpace:kt&&M.normalMapType===w$,metalnessMap:Tt,roughnessMap:Mt,anisotropy:nt,anisotropyMap:xe,clearcoat:I,clearcoatMap:Xe,clearcoatNormalMap:$e,clearcoatRoughnessMap:it,dispersion:k,iridescence:Q,iridescenceMap:ht,iridescenceThicknessMap:X,sheen:fe,sheenColorMap:oe,sheenRoughnessMap:ke,specularMap:Ae,specularColorMap:De,specularIntensityMap:st,transmission:be,transmissionMap:te,thicknessMap:Ie,gradientMap:Pe,opaque:M.transparent===!1&&M.blending===kc&&M.alphaToCoverage===!1,alphaMap:Ze,alphaTest:ze,alphaHash:ge,combine:M.combine,mapUv:pe&&_(M.map.channel),aoMapUv:dt&&_(M.aoMap.channel),lightMapUv:Ct&&_(M.lightMap.channel),bumpMapUv:ut&&_(M.bumpMap.channel),normalMapUv:kt&&_(M.normalMap.channel),displacementMapUv:K&&_(M.displacementMap.channel),emissiveMapUv:Nt&&_(M.emissiveMap.channel),metalnessMapUv:Tt&&_(M.metalnessMap.channel),roughnessMapUv:Mt&&_(M.roughnessMap.channel),anisotropyMapUv:xe&&_(M.anisotropyMap.channel),clearcoatMapUv:Xe&&_(M.clearcoatMap.channel),clearcoatNormalMapUv:$e&&_(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:it&&_(M.clearcoatRoughnessMap.channel),iridescenceMapUv:ht&&_(M.iridescenceMap.channel),iridescenceThicknessMapUv:X&&_(M.iridescenceThicknessMap.channel),sheenColorMapUv:oe&&_(M.sheenColorMap.channel),sheenRoughnessMapUv:ke&&_(M.sheenRoughnessMap.channel),specularMapUv:Ae&&_(M.specularMap.channel),specularColorMapUv:De&&_(M.specularColorMap.channel),specularIntensityMapUv:st&&_(M.specularIntensityMap.channel),transmissionMapUv:te&&_(M.transmissionMap.channel),thicknessMapUv:Ie&&_(M.thicknessMap.channel),alphaMapUv:Ze&&_(M.alphaMap.channel),vertexTangents:!!J.attributes.tangent&&(kt||nt),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!J.attributes.color&&J.attributes.color.itemSize===4,pointsUvs:Y.isPoints===!0&&!!J.attributes.uv&&(pe||Ze),fog:!!W,useFog:M.fog===!0,fogExp2:!!W&&W.isFogExp2,flatShading:M.wireframe===!1&&(M.flatShading===!0||J.attributes.normal===void 0&&kt===!1&&(M.isMeshLambertMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isMeshPhysicalMaterial)),sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:de,skinning:Y.isSkinnedMesh===!0,morphTargets:J.morphAttributes.position!==void 0,morphNormals:J.morphAttributes.normal!==void 0,morphColors:J.morphAttributes.color!==void 0,morphTargetsCount:D,morphTextureStride:H,numDirLights:P.directional.length,numPointLights:P.point.length,numSpotLights:P.spot.length,numSpotLightMaps:P.spotLightMap.length,numRectAreaLights:P.rectArea.length,numHemiLights:P.hemi.length,numDirLightShadows:P.directionalShadowMap.length,numPointLightShadows:P.pointShadowMap.length,numSpotLightShadows:P.spotShadowMap.length,numSpotLightShadowsWithMaps:P.numSpotLightShadowsWithMaps,numLightProbes:P.numLightProbes,numClippingPlanes:l.numPlanes,numClipIntersection:l.numIntersection,dithering:M.dithering,shadowMapEnabled:n.shadowMap.enabled&&G.length>0,shadowMapType:n.shadowMap.type,toneMapping:pt,decodeVideoTexture:pe&&M.map.isVideoTexture===!0&&cn.getTransfer(M.map.colorSpace)===yn,decodeVideoTextureEmissive:Nt&&M.emissiveMap.isVideoTexture===!0&&cn.getTransfer(M.emissiveMap.colorSpace)===yn,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===Rr,flipSided:M.side===os,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:Ye&&M.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ye&&M.extensions.multiDraw===!0||Le)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return Wt.vertexUv1s=d.has(1),Wt.vertexUv2s=d.has(2),Wt.vertexUv3s=d.has(3),d.clear(),Wt}function w(M){const P=[];if(M.shaderID?P.push(M.shaderID):(P.push(M.customVertexShaderID),P.push(M.customFragmentShaderID)),M.defines!==void 0)for(const G in M.defines)P.push(G),P.push(M.defines[G]);return M.isRawShaderMaterial===!1&&(S(P,M),T(P,M),P.push(n.outputColorSpace)),P.push(M.customProgramCacheKey),P.join()}function S(M,P){M.push(P.precision),M.push(P.outputColorSpace),M.push(P.envMapMode),M.push(P.envMapCubeUVHeight),M.push(P.mapUv),M.push(P.alphaMapUv),M.push(P.lightMapUv),M.push(P.aoMapUv),M.push(P.bumpMapUv),M.push(P.normalMapUv),M.push(P.displacementMapUv),M.push(P.emissiveMapUv),M.push(P.metalnessMapUv),M.push(P.roughnessMapUv),M.push(P.anisotropyMapUv),M.push(P.clearcoatMapUv),M.push(P.clearcoatNormalMapUv),M.push(P.clearcoatRoughnessMapUv),M.push(P.iridescenceMapUv),M.push(P.iridescenceThicknessMapUv),M.push(P.sheenColorMapUv),M.push(P.sheenRoughnessMapUv),M.push(P.specularMapUv),M.push(P.specularColorMapUv),M.push(P.specularIntensityMapUv),M.push(P.transmissionMapUv),M.push(P.thicknessMapUv),M.push(P.combine),M.push(P.fogExp2),M.push(P.sizeAttenuation),M.push(P.morphTargetsCount),M.push(P.morphAttributeCount),M.push(P.numDirLights),M.push(P.numPointLights),M.push(P.numSpotLights),M.push(P.numSpotLightMaps),M.push(P.numHemiLights),M.push(P.numRectAreaLights),M.push(P.numDirLightShadows),M.push(P.numPointLightShadows),M.push(P.numSpotLightShadows),M.push(P.numSpotLightShadowsWithMaps),M.push(P.numLightProbes),M.push(P.shadowMapType),M.push(P.toneMapping),M.push(P.numClippingPlanes),M.push(P.numClipIntersection),M.push(P.depthPacking)}function T(M,P){u.disableAll(),P.instancing&&u.enable(0),P.instancingColor&&u.enable(1),P.instancingMorph&&u.enable(2),P.matcap&&u.enable(3),P.envMap&&u.enable(4),P.normalMapObjectSpace&&u.enable(5),P.normalMapTangentSpace&&u.enable(6),P.clearcoat&&u.enable(7),P.iridescence&&u.enable(8),P.alphaTest&&u.enable(9),P.vertexColors&&u.enable(10),P.vertexAlphas&&u.enable(11),P.vertexUv1s&&u.enable(12),P.vertexUv2s&&u.enable(13),P.vertexUv3s&&u.enable(14),P.vertexTangents&&u.enable(15),P.anisotropy&&u.enable(16),P.alphaHash&&u.enable(17),P.batching&&u.enable(18),P.dispersion&&u.enable(19),P.batchingColor&&u.enable(20),P.gradientMap&&u.enable(21),M.push(u.mask),u.disableAll(),P.fog&&u.enable(0),P.useFog&&u.enable(1),P.flatShading&&u.enable(2),P.logarithmicDepthBuffer&&u.enable(3),P.reversedDepthBuffer&&u.enable(4),P.skinning&&u.enable(5),P.morphTargets&&u.enable(6),P.morphNormals&&u.enable(7),P.morphColors&&u.enable(8),P.premultipliedAlpha&&u.enable(9),P.shadowMapEnabled&&u.enable(10),P.doubleSided&&u.enable(11),P.flipSided&&u.enable(12),P.useDepthPacking&&u.enable(13),P.dithering&&u.enable(14),P.transmission&&u.enable(15),P.sheen&&u.enable(16),P.opaque&&u.enable(17),P.pointsUvs&&u.enable(18),P.decodeVideoTexture&&u.enable(19),P.decodeVideoTextureEmissive&&u.enable(20),P.alphaToCoverage&&u.enable(21),M.push(u.mask)}function N(M){const P=y[M.type];let G;if(P){const U=Mr[P];G=oF.clone(U.uniforms)}else G=M.uniforms;return G}function j(M,P){let G=m.get(P);return G!==void 0?++G.usedTimes:(G=new RG(n,P,M,r),p.push(G),m.set(P,G)),G}function O(M){if(--M.usedTimes===0){const P=p.indexOf(M);p[P]=p[p.length-1],p.pop(),m.delete(M.cacheKey),M.destroy()}}function R(M){h.remove(M)}function z(){h.dispose()}return{getParameters:C,getProgramCacheKey:w,getUniforms:N,acquireProgram:j,releaseProgram:O,releaseShaderCache:R,programs:p,dispose:z}}function OG(){let n=new WeakMap;function e(u){return n.has(u)}function t(u){let h=n.get(u);return h===void 0&&(h={},n.set(u,h)),h}function i(u){n.delete(u)}function r(u,h,d){n.get(u)[h]=d}function l(){n=new WeakMap}return{has:e,get:t,remove:i,update:r,dispose:l}}function DG(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.materialVariant!==e.materialVariant?n.materialVariant-e.materialVariant:n.z!==e.z?n.z-e.z:n.id-e.id}function FE(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function BE(){const n=[];let e=0;const t=[],i=[],r=[];function l(){e=0,t.length=0,i.length=0,r.length=0}function u(b){let y=0;return b.isInstancedMesh&&(y+=2),b.isSkinnedMesh&&(y+=1),y}function h(b,y,_,C,w,S){let T=n[e];return T===void 0?(T={id:b.id,object:b,geometry:y,material:_,materialVariant:u(b),groupOrder:C,renderOrder:b.renderOrder,z:w,group:S},n[e]=T):(T.id=b.id,T.object=b,T.geometry=y,T.material=_,T.materialVariant=u(b),T.groupOrder=C,T.renderOrder=b.renderOrder,T.z=w,T.group=S),e++,T}function d(b,y,_,C,w,S){const T=h(b,y,_,C,w,S);_.transmission>0?i.push(T):_.transparent===!0?r.push(T):t.push(T)}function p(b,y,_,C,w,S){const T=h(b,y,_,C,w,S);_.transmission>0?i.unshift(T):_.transparent===!0?r.unshift(T):t.unshift(T)}function m(b,y){t.length>1&&t.sort(b||DG),i.length>1&&i.sort(y||FE),r.length>1&&r.sort(y||FE)}function g(){for(let b=e,y=n.length;b<y;b++){const _=n[b];if(_.id===null)break;_.id=null,_.object=null,_.geometry=null,_.material=null,_.group=null}}return{opaque:t,transmissive:i,transparent:r,init:l,push:d,unshift:p,finish:g,
vendor: 1,287 bytes, line 4076
4076sort:m}}function UG(){let n=new WeakMap;function e(i,r){const l=n.get(i);let u;return l===void 0?(u=new BE,n.set(i,[u])):r>=l.length?(u=new BE,l.push(u)):u=l[r],u}function t(){n=new WeakMap}return{get:e,dispose:t}}function IG(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new Ne,color:new _n};break;case"SpotLight":t={position:new Ne,direction:new Ne,color:new _n,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Ne,color:new _n,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Ne,skyColor:new _n,groundColor:new _n};break;case"RectAreaLight":t={color:new _n,position:new Ne,halfWidth:new Ne,halfHeight:new Ne};break}return n[e.id]=t,t}}}function zG(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Cn};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Cn};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Cn,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let $G=0;
vendor: 5,833 bytes, line 4076
4076function FG(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function BG(n){const e=new IG,t=zG(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let p=0;p<9;p++)i.probe.push(new Ne);const r=new Ne,l=new hi,u=new hi;function h(p){let m=0,g=0,b=0;for(let P=0;P<9;P++)i.probe[P].set(0,0,0);let y=0,_=0,C=0,w=0,S=0,T=0,N=0,j=0,O=0,R=0,z=0;p.sort(FG);for(let P=0,G=p.length;P<G;P++){const U=p[P],Y=U.color,W=U.intensity,J=U.distance;let F=null;if(U.shadow&&U.shadow.map&&(U.shadow.map.texture.format===Fc?F=U.shadow.map.texture:F=U.shadow.map.depthTexture||U.shadow.map.texture),U.isAmbientLight)m+=Y.r*W,g+=Y.g*W,b+=Y.b*W;else if(U.isLightProbe){for(let $=0;$<9;$++)i.probe[$].addScaledVector(U.sh.coefficients[$],W);z++}else if(U.isDirectionalLight){const $=e.get(U);if($.color.copy(U.color).multiplyScalar(U.intensity),U.castShadow){const V=U.shadow,se=t.get(U);se.shadowIntensity=V.intensity,se.shadowBias=V.bias,se.shadowNormalBias=V.normalBias,se.shadowRadius=V.radius,se.shadowMapSize=V.mapSize,i.directionalShadow[y]=se,i.directionalShadowMap[y]=F,i.directionalShadowMatrix[y]=U.shadow.matrix,T++}i.directional[y]=$,y++}else if(U.isSpotLight){const $=e.get(U);$.position.setFromMatrixPosition(U.matrixWorld),$.color.copy(Y).multiplyScalar(W),$.distance=J,$.coneCos=Math.cos(U.angle),$.penumbraCos=Math.cos(U.angle*(1-U.penumbra)),$.decay=U.decay,i.spot[C]=$;const V=U.shadow;if(U.map&&(i.spotLightMap[O]=U.map,O++,V.updateMatrices(U),U.castShadow&&R++),i.spotLightMatrix[C]=V.matrix,U.castShadow){const se=t.get(U);se.shadowIntensity=V.intensity,se.shadowBias=V.bias,se.shadowNormalBias=V.normalBias,se.shadowRadius=V.radius,se.shadowMapSize=V.mapSize,i.spotShadow[C]=se,i.spotShadowMap[C]=F,j++}C++}else if(U.isRectAreaLight){const $=e.get(U);$.color.copy(Y).multiplyScalar(W),$.halfWidth.set(U.width*.5,0,0),$.halfHeight.set(0,U.height*.5,0),i.rectArea[w]=$,w++}else if(U.isPointLight){const $=e.get(U);if($.color.copy(U.color).multiplyScalar(U.intensity),$.distance=U.distance,$.decay=U.decay,U.castShadow){const V=U.shadow,se=t.get(U);se.shadowIntensity=V.intensity,se.shadowBias=V.bias,se.shadowNormalBias=V.normalBias,se.shadowRadius=V.radius,se.shadowMapSize=V.mapSize,se.shadowCameraNear=V.camera.near,se.shadowCameraFar=V.camera.far,i.pointShadow[_]=se,i.pointShadowMap[_]=F,i.pointShadowMatrix[_]=U.shadow.matrix,N++}i.point[_]=$,_++}else if(U.isHemisphereLight){const $=e.get(U);$.skyColor.copy(U.color).multiplyScalar(W),$.groundColor.copy(U.groundColor).multiplyScalar(W),i.hemi[S]=$,S++}}w>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=at.LTC_FLOAT_1,i.rectAreaLTC2=at.LTC_FLOAT_2):(i.rectAreaLTC1=at.LTC_HALF_1,i.rectAreaLTC2=at.LTC_HALF_2)),i.ambient[0]=m,i.ambient[1]=g,i.ambient[2]=b;const M=i.hash;(M.directionalLength!==y||M.pointLength!==_||M.spotLength!==C||M.rectAreaLength!==w||M.hemiLength!==S||M.numDirectionalShadows!==T||M.numPointShadows!==N||M.numSpotShadows!==j||M.numSpotMaps!==O||M.numLightProbes!==z)&&(i.directional.length=y,i.spot.length=C,i.rectArea.length=w,i.point.length=_,i.hemi.length=S,i.directionalShadow.length=T,i.directionalShadowMap.length=T,i.pointShadow.length=N,i.pointShadowMap.length=N,i.spotShadow.length=j,i.spotShadowMap.length=j,i.directionalShadowMatrix.length=T,i.pointShadowMatrix.length=N,i.spotLightMatrix.length=j+O-R,i.spotLightMap.length=O,i.numSpotLightShadowsWithMaps=R,i.numLightProbes=z,M.directionalLength=y,M.pointLength=_,M.spotLength=C,M.rectAreaLength=w,M.hemiLength=S,M.numDirectionalShadows=T,M.numPointShadows=N,M.numSpotShadows=j,M.numSpotMaps=O,M.numLightProbes=z,i.version=$G++)}function d(p,m){let g=0,b=0,y=0,_=0,C=0;const w=m.matrixWorldInverse;for(let S=0,T=p.length;S<T;S++){const N=p[S];if(N.isDirectionalLight){const j=i.directional[g];j.direction.setFromMatrixPosition(N.matrixWorld),r.setFromMatrixPosition(N.target.matrixWorld),j.direction.sub(r),j.direction.transformDirection(w),g++}else if(N.isSpotLight){const j=i.spot[y];j.position.setFromMatrixPosition(N.matrixWorld),j.position.applyMatrix4(w),j.direction.setFromMatrixPosition(N.matrixWorld),r.setFromMatrixPosition(N.target.matrixWorld),j.direction.sub(r),j.direction.transformDirection(w),y++}else if(N.isRectAreaLight){const j=i.rectArea[_];j.position.setFromMatrixPosition(N.matrixWorld),j.position.applyMatrix4(w),u.identity(),l.copy(N.matrixWorld),l.premultiply(w),u.extractRotation(l),j.halfWidth.set(N.width*.5,0,0),j.halfHeight.set(0,N.height*.5,0),j.halfWidth.applyMatrix4(u),j.halfHeight.applyMatrix4(u),_++}else if(N.isPointLight){const j=i.point[b];j.position.setFromMatrixPosition(N.matrixWorld),j.position.applyMatrix4(w),b++}else if(N.isHemisphereLight){const j=i.hemi[C];j.direction.setFromMatrixPosition(N.matrixWorld),j.direction.transformDirection(w),C++}}}return{setup:h,setupView:d,state:i}}function HE(n){const e=new BG(n),t=[],i=[];function r(m){p.camera=m,t.length=0,i.length=0}function l(m){t.push(m)}function u(m){i.push(m)}function h(){e.setup(t)}function d(m){e.setupView(t,m)}const p={lightsArray:t,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:p,setupLights:h,setupLightsView:d,pushLight:l,pushShadow:u}}function HG(n){let e=new WeakMap;function t(r,l=0){const u=e.get(r);let h;return u===void 0?(h=new HE(n),e.set(r,[h])):l>=u.length?(h=new HE(n),u.push(h)):h=u[l],h}
vendor: 4,090 bytes, lines 4076-4103
4076function i(){e=new WeakMap}return{get:t,dispose:i}}const VG=`void main() { 4077 gl_Position = vec4( position, 1.0 ); 4078}`,GG=`uniform sampler2D shadow_pass; 4079uniform vec2 resolution; 4080uniform float radius; 4081void main() { 4082 const float samples = float( VSM_SAMPLES ); 4083 float mean = 0.0; 4084 float squared_mean = 0.0; 4085 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 4086 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 4087 for ( float i = 0.0; i < samples; i ++ ) { 4088 float uvOffset = uvStart + i * uvStride; 4089 #ifdef HORIZONTAL_PASS 4090 vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; 4091 mean += distribution.x; 4092 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 4093 #else 4094 float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; 4095 mean += depth; 4096 squared_mean += depth * depth; 4097 #endif 4098 } 4099 mean = mean / samples; 4100 squared_mean = squared_mean / samples; 4101 float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); 4102 gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); 4103}`,qG=[new Ne(1,0,0),new Ne(-1,0,0),new Ne(0,1,0),new Ne(0,-1,0),new Ne(0,0,1),new Ne(0,0,-1)],WG=[new Ne(0,-1,0),new Ne(0,-1,0),new Ne(0,0,1),new Ne(0,0,-1),new Ne(0,-1,0),new Ne(0,-1,0)],VE=new hi,hd=new Ne,Qx=new Ne;function XG(n,e,t){let i=new wC;const r=new Cn,l=new Cn,u=new Kn,h=new uF,d=new dF,p={},m=t.maxTextureSize,g={[So]:os,[os]:So,[Rr]:Rr},b=new Gr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Cn},radius:{value:4}},vertexShader:VG,fragmentShader:GG}),y=b.clone();y.defines.HORIZONTAL_PASS=1;const _=new Xr;_.setAttribute("position",new gr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const C=new Vr(_,b),w=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=wp;let S=this.type;this.render=function(R,z,M){if(w.enabled===!1||w.autoUpdate===!1&&w.needsUpdate===!1||R.length===0)return;this.type===Jz&&(Bt("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=wp);const P=n.getRenderTarget(),G=n.getActiveCubeFace(),U=n.getActiveMipmapLevel(),Y=n.state;Y.setBlending(Na),Y.buffers.depth.getReversed()===!0?Y.buffers.color.setClear(0,0,0,0):Y.buffers.color.setClear(1,1,1,1),Y.buffers.depth.setTest(!0),Y.setScissorTest(!1);const W=S!==this.type;W&&z.traverse(function(J){J.material&&(Array.isArray(J.material)?J.material.forEach(F=>F.needsUpdate=!0):J.material.needsUpdate=!0)});for(let J=0,F=R.length;J<F;J++){const $=R[J],V=$.shadow;if(V===void 0){Bt("WebGLShadowMap:",$,"has no shadow.");continue}if(V.autoUpdate===!1&&V.needsUpdate===!1)continue;r.copy(V.mapSize);const se=V.getFrameExtents();r.multiply(se),l.copy(V.mapSize),(r.x>m||r.y>m)&&(r.x>m&&(l.x=Math.floor(m/se.x),r.x=l.x*se.x,V.mapSize.x=l.x),r.y>m&&(l.y=Math.floor(m/se.y),r.y=l.y*se.y,V.mapSize.y=l.y));const ue=n.state.buffers.depth.getReversed();if(V.camera._reversedDepth=ue,V.map===null||W===!0){if(V.map!==null&&(V.map.depthTexture!==null&&(V.map.depthTexture.dispose(),V.map.depthTexture=null),V.map.dispose()),this.type===xd){if($.isPointLight){Bt("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}V.map=new Ur(r.x,r.y,{format:Fc,type:Ra,minFilter:zi,magFilter:zi,generateMipmaps:!1}),V.map.texture.name=$.name+".shadowMap",V.map.depthTexture=new Xd(r.x,r.y,kr),V.map.depthTexture.name=$.name+".shadowMapDepth",V.map.depthTexture.format=ka,V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=Ri,V.map.depthTexture.magFilter=Ri}else $.isPointLight?(V.map=new AC(r.x),V.map.depthTexture=new rF(r.x,Hr)):(V.map=new Ur(r.x,r.y),V.map.depthTexture=new Xd(r.x,r.y,Hr)),V.map.depthTexture.name=$.name+".shadowMap",V.map.depthTexture.format=ka,this.type===wp?(V.map.depthTexture.compareFunction=ue?cy:ly,V.map.depthTexture.minFilter=zi,V.map.depthTexture.magFilter=zi):(V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=Ri,V.map.depthTexture.magFilter=Ri);V.camera.updateProjectionMatrix()}
vendor: 10,424 bytes, line 4103
4103const Ce=V.map.isWebGLCubeRenderTarget?6:1;for(let D=0;D<Ce;D++){if(V.map.isWebGLCubeRenderTarget)n.setRenderTarget(V.map,D),n.clear();else{D===0&&(n.setRenderTarget(V.map),n.clear());const H=V.getViewport(D);u.set(l.x*H.x,l.y*H.y,l.x*H.z,l.y*H.w),Y.viewport(u)}if($.isPointLight){const H=V.camera,Z=V.matrix,Ee=$.distance||H.far;Ee!==H.far&&(H.far=Ee,H.updateProjectionMatrix()),hd.setFromMatrixPosition($.matrixWorld),H.position.copy(hd),Qx.copy(H.position),Qx.add(qG[D]),H.up.copy(WG[D]),H.lookAt(Qx),H.updateMatrixWorld(),Z.makeTranslation(-hd.x,-hd.y,-hd.z),VE.multiplyMatrices(H.projectionMatrix,H.matrixWorldInverse),V._frustum.setFromProjectionMatrix(VE,H.coordinateSystem,H.reversedDepth)}else V.updateMatrices($);i=V.getFrustum(),j(z,M,V.camera,$,this.type)}V.isPointLightShadow!==!0&&this.type===xd&&T(V,M),V.needsUpdate=!1}S=this.type,w.needsUpdate=!1,n.setRenderTarget(P,G,U)};function T(R,z){const M=e.update(C);b.defines.VSM_SAMPLES!==R.blurSamples&&(b.defines.VSM_SAMPLES=R.blurSamples,y.defines.VSM_SAMPLES=R.blurSamples,b.needsUpdate=!0,y.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new Ur(r.x,r.y,{format:Fc,type:Ra})),b.uniforms.shadow_pass.value=R.map.depthTexture,b.uniforms.resolution.value=R.mapSize,b.uniforms.radius.value=R.radius,n.setRenderTarget(R.mapPass),n.clear(),n.renderBufferDirect(z,null,M,b,C,null),y.uniforms.shadow_pass.value=R.mapPass.texture,y.uniforms.resolution.value=R.mapSize,y.uniforms.radius.value=R.radius,n.setRenderTarget(R.map),n.clear(),n.renderBufferDirect(z,null,M,y,C,null)}function N(R,z,M,P){let G=null;const U=M.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(U!==void 0)G=U;else if(G=M.isPointLight===!0?d:h,n.localClippingEnabled&&z.clipShadows===!0&&Array.isArray(z.clippingPlanes)&&z.clippingPlanes.length!==0||z.displacementMap&&z.displacementScale!==0||z.alphaMap&&z.alphaTest>0||z.map&&z.alphaTest>0||z.alphaToCoverage===!0){const Y=G.uuid,W=z.uuid;let J=p[Y];J===void 0&&(J={},p[Y]=J);let F=J[W];F===void 0&&(F=G.clone(),J[W]=F,z.addEventListener("dispose",O)),G=F}if(G.visible=z.visible,G.wireframe=z.wireframe,P===xd?G.side=z.shadowSide!==null?z.shadowSide:z.side:G.side=z.shadowSide!==null?z.shadowSide:g[z.side],G.alphaMap=z.alphaMap,G.alphaTest=z.alphaToCoverage===!0?.5:z.alphaTest,G.map=z.map,G.clipShadows=z.clipShadows,G.clippingPlanes=z.clippingPlanes,G.clipIntersection=z.clipIntersection,G.displacementMap=z.displacementMap,G.displacementScale=z.displacementScale,G.displacementBias=z.displacementBias,G.wireframeLinewidth=z.wireframeLinewidth,G.linewidth=z.linewidth,M.isPointLight===!0&&G.isMeshDistanceMaterial===!0){const Y=n.properties.get(G);Y.light=M}return G}function j(R,z,M,P,G){if(R.visible===!1)return;if(R.layers.test(z.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&G===xd)&&(!R.frustumCulled||i.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(M.matrixWorldInverse,R.matrixWorld);const W=e.update(R),J=R.material;if(Array.isArray(J)){const F=W.groups;for(let $=0,V=F.length;$<V;$++){const se=F[$],ue=J[se.materialIndex];if(ue&&ue.visible){const Ce=N(R,ue,P,G);R.onBeforeShadow(n,R,z,M,W,Ce,se),n.renderBufferDirect(M,null,W,Ce,R,se),R.onAfterShadow(n,R,z,M,W,Ce,se)}}}else if(J.visible){const F=N(R,J,P,G);R.onBeforeShadow(n,R,z,M,W,F,null),n.renderBufferDirect(M,null,W,F,R,null),R.onAfterShadow(n,R,z,M,W,F,null)}}const Y=R.children;for(let W=0,J=Y.length;W<J;W++)j(Y[W],z,M,P,G)}function O(R){R.target.removeEventListener("dispose",O);for(const M in p){const P=p[M],G=R.target.uuid;G in P&&(P[G].dispose(),delete P[G])}}}function YG(n,e){function t(){let te=!1;const Ie=new Kn;let Pe=null;const Ze=new Kn(0,0,0,0);return{setMask:function(ze){Pe!==ze&&!te&&(n.colorMask(ze,ze,ze,ze),Pe=ze)},setLocked:function(ze){te=ze},setClear:function(ze,ge,Ye,pt,Wt){Wt===!0&&(ze*=pt,ge*=pt,Ye*=pt),Ie.set(ze,ge,Ye,pt),Ze.equals(Ie)===!1&&(n.clearColor(ze,ge,Ye,pt),Ze.copy(Ie))},reset:function(){te=!1,Pe=null,Ze.set(-1,0,0,0)}}}function i(){let te=!1,Ie=!1,Pe=null,Ze=null,ze=null;return{setReversed:function(ge){if(Ie!==ge){const Ye=e.get("EXT_clip_control");ge?Ye.clipControlEXT(Ye.LOWER_LEFT_EXT,Ye.ZERO_TO_ONE_EXT):Ye.clipControlEXT(Ye.LOWER_LEFT_EXT,Ye.NEGATIVE_ONE_TO_ONE_EXT),Ie=ge;const pt=ze;ze=null,this.setClear(pt)}},getReversed:function(){return Ie},setTest:function(ge){ge?Se(n.DEPTH_TEST):de(n.DEPTH_TEST)},setMask:function(ge){Pe!==ge&&!te&&(n.depthMask(ge),Pe=ge)},setFunc:function(ge){if(Ie&&(ge=L$[ge]),Ze!==ge){switch(ge){case J1:n.depthFunc(n.NEVER);break;case eb:n.depthFunc(n.ALWAYS);break;case tb:n.depthFunc(n.LESS);break;case zc:n.depthFunc(n.LEQUAL);break;case nb:n.depthFunc(n.EQUAL);break;case ib:n.depthFunc(n.GEQUAL);break;case sb:n.depthFunc(n.GREATER);break;case rb:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}Ze=ge}},setLocked:function(ge){te=ge},setClear:function(ge){ze!==ge&&(ze=ge,Ie&&(ge=1-ge),n.clearDepth(ge))},reset:function(){te=!1,Pe=null,Ze=null,ze=null,Ie=!1}}}function r(){let te=!1,Ie=null,Pe=null,Ze=null,ze=null,ge=null,Ye=null,pt=null,Wt=null;return{setTest:function(ce){te||(ce?Se(n.STENCIL_TEST):de(n.STENCIL_TEST))},setMask:function(ce){Ie!==ce&&!te&&(n.stencilMask(ce),Ie=ce)},setFunc:function(ce,Ge,vt){(Pe!==ce||Ze!==Ge||ze!==vt)&&(n.stencilFunc(ce,Ge,vt),Pe=ce,Ze=Ge,ze=vt)},setOp:function(ce,Ge,vt){(ge!==ce||Ye!==Ge||pt!==vt)&&(n.stencilOp(ce,Ge,vt),ge=ce,Ye=Ge,pt=vt)},setLocked:function(ce){te=ce},setClear:function(ce){Wt!==ce&&(n.clearStencil(ce),Wt=ce)},reset:function(){te=!1,Ie=null,Pe=null,Ze=null,ze=null,ge=null,Ye=null,pt=null,Wt=null}}}const l=new t,u=new i,h=new r,d=new WeakMap,p=new WeakMap;let m={},g={},b=new WeakMap,y=[],_=null,C=!1,w=null,S=null,T=null,N=null,j=null,O=null,R=null,z=new _n(0,0,0),M=0,P=!1,G=null,U=null,Y=null,W=null,J=null;const F=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let $=!1,V=0;const se=n.getParameter(n.VERSION);se.indexOf("WebGL")!==-1?(V=parseFloat(/^WebGL (\d)/.exec(se)[1]),$=V>=1):se.indexOf("OpenGL ES")!==-1&&(V=parseFloat(/^OpenGL ES (\d)/.exec(se)[1]),$=V>=2);let ue=null,Ce={};const D=n.getParameter(n.SCISSOR_BOX),H=n.getParameter(n.VIEWPORT),Z=new Kn().fromArray(D),Ee=new Kn().fromArray(H);function je(te,Ie,Pe,Ze){const ze=new Uint8Array(4),ge=n.createTexture();n.bindTexture(te,ge),n.texParameteri(te,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(te,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Ye=0;Ye<Pe;Ye++)te===n.TEXTURE_3D||te===n.TEXTURE_2D_ARRAY?n.texImage3D(Ie,0,n.RGBA,1,1,Ze,0,n.RGBA,n.UNSIGNED_BYTE,ze):n.texImage2D(Ie+Ye,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,ze);return ge}const le={};le[n.TEXTURE_2D]=je(n.TEXTURE_2D,n.TEXTURE_2D,1),le[n.TEXTURE_CUBE_MAP]=je(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),le[n.TEXTURE_2D_ARRAY]=je(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),le[n.TEXTURE_3D]=je(n.TEXTURE_3D,n.TEXTURE_3D,1,1),l.setClear(0,0,0,1),u.setClear(1),h.setClear(0),Se(n.DEPTH_TEST),u.setFunc(zc),ut(!1),kt(KS),Se(n.CULL_FACE),dt(Na);function Se(te){m[te]!==!0&&(n.enable(te),m[te]=!0)}function de(te){m[te]!==!1&&(n.disable(te),m[te]=!1)}function Me(te,Ie){return g[te]!==Ie?(n.bindFramebuffer(te,Ie),g[te]=Ie,te===n.DRAW_FRAMEBUFFER&&(g[n.FRAMEBUFFER]=Ie),te===n.FRAMEBUFFER&&(g[n.DRAW_FRAMEBUFFER]=Ie),!0):!1}function Le(te,Ie){let Pe=y,Ze=!1;if(te){Pe=b.get(Ie),Pe===void 0&&(Pe=[],b.set(Ie,Pe));const ze=te.textures;if(Pe.length!==ze.length||Pe[0]!==n.COLOR_ATTACHMENT0){for(let ge=0,Ye=ze.length;ge<Ye;ge++)Pe[ge]=n.COLOR_ATTACHMENT0+ge;Pe.length=ze.length,Ze=!0}}else Pe[0]!==n.BACK&&(Pe[0]=n.BACK,Ze=!0);Ze&&n.drawBuffers(Pe)}function pe(te){return _!==te?(n.useProgram(te),_=te,!0):!1}const Be={[il]:n.FUNC_ADD,[t$]:n.FUNC_SUBTRACT,[n$]:n.FUNC_REVERSE_SUBTRACT};Be[i$]=n.MIN,Be[s$]=n.MAX;const We={[r$]:n.ZERO,[a$]:n.ONE,[o$]:n.SRC_COLOR,[Z1]:n.SRC_ALPHA,[f$]:n.SRC_ALPHA_SATURATE,[d$]:n.DST_COLOR,[c$]:n.DST_ALPHA,[l$]:n.ONE_MINUS_SRC_COLOR,[Q1]:n.ONE_MINUS_SRC_ALPHA,[h$]:n.ONE_MINUS_DST_COLOR,[u$]:n.ONE_MINUS_DST_ALPHA,[p$]:n.CONSTANT_COLOR,[m$]:n.ONE_MINUS_CONSTANT_COLOR,[g$]:n.CONSTANT_ALPHA,[x$]:n.ONE_MINUS_CONSTANT_ALPHA};function dt(te,Ie,Pe,Ze,ze,ge,Ye,pt,Wt,ce){if(te===Na){C===!0&&(de(n.BLEND),C=!1);return}if(C===!1&&(Se(n.BLEND),C=!0),te!==e$){if(te!==w||ce!==P){if((S!==il||j!==il)&&(n.blendEquation(n.FUNC_ADD),S=il,j=il),ce)switch(te){case kc:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ZS:n.blendFunc(n.ONE,n.ONE);break;case QS:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case JS:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:hn("WebGLState: Invalid blending: ",te);break}else switch(te){case kc:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case ZS:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case QS:hn("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case JS:hn("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:hn("WebGLState: Invalid blending: ",te);break}T=null,N=null,O=null,R=null,z.set(0,0,0),M=0,w=te,P=ce}return}ze=ze||Ie,ge=ge||Pe,Ye=Ye||Ze,(Ie!==S||ze!==j)&&(n.blendEquationSeparate(Be[Ie],Be[ze]),S=Ie,j=ze),(Pe!==T||Ze!==N||ge!==O||Ye!==R)&&(n.blendFuncSeparate(We[Pe],We[Ze],We[ge],We[Ye]),T=Pe,N=Ze,O=ge,R=Ye),(pt.equals(z)===!1||Wt!==M)&&(n.blendColor(pt.r,pt.g,pt.b,Wt),z.copy(pt),M=Wt),w=te,P=!1}function Ct(te,Ie){te.side===Rr?de(n.CULL_FACE):Se(n.CULL_FACE);let Pe=te.side===os;Ie&&(Pe=!Pe),ut(Pe),te.blending===kc&&te.transparent===!1?dt(Na):dt(te.blending,te.blendEquation,te.blendSrc,te.blendDst,te.blendEquationAlpha,te.blendSrcAlpha,te.blendDstAlpha,te.blendColor,te.blendAlpha,te.premultipliedAlpha),u.setFunc(te.depthFunc),u.setTest(te.depthTest),u.setMask(te.depthWrite),l.setMask(te.colorWrite);const Ze=te.stencilWrite;h.setTest(Ze),Ze&&(h.setMask(te.stencilWriteMask),h.setFunc(te.stencilFunc,te.stencilRef,te.stencilFuncMask),h.setOp(te.stencilFail,te.stencilZFail,te.stencilZPass)),Nt(te.polygonOffset,te.polygonOffsetFactor,te.polygonOffsetUnits),te.alphaToCoverage===!0?Se(n.SAMPLE_ALPHA_TO_COVERAGE):de(n.SAMPLE_ALPHA_TO_COVERAGE)}function ut(te){G!==te&&(te?n.frontFace(n.CW):n.frontFace(n.CCW),G=te)}function kt(te){te!==Zz?(Se(n.CULL_FACE),te!==U&&(te===KS?n.cullFace(n.BACK):te===Qz?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):de(n.CULL_FACE),U=te}function K(te){te!==Y&&($&&n.lineWidth(te),Y=te)}
vendor: 2,285 bytes, line 4103
4103function Nt(te,Ie,Pe){te?(Se(n.POLYGON_OFFSET_FILL),(W!==Ie||J!==Pe)&&(W=Ie,J=Pe,u.getReversed()&&(Ie=-Ie),n.polygonOffset(Ie,Pe))):de(n.POLYGON_OFFSET_FILL)}function Tt(te){te?Se(n.SCISSOR_TEST):de(n.SCISSOR_TEST)}function Mt(te){te===void 0&&(te=n.TEXTURE0+F-1),ue!==te&&(n.activeTexture(te),ue=te)}function nt(te,Ie,Pe){Pe===void 0&&(ue===null?Pe=n.TEXTURE0+F-1:Pe=ue);let Ze=Ce[Pe];Ze===void 0&&(Ze={type:void 0,texture:void 0},Ce[Pe]=Ze),(Ze.type!==te||Ze.texture!==Ie)&&(ue!==Pe&&(n.activeTexture(Pe),ue=Pe),n.bindTexture(te,Ie||le[te]),Ze.type=te,Ze.texture=Ie)}function I(){const te=Ce[ue];te!==void 0&&te.type!==void 0&&(n.bindTexture(te.type,null),te.type=void 0,te.texture=void 0)}function k(){try{n.compressedTexImage2D(...arguments)}catch(te){hn("WebGLState:",te)}}function Q(){try{n.compressedTexImage3D(...arguments)}catch(te){hn("WebGLState:",te)}}function fe(){try{n.texSubImage2D(...arguments)}catch(te){hn("WebGLState:",te)}}function be(){try{n.texSubImage3D(...arguments)}catch(te){hn("WebGLState:",te)}}function xe(){try{n.compressedTexSubImage2D(...arguments)}catch(te){hn("WebGLState:",te)}}function Xe(){try{n.compressedTexSubImage3D(...arguments)}catch(te){hn("WebGLState:",te)}}function $e(){try{n.texStorage2D(...arguments)}catch(te){hn("WebGLState:",te)}}function it(){try{n.texStorage3D(...arguments)}catch(te){hn("WebGLState:",te)}}function ht(){try{n.texImage2D(...arguments)}catch(te){hn("WebGLState:",te)}}function X(){try{n.texImage3D(...arguments)}catch(te){hn("WebGLState:",te)}}function oe(te){Z.equals(te)===!1&&(n.scissor(te.x,te.y,te.z,te.w),Z.copy(te))}function ke(te){Ee.equals(te)===!1&&(n.viewport(te.x,te.y,te.z,te.w),Ee.copy(te))}function Ae(te,Ie){let Pe=p.get(Ie);Pe===void 0&&(Pe=new WeakMap,p.set(Ie,Pe));let Ze=Pe.get(te);Ze===void 0&&(Ze=n.getUniformBlockIndex(Ie,te.name),Pe.set(te,Ze))}function De(te,Ie){const Ze=p.get(Ie).get(te);d.get(Ie)!==Ze&&(n.uniformBlockBinding(Ie,Ze,te.__bindingPointIndex),d.set(Ie,Ze))}function st(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor
vendor: 84,129 bytes, lines 4103-4127
4103(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),u.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),m={},ue=null,Ce={},g={},b=new WeakMap,y=[],_=null,C=!1,w=null,S=null,T=null,N=null,j=null,O=null,R=null,z=new _n(0,0,0),M=0,P=!1,G=null,U=null,Y=null,W=null,J=null,Z.set(0,0,n.canvas.width,n.canvas.height),Ee.set(0,0,n.canvas.width,n.canvas.height),l.reset(),u.reset(),h.reset()}return{buffers:{color:l,depth:u,stencil:h},enable:Se,disable:de,bindFramebuffer:Me,drawBuffers:Le,useProgram:pe,setBlending:dt,setMaterial:Ct,setFlipSided:ut,setCullFace:kt,setLineWidth:K,setPolygonOffset:Nt,setScissorTest:Tt,activeTexture:Mt,bindTexture:nt,unbindTexture:I,compressedTexImage2D:k,compressedTexImage3D:Q,texImage2D:ht,texImage3D:X,updateUBOMapping:Ae,uniformBlockBinding:De,texStorage2D:$e,texStorage3D:it,texSubImage2D:fe,texSubImage3D:be,compressedTexSubImage2D:xe,compressedTexSubImage3D:Xe,scissor:oe,viewport:ke,reset:st}}function KG(n,e,t,i,r,l,u){const h=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,d=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),p=new Cn,m=new WeakMap;let g;const b=new WeakMap;let y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(I,k){return y?new OffscreenCanvas(I,k):Yp("canvas")}function C(I,k,Q){let fe=1;const be=nt(I);if((be.width>Q||be.height>Q)&&(fe=Q/Math.max(be.width,be.height)),fe<1)if(typeof HTMLImageElement<"u"&&I instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&I instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&I instanceof ImageBitmap||typeof VideoFrame<"u"&&I instanceof VideoFrame){const xe=Math.floor(fe*be.width),Xe=Math.floor(fe*be.height);g===void 0&&(g=_(xe,Xe));const $e=k?_(xe,Xe):g;return $e.width=xe,$e.height=Xe,$e.getContext("2d").drawImage(I,0,0,xe,Xe),Bt("WebGLRenderer: Texture has been resized from ("+be.width+"x"+be.height+") to ("+xe+"x"+Xe+")."),$e}else return"data"in I&&Bt("WebGLRenderer: Image in DataTexture is too big ("+be.width+"x"+be.height+")."),I;return I}function w(I){return I.generateMipmaps}function S(I){n.generateMipmap(I)}function T(I){return I.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:I.isWebGL3DRenderTarget?n.TEXTURE_3D:I.isWebGLArrayRenderTarget||I.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function N(I,k,Q,fe,be=!1){if(I!==null){if(n[I]!==void 0)return n[I];Bt("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+I+"'")}let xe=k;if(k===n.RED&&(Q===n.FLOAT&&(xe=n.R32F),Q===n.HALF_FLOAT&&(xe=n.R16F),Q===n.UNSIGNED_BYTE&&(xe=n.R8)),k===n.RED_INTEGER&&(Q===n.UNSIGNED_BYTE&&(xe=n.R8UI),Q===n.UNSIGNED_SHORT&&(xe=n.R16UI),Q===n.UNSIGNED_INT&&(xe=n.R32UI),Q===n.BYTE&&(xe=n.R8I),Q===n.SHORT&&(xe=n.R16I),Q===n.INT&&(xe=n.R32I)),k===n.RG&&(Q===n.FLOAT&&(xe=n.RG32F),Q===n.HALF_FLOAT&&(xe=n.RG16F),Q===n.UNSIGNED_BYTE&&(xe=n.RG8)),k===n.RG_INTEGER&&(Q===n.UNSIGNED_BYTE&&(xe=n.RG8UI),Q===n.UNSIGNED_SHORT&&(xe=n.RG16UI),Q===n.UNSIGNED_INT&&(xe=n.RG32UI),Q===n.BYTE&&(xe=n.RG8I),Q===n.SHORT&&(xe=n.RG16I),Q===n.INT&&(xe=n.RG32I)),k===n.RGB_INTEGER&&(Q===n.UNSIGNED_BYTE&&(xe=n.RGB8UI),Q===n.UNSIGNED_SHORT&&(xe=n.RGB16UI),Q===n.UNSIGNED_INT&&(xe=n.RGB32UI),Q===n.BYTE&&(xe=n.RGB8I),Q===n.SHORT&&(xe=n.RGB16I),Q===n.INT&&(xe=n.RGB32I)),k===n.RGBA_INTEGER&&(Q===n.UNSIGNED_BYTE&&(xe=n.RGBA8UI),Q===n.UNSIGNED_SHORT&&(xe=n.RGBA16UI),Q===n.UNSIGNED_INT&&(xe=n.RGBA32UI),Q===n.BYTE&&(xe=n.RGBA8I),Q===n.SHORT&&(xe=n.RGBA16I),Q===n.INT&&(xe=n.RGBA32I)),k===n.RGB&&(Q===n.UNSIGNED_INT_5_9_9_9_REV&&(xe=n.RGB9_E5),Q===n.UNSIGNED_INT_10F_11F_11F_REV&&(xe=n.R11F_G11F_B10F)),k===n.RGBA){const Xe=be?Wp:cn.getTransfer(fe);Q===n.FLOAT&&(xe=n.RGBA32F),Q===n.HALF_FLOAT&&(xe=n.RGBA16F),Q===n.UNSIGNED_BYTE&&(xe=Xe===yn?n.SRGB8_ALPHA8:n.RGBA8),Q===n.UNSIGNED_SHORT_4_4_4_4&&(xe=n.RGBA4),Q===n.UNSIGNED_SHORT_5_5_5_1&&(xe=n.RGB5_A1)}return(xe===n.R16F||xe===n.R32F||xe===n.RG16F||xe===n.RG32F||xe===n.RGBA16F||xe===n.RGBA32F)&&e.get("EXT_color_buffer_float"),xe}function j(I,k){let Q;return I?k===null||k===Hr||k===Wd?Q=n.DEPTH24_STENCIL8:k===kr?Q=n.DEPTH32F_STENCIL8:k===qd&&(Q=n.DEPTH24_STENCIL8,Bt("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):k===null||k===Hr||k===Wd?Q=n.DEPTH_COMPONENT24:k===kr?Q=n.DEPTH_COMPONENT32F:k===qd&&(Q=n.DEPTH_COMPONENT16),Q}function O(I,k){return w(I)===!0||I.isFramebufferTexture&&I.minFilter!==Ri&&I.minFilter!==zi?Math.log2(Math.max(k.width,k.height))+1:I.mipmaps!==void 0&&I.mipmaps.length>0?I.mipmaps.length:I.isCompressedTexture&&Array.isArray(I.image)?k.mipmaps.length:1}function R(I){const k=I.target;k.removeEventListener("dispose",R),M(k),k.isVideoTexture&&m.delete(k)}function z(I){const k=I.target;k.removeEventListener("dispose",z),G(k)}function M(I){const k=i.get(I);if(k.__webglInit===void 0)return;const Q=I.source,fe=b.get(Q);if(fe){const be=fe[k.__cacheKey];be.usedTimes--,be.usedTimes===0&&P(I),Object.keys(fe).length===0&&b.delete(Q)}i.remove(I)}function P(I){const k=i.get(I);n.deleteTexture(k.__webglTexture);const Q=I.source,fe=b.get(Q);delete fe[k.__cacheKey],u.memory.textures--}function G(I){const k=i.get(I);if(I.depthTexture&&(I.depthTexture.dispose(),i.remove(I.depthTexture)),I.isWebGLCubeRenderTarget)for(let fe=0;fe<6;fe++){if(Array.isArray(k.__webglFramebuffer[fe]))for(let be=0;be<k.__webglFramebuffer[fe].length;be++)n.deleteFramebuffer(k.__webglFramebuffer[fe][be]);else n.deleteFramebuffer(k.__webglFramebuffer[fe]);k.__webglDepthbuffer&&n.deleteRenderbuffer(k.__webglDepthbuffer[fe])}else{if(Array.isArray(k.__webglFramebuffer))for(let fe=0;fe<k.__webglFramebuffer.length;fe++)n.deleteFramebuffer(k.__webglFramebuffer[fe]);else n.deleteFramebuffer(k.__webglFramebuffer);if(k.__webglDepthbuffer&&n.deleteRenderbuffer(k.__webglDepthbuffer),k.__webglMultisampledFramebuffer&&n.deleteFramebuffer(k.__webglMultisampledFramebuffer),k.__webglColorRenderbuffer)for(let fe=0;fe<k.__webglColorRenderbuffer.length;fe++)k.__webglColorRenderbuffer[fe]&&n.deleteRenderbuffer(k.__webglColorRenderbuffer[fe]);k.__webglDepthRenderbuffer&&n.deleteRenderbuffer(k.__webglDepthRenderbuffer)}const Q=I.textures;for(let fe=0,be=Q.length;fe<be;fe++){const xe=i.get(Q[fe]);xe.__webglTexture&&(n.deleteTexture(xe.__webglTexture),u.memory.textures--),i.remove(Q[fe])}i.remove(I)}let U=0;function Y(){U=0}function W(){const I=U;return I>=r.maxTextures&&Bt("WebGLTextures: Trying to use "+I+" texture units while this GPU supports only "+r.maxTextures),U+=1,I}function J(I){const k=[];return k.push(I.wrapS),k.push(I.wrapT),k.push(I.wrapR||0),k.push(I.magFilter),k.push(I.minFilter),k.push(I.anisotropy),k.push(I.internalFormat),k.push(I.format),k.push(I.type),k.push(I.generateMipmaps),k.push(I.premultiplyAlpha),k.push(I.flipY),k.push(I.unpackAlignment),k.push(I.colorSpace),k.join()}function F(I,k){const Q=i.get(I);if(I.isVideoTexture&&Tt(I),I.isRenderTargetTexture===!1&&I.isExternalTexture!==!0&&I.version>0&&Q.__version!==I.version){const fe=I.image;if(fe===null)Bt("WebGLRenderer: Texture marked for update but no image data found.");else if(fe.complete===!1)Bt("WebGLRenderer: Texture marked for update but image is incomplete");else{le(Q,I,k);return}}else I.isExternalTexture&&(Q.__webglTexture=I.sourceTexture?I.sourceTexture:null);t.bindTexture(n.TEXTURE_2D,Q.__webglTexture,n.TEXTURE0+k)}function $(I,k){const Q=i.get(I);if(I.isRenderTargetTexture===!1&&I.version>0&&Q.__version!==I.version){le(Q,I,k);return}else I.isExternalTexture&&(Q.__webglTexture=I.sourceTexture?I.sourceTexture:null);t.bindTexture(n.TEXTURE_2D_ARRAY,Q.__webglTexture,n.TEXTURE0+k)}function V(I,k){const Q=i.get(I);if(I.isRenderTargetTexture===!1&&I.version>0&&Q.__version!==I.version){le(Q,I,k);return}t.bindTexture(n.TEXTURE_3D,Q.__webglTexture,n.TEXTURE0+k)}function se(I,k){const Q=i.get(I);if(I.isCubeDepthTexture!==!0&&I.version>0&&Q.__version!==I.version){Se(Q,I,k);return}t.bindTexture(n.TEXTURE_CUBE_MAP,Q.__webglTexture,n.TEXTURE0+k)}const ue={[ab]:n.REPEAT,[Sa]:n.CLAMP_TO_EDGE,[ob]:n.MIRRORED_REPEAT},Ce={[Ri]:n.NEAREST,[y$]:n.NEAREST_MIPMAP_NEAREST,[Hf]:n.NEAREST_MIPMAP_LINEAR,[zi]:n.LINEAR,[wx]:n.LINEAR_MIPMAP_NEAREST,[ol]:n.LINEAR_MIPMAP_LINEAR},D={[E$]:n.NEVER,[A$]:n.ALWAYS,[C$]:n.LESS,[ly]:n.LEQUAL,[N$]:n.EQUAL,[cy]:n.GEQUAL,[T$]:n.GREATER,[M$]:n.NOTEQUAL};function H(I,k){if(k.type===kr&&e.has("OES_texture_float_linear")===!1&&(k.magFilter===zi||k.magFilter===wx||k.magFilter===Hf||k.magFilter===ol||k.minFilter===zi||k.minFilter===wx||k.minFilter===Hf||k.minFilter===ol)&&Bt("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(I,n.TEXTURE_WRAP_S,ue[k.wrapS]),n.texParameteri(I,n.TEXTURE_WRAP_T,ue[k.wrapT]),(I===n.TEXTURE_3D||I===n.TEXTURE_2D_ARRAY)&&n.texParameteri(I,n.TEXTURE_WRAP_R,ue[k.wrapR]),n.texParameteri(I,n.TEXTURE_MAG_FILTER,Ce[k.magFilter]),n.texParameteri(I,n.TEXTURE_MIN_FILTER,Ce[k.minFilter]),k.compareFunction&&(n.texParameteri(I,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(I,n.TEXTURE_COMPARE_FUNC,D[k.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(k.magFilter===Ri||k.minFilter!==Hf&&k.minFilter!==ol||k.type===kr&&e.has("OES_texture_float_linear")===!1)return;if(k.anisotropy>1||i.get(k).__currentAnisotropy){const Q=e.get("EXT_texture_filter_anisotropic");n.texParameterf(I,Q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(k.anisotropy,r.getMaxAnisotropy())),i.get(k).__currentAnisotropy=k.anisotropy}}}function Z(I,k){let Q=!1;I.__webglInit===void 0&&(I.__webglInit=!0,k.addEventListener("dispose",R));const fe=k.source;let be=b.get(fe);be===void 0&&(be={},b.set(fe,be));const xe=J(k);if(xe!==I.__cacheKey){be[xe]===void 0&&(be[xe]={texture:n.createTexture(),usedTimes:0},u.memory.textures++,Q=!0),be[xe].usedTimes++;const Xe=be[I.__cacheKey];Xe!==void 0&&(be[I.__cacheKey].usedTimes--,Xe.usedTimes===0&&P(k)),I.__cacheKey=xe,I.__webglTexture=be[xe].texture}return Q}function Ee(I,k,Q){return Math.floor(Math.floor(I/Q)/k)}function je(I,k,Q,fe){const xe=I.updateRanges;if(xe.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,k.width,k.height,Q,fe,k.data);else{xe.sort((X,oe)=>X.start-oe.start);let Xe=0;for(let X=1;X<xe.length;X++){const oe=xe[Xe],ke=xe[X],Ae=oe.start+oe.count,De=Ee(ke.start,k.width,4),st=Ee(oe.start,k.width,4);ke.start<=Ae+1&&De===st&&Ee(ke.start+ke.count-1,k.width,4)===De?oe.count=Math.max(oe.count,ke.start+ke.count-oe.start):(++Xe,xe[Xe]=ke)}xe.length=Xe+1;const $e=n.getParameter(n.UNPACK_ROW_LENGTH),it=n.getParameter(n.UNPACK_SKIP_PIXELS),ht=n.getParameter(n.UNPACK_SKIP_ROWS);n.pixelStorei(n.UNPACK_ROW_LENGTH,k.width);for(let X=0,oe=xe.length;X<oe;X++){const ke=xe[X],Ae=Math.floor(ke.start/4),De=Math.ceil(ke.count/4),st=Ae%k.width,te=Math.floor(Ae/k.width),Ie=De,Pe=1;n.pixelStorei(n.UNPACK_SKIP_PIXELS,st),n.pixelStorei(n.UNPACK_SKIP_ROWS,te),t.texSubImage2D(n.TEXTURE_2D,0,st,te,Ie,Pe,Q,fe,k.data)}I.clearUpdateRanges(),n.pixelStorei(n.UNPACK_ROW_LENGTH,$e),n.pixelStorei(n.UNPACK_SKIP_PIXELS,it),n.pixelStorei(n.UNPACK_SKIP_ROWS,ht)}}function le(I,k,Q){let fe=n.TEXTURE_2D;(k.isDataArrayTexture||k.isCompressedArrayTexture)&&(fe=n.TEXTURE_2D_ARRAY),k.isData3DTexture&&(fe=n.TEXTURE_3D);const be=Z(I,k),xe=k.source;t.bindTexture(fe,I.__webglTexture,n.TEXTURE0+Q);const Xe=i.get(xe);if(xe.version!==Xe.__version||be===!0){t.activeTexture(n.TEXTURE0+Q);const $e=cn.getPrimaries(cn.workingColorSpace),it=k.colorSpace===go?null:cn.getPrimaries(k.colorSpace),ht=k.colorSpace===go||$e===it?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,k.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,k.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,ht);let X=C(k.image,!1,r.maxTextureSize);X=Mt(k,X);const oe=l.convert(k.format,k.colorSpace),ke=l.convert(k.type);let Ae=N(k.internalFormat,oe,ke,k.colorSpace,k.isVideoTexture);H(fe,k);let De;const st=k.mipmaps,te=k.isVideoTexture!==!0,Ie=Xe.__version===void 0||be===!0,Pe=xe.dataReady,Ze=O(k,X);if(k.isDepthTexture)Ae=j(k.format===ll,k.type),Ie&&(te?t.texStorage2D(n.TEXTURE_2D,1,Ae,X.width,X.height):t.texImage2D(n.TEXTURE_2D,0,Ae,X.width,X.height,0,oe,ke,null));else if(k.isDataTexture)if(st.length>0){te&&Ie&&t.texStorage2D(n.TEXTURE_2D,Ze,Ae,st[0].width,st[0].height);for(let ze=0,ge=st.length;ze<ge;ze++)De=st[ze],te?Pe&&t.texSubImage2D(n.TEXTURE_2D,ze,0,0,De.width,De.height,oe,ke,De.data):t.texImage2D(n.TEXTURE_2D,ze,Ae,De.width,De.height,0,oe,ke,De.data);k.generateMipmaps=!1}else te?(Ie&&t.texStorage2D(n.TEXTURE_2D,Ze,Ae,X.width,X.height),Pe&&je(k,X,oe,ke)):t.texImage2D(n.TEXTURE_2D,0,Ae,X.width,X.height,0,oe,ke,X.data);else if(k.isCompressedTexture)if(k.isCompressedArrayTexture){te&&Ie&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ze,Ae,st[0].width,st[0].height,X.depth);for(let ze=0,ge=st.length;ze<ge;ze++)if(De=st[ze],k.format!==hr)if(oe!==null)if(te){if(Pe)if(k.layerUpdates.size>0){const Ye=_E(De.width,De.height,k.format,k.type);for(const pt of k.layerUpdates){const Wt=De.data.subarray(pt*Ye/De.data.BYTES_PER_ELEMENT,(pt+1)*Ye/De.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,ze,0,0,pt,De.width,De.height,1,oe,Wt)}k.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,ze,0,0,0,De.width,De.height,X.depth,oe,De.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,ze,Ae,De.width,De.height,X.depth,0,De.data,0,0);else Bt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else te?Pe&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,ze,0,0,0,De.width,De.height,X.depth,oe,ke,De.data):t.texImage3D(n.TEXTURE_2D_ARRAY,ze,Ae,De.width,De.height,X.depth,0,oe,ke,De.data)}else{te&&Ie&&t.texStorage2D(n.TEXTURE_2D,Ze,Ae,st[0].width,st[0].height);for(let ze=0,ge=st.length;ze<ge;ze++)De=st[ze],k.format!==hr?oe!==null?te?Pe&&t.compressedTexSubImage2D(n.TEXTURE_2D,ze,0,0,De.width,De.height,oe,De.data):t.compressedTexImage2D(n.TEXTURE_2D,ze,Ae,De.width,De.height,0,De.data):Bt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):te?Pe&&t.texSubImage2D(n.TEXTURE_2D,ze,0,0,De.width,De.height,oe,ke,De.data):t.texImage2D(n.TEXTURE_2D,ze,Ae,De.width,De.height,0,oe,ke,De.data)}else if(k.isDataArrayTexture)if(te){if(Ie&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ze,Ae,X.width,X.height,X.depth),Pe)if(k.layerUpdates.size>0){const ze=_E(X.width,X.height,k.format,k.type);for(const ge of k.layerUpdates){const Ye=X.data.subarray(ge*ze/X.data.BYTES_PER_ELEMENT,(ge+1)*ze/X.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,ge,X.width,X.height,1,oe,ke,Ye)}k.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,X.width,X.height,X.depth,oe,ke,X.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Ae,X.width,X.height,X.depth,0,oe,ke,X.data);else if(k.isData3DTexture)te?(Ie&&t.texStorage3D(n.TEXTURE_3D,Ze,Ae,X.width,X.height,X.depth),Pe&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,X.width,X.height,X.depth,oe,ke,X.data)):t.texImage3D(n.TEXTURE_3D,0,Ae,X.width,X.height,X.depth,0,oe,ke,X.data);else if(k.isFramebufferTexture){if(Ie)if(te)t.texStorage2D(n.TEXTURE_2D,Ze,Ae,X.width,X.height);else{let ze=X.width,ge=X.height;for(let Ye=0;Ye<Ze;Ye++)t.texImage2D(n.TEXTURE_2D,Ye,Ae,ze,ge,0,oe,ke,null),ze>>=1,ge>>=1}}else if(st.length>0){if(te&&Ie){const ze=nt(st[0]);t.texStorage2D(n.TEXTURE_2D,Ze,Ae,ze.width,ze.height)}for(let ze=0,ge=st.length;ze<ge;ze++)De=st[ze],te?Pe&&t.texSubImage2D(n.TEXTURE_2D,ze,0,0,oe,ke,De):t.texImage2D(n.TEXTURE_2D,ze,Ae,oe,ke,De);k.generateMipmaps=!1}else if(te){if(Ie){const ze=nt(X);t.texStorage2D(n.TEXTURE_2D,Ze,Ae,ze.width,ze.height)}Pe&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,oe,ke,X)}else t.texImage2D(n.TEXTURE_2D,0,Ae,oe,ke,X);w(k)&&S(fe),Xe.__version=xe.version,k.onUpdate&&k.onUpdate(k)}I.__version=k.version}function Se(I,k,Q){if(k.image.length!==6)return;const fe=Z(I,k),be=k.source;t.bindTexture(n.TEXTURE_CUBE_MAP,I.__webglTexture,n.TEXTURE0+Q);const xe=i.get(be);if(be.version!==xe.__version||fe===!0){t.activeTexture(n.TEXTURE0+Q);const Xe=cn.getPrimaries(cn.workingColorSpace),$e=k.colorSpace===go?null:cn.getPrimaries(k.colorSpace),it=k.colorSpace===go||Xe===$e?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,k.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,k.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,it);const ht=k.isCompressedTexture||k.image[0].isCompressedTexture,X=k.image[0]&&k.image[0].isDataTexture,oe=[];for(let ge=0;ge<6;ge++)!ht&&!X?oe[ge]=C(k.image[ge],!0,r.maxCubemapSize):oe[ge]=X?k.image[ge].image:k.image[ge],oe[ge]=Mt(k,oe[ge]);const ke=oe[0],Ae=l.convert(k.format,k.colorSpace),De=l.convert(k.type),st=N(k.internalFormat,Ae,De,k.colorSpace),te=k.isVideoTexture!==!0,Ie=xe.__version===void 0||fe===!0,Pe=be.dataReady;let Ze=O(k,ke);H(n.TEXTURE_CUBE_MAP,k);let ze;if(ht){te&&Ie&&t.texStorage2D(n.TEXTURE_CUBE_MAP,Ze,st,ke.width,ke.height);for(let ge=0;ge<6;ge++){ze=oe[ge].mipmaps;for(let Ye=0;Ye<ze.length;Ye++){const pt=ze[Ye];k.format!==hr?Ae!==null?te?Pe&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ge,Ye,0,0,pt.width,pt.height,Ae,pt.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ge,Ye,st,pt.width,pt.height,0,pt.data):Bt("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):te?Pe&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ge,Ye,0,0,pt.width,pt.height,Ae,De,pt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ge,Ye,st,pt.width,pt.height,0,Ae,De,pt.data)}}}else{if(ze=k.mipmaps,te&&Ie){ze.length>0&&Ze++;const ge=nt(oe[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Ze,st,ge.width,ge.height)}for(let ge=0;ge<6;ge++)if(X){te?Pe&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,0,0,oe[ge].width,oe[ge].height,Ae,De,oe[ge].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,st,oe[ge].width,oe[ge].height,0,Ae,De,oe[ge].data);for(let Ye=0;Ye<ze.length;Ye++){const Wt=ze[Ye].image[ge].image;te?Pe&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ge,Ye+1,0,0,Wt.width,Wt.height,Ae,De,Wt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ge,Ye+1,st,Wt.width,Wt.height,0,Ae,De,Wt.data)}}else{te?Pe&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,0,0,Ae,De,oe[ge]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,st,Ae,De,oe[ge]);for(let Ye=0;Ye<ze.length;Ye++){const pt=ze[Ye];te?Pe&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ge,Ye+1,0,0,Ae,De,pt.image[ge]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ge,Ye+1,st,Ae,De,pt.image[ge])}}}w(k)&&S(n.TEXTURE_CUBE_MAP),xe.__version=be.version,k.onUpdate&&k.onUpdate(k)}I.__version=k.version}function de(I,k,Q,fe,be,xe){const Xe=l.convert(Q.format,Q.colorSpace),$e=l.convert(Q.type),it=N(Q.internalFormat,Xe,$e,Q.colorSpace),ht=i.get(k),X=i.get(Q);if(X.__renderTarget=k,!ht.__hasExternalTextures){const oe=Math.max(1,k.width>>xe),ke=Math.max(1,k.height>>xe);be===n.TEXTURE_3D||be===n.TEXTURE_2D_ARRAY?t.texImage3D(be,xe,it,oe,ke,k.depth,0,Xe,$e,null):t.texImage2D(be,xe,it,oe,ke,0,Xe,$e,null)}t.bindFramebuffer(n.FRAMEBUFFER,I),Nt(k)?h.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,fe,be,X.__webglTexture,0,K(k)):(be===n.TEXTURE_2D||be>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&be<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,fe,be,X.__webglTexture,xe),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Me(I,k,Q){if(n.bindRenderbuffer(n.RENDERBUFFER,I),k.depthBuffer){const fe=k.depthTexture,be=fe&&fe.isDepthTexture?fe.type:null,xe=j(k.stencilBuffer,be),Xe=k.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;Nt(k)?h.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,K(k),xe,k.width,k.height):Q?n.renderbufferStorageMultisample(n.RENDERBUFFER,K(k),xe,k.width,k.height):n.renderbufferStorage(n.RENDERBUFFER,xe,k.width,k.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Xe,n.RENDERBUFFER,I)}else{const fe=k.textures;for(let be=0;be<fe.length;be++){const xe=fe[be],Xe=l.convert(xe.format,xe.colorSpace),$e=l.convert(xe.type),it=N(xe.internalFormat,Xe,$e,xe.colorSpace);Nt(k)?h.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,K(k),it,k.width,k.height):Q?n.renderbufferStorageMultisample(n.RENDERBUFFER,K(k),it,k.width,k.height):n.renderbufferStorage(n.RENDERBUFFER,it,k.width,k.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Le(I,k,Q){const fe=k.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(n.FRAMEBUFFER,I),!(k.depthTexture&&k.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const be=i.get(k.depthTexture);if(be.__renderTarget=k,(!be.__webglTexture||k.depthTexture.image.width!==k.width||k.depthTexture.image.height!==k.height)&&(k.depthTexture.image.width=k.width,k.depthTexture.image.height=k.height,k.depthTexture.needsUpdate=!0),fe){if(be.__webglInit===void 0&&(be.__webglInit=!0,k.depthTexture.addEventListener("dispose",R)),be.__webglTexture===void 0){be.__webglTexture=n.createTexture(),t.bindTexture(n.TEXTURE_CUBE_MAP,be.__webglTexture),H(n.TEXTURE_CUBE_MAP,k.depthTexture);const ht=l.convert(k.depthTexture.format),X=l.convert(k.depthTexture.type);let oe;k.depthTexture.format===ka?oe=n.DEPTH_COMPONENT24:k.depthTexture.format===ll&&(oe=n.DEPTH24_STENCIL8);for(let ke=0;ke<6;ke++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ke,0,oe,k.width,k.height,0,ht,X,null)}}else F(k.depthTexture,0);const xe=be.__webglTexture,Xe=K(k),$e=fe?n.TEXTURE_CUBE_MAP_POSITIVE_X+Q:n.TEXTURE_2D,it=k.depthTexture.format===ll?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;if(k.depthTexture.format===ka)Nt(k)?h.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,it,$e,xe,0,Xe):n.framebufferTexture2D(n.FRAMEBUFFER,it,$e,xe,0);else if(k.depthTexture.format===ll)Nt(k)?h.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,it,$e,xe,0,Xe):n.framebufferTexture2D(n.FRAMEBUFFER,it,$e,xe,0);else throw new Error("Unknown depthTexture format")}function pe(I){const k=i.get(I),Q=I.isWebGLCubeRenderTarget===!0;if(k.__boundDepthTexture!==I.depthTexture){const fe=I.depthTexture;if(k.__depthDisposeCallback&&k.__depthDisposeCallback(),fe){const be=()=>{delete k.__boundDepthTexture,delete k.__depthDisposeCallback,fe.removeEventListener("dispose",be)};fe.addEventListener("dispose",be),k.__depthDisposeCallback=be}k.__boundDepthTexture=fe}if(I.depthTexture&&!k.__autoAllocateDepthBuffer)if(Q)for(let fe=0;fe<6;fe++)Le(k.__webglFramebuffer[fe],I,fe);else{const fe=I.texture.mipmaps;fe&&fe.length>0?Le(k.__webglFramebuffer[0],I,0):Le(k.__webglFramebuffer,I,0)}else if(Q){k.__webglDepthbuffer=[];for(let fe=0;fe<6;fe++)if(t.bindFramebuffer(n.FRAMEBUFFER,k.__webglFramebuffer[fe]),k.__webglDepthbuffer[fe]===void 0)k.__webglDepthbuffer[fe]=n.createRenderbuffer(),Me(k.__webglDepthbuffer[fe],I,!1);else{const be=I.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,xe=k.__webglDepthbuffer[fe];n.bindRenderbuffer(n.RENDERBUFFER,xe),n.framebufferRenderbuffer(n.FRAMEBUFFER,be,n.RENDERBUFFER,xe)}}else{const fe=I.texture.mipmaps;if(fe&&fe.length>0?t.bindFramebuffer(n.FRAMEBUFFER,k.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,k.__webglFramebuffer),k.__webglDepthbuffer===void 0)k.__webglDepthbuffer=n.createRenderbuffer(),Me(k.__webglDepthbuffer,I,!1);else{const be=I.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,xe=k.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,xe),n.framebufferRenderbuffer(n.FRAMEBUFFER,be,n.RENDERBUFFER,xe)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function Be(I,k,Q){const fe=i.get(I);k!==void 0&&de(fe.__webglFramebuffer,I,I.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),Q!==void 0&&pe(I)}function We(I){const k=I.texture,Q=i.get(I),fe=i.get(k);I.addEventListener("dispose",z);const be=I.textures,xe=I.isWebGLCubeRenderTarget===!0,Xe=be.length>1;if(Xe||(fe.__webglTexture===void 0&&(fe.__webglTexture=n.createTexture()),fe.__version=k.version,u.memory.textures++),xe){Q.__webglFramebuffer=[];for(let $e=0;$e<6;$e++)if(k.mipmaps&&k.mipmaps.length>0){Q.__webglFramebuffer[$e]=[];for(let it=0;it<k.mipmaps.length;it++)Q.__webglFramebuffer[$e][it]=n.createFramebuffer()}else Q.__webglFramebuffer[$e]=n.createFramebuffer()}else{if(k.mipmaps&&k.mipmaps.length>0){Q.__webglFramebuffer=[];for(let $e=0;$e<k.mipmaps.length;$e++)Q.__webglFramebuffer[$e]=n.createFramebuffer()}else Q.__webglFramebuffer=n.createFramebuffer();if(Xe)for(let $e=0,it=be.length;$e<it;$e++){const ht=i.get(be[$e]);ht.__webglTexture===void 0&&(ht.__webglTexture=n.createTexture(),u.memory.textures++)}if(I.samples>0&&Nt(I)===!1){Q.__webglMultisampledFramebuffer=n.createFramebuffer(),Q.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,Q.__webglMultisampledFramebuffer);for(let $e=0;$e<be.length;$e++){const it=be[$e];Q.__webglColorRenderbuffer[$e]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,Q.__webglColorRenderbuffer[$e]);const ht=l.convert(it.format,it.colorSpace),X=l.convert(it.type),oe=N(it.internalFormat,ht,X,it.colorSpace,I.isXRRenderTarget===!0),ke=K(I);n.renderbufferStorageMultisample(n.RENDERBUFFER,ke,oe,I.width,I.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+$e,n.RENDERBUFFER,Q.__webglColorRenderbuffer[$e])}n.bindRenderbuffer(n.RENDERBUFFER,null),I.depthBuffer&&(Q.__webglDepthRenderbuffer=n.createRenderbuffer(),Me(Q.__webglDepthRenderbuffer,I,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(xe){t.bindTexture(n.TEXTURE_CUBE_MAP,fe.__webglTexture),H(n.TEXTURE_CUBE_MAP,k);for(let $e=0;$e<6;$e++)if(k.mipmaps&&k.mipmaps.length>0)for(let it=0;it<k.mipmaps.length;it++)de(Q.__webglFramebuffer[$e][it],I,k,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+$e,it);else de(Q.__webglFramebuffer[$e],I,k,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+$e,0);w(k)&&S(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Xe){for(let $e=0,it=be.length;$e<it;$e++){const ht=be[$e],X=i.get(ht);let oe=n.TEXTURE_2D;(I.isWebGL3DRenderTarget||I.isWebGLArrayRenderTarget)&&(oe=I.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(oe,X.__webglTexture),H(oe,ht),de(Q.__webglFramebuffer,I,ht,n.COLOR_ATTACHMENT0+$e,oe,0),w(ht)&&S(oe)}t.unbindTexture()}else{let $e=n.TEXTURE_2D;if((I.isWebGL3DRenderTarget||I.isWebGLArrayRenderTarget)&&($e=I.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture($e,fe.__webglTexture),H($e,k),k.mipmaps&&k.mipmaps.length>0)for(let it=0;it<k.mipmaps.length;it++)de(Q.__webglFramebuffer[it],I,k,n.COLOR_ATTACHMENT0,$e,it);else de(Q.__webglFramebuffer,I,k,n.COLOR_ATTACHMENT0,$e,0);w(k)&&S($e),t.unbindTexture()}I.depthBuffer&&pe(I)}function dt(I){const k=I.textures;for(let Q=0,fe=k.length;Q<fe;Q++){const be=k[Q];if(w(be)){const xe=T(I),Xe=i.get(be).__webglTexture;t.bindTexture(xe,Xe),S(xe),t.unbindTexture()}}}const Ct=[],ut=[];function kt(I){if(I.samples>0){if(Nt(I)===!1){const k=I.textures,Q=I.width,fe=I.height;let be=n.COLOR_BUFFER_BIT;const xe=I.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Xe=i.get(I),$e=k.length>1;if($e)for(let ht=0;ht<k.length;ht++)t.bindFramebuffer(n.FRAMEBUFFER,Xe.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+ht,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Xe.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+ht,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Xe.__webglMultisampledFramebuffer);const it=I.texture.mipmaps;it&&it.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Xe.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Xe.__webglFramebuffer);for(let ht=0;ht<k.length;ht++){if(I.resolveDepthBuffer&&(I.depthBuffer&&(be|=n.DEPTH_BUFFER_BIT),I.stencilBuffer&&I.resolveStencilBuffer&&(be|=n.STENCIL_BUFFER_BIT)),$e){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Xe.__webglColorRenderbuffer[ht]);const X=i.get(k[ht]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,X,0)}n.blitFramebuffer(0,0,Q,fe,0,0,Q,fe,be,n.NEAREST),d===!0&&(Ct.length=0,ut.length=0,Ct.push(n.COLOR_ATTACHMENT0+ht),I.depthBuffer&&I.resolveDepthBuffer===!1&&(Ct.push(xe),ut.push(xe),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,ut)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Ct))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),$e)for(let ht=0;ht<k.length;ht++){t.bindFramebuffer(n.FRAMEBUFFER,Xe.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+ht,n.RENDERBUFFER,Xe.__webglColorRenderbuffer[ht]);const X=i.get(k[ht]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Xe.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+ht,n.TEXTURE_2D,X,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Xe.__webglMultisampledFramebuffer)}else if(I.depthBuffer&&I.resolveDepthBuffer===!1&&d){const k=I.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[k])}}}function K(I){return Math.min(r.maxSamples,I.samples)}function Nt(I){const k=i.get(I);return I.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&k.__useRenderToTexture!==!1}function Tt(I){const k=u.render.frame;m.get(I)!==k&&(m.set(I,k),I.update())}function Mt(I,k){const Q=I.colorSpace,fe=I.format,be=I.type;return I.isCompressedTexture===!0||I.isVideoTexture===!0||Q!==Bc&&Q!==go&&(cn.getTransfer(Q)===yn?(fe!==hr||be!==Ws)&&Bt("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):hn("WebGLTextures: Unsupported texture color space:",Q)),k}function nt(I){return typeof HTMLImageElement<"u"&&I instanceof HTMLImageElement?(p.width=I.naturalWidth||I.width,p.height=I.naturalHeight||I.height):typeof VideoFrame<"u"&&I instanceof VideoFrame?(p.width=I.displayWidth,p.height=I.displayHeight):(p.width=I.width,p.height=I.height),p}this.allocateTextureUnit=W,this.resetTextureUnits=Y,this.setTexture2D=F,this.setTexture2DArray=$,this.setTexture3D=V,this.setTextureCube=se,this.rebindTextures=Be,this.setupRenderTarget=We,this.updateRenderTargetMipmap=dt,this.updateMultisampleRenderTarget=kt,this.setupDepthRenderbuffer=pe,this.setupFrameBufferTexture=de,this.useMultisampledRTT=Nt,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function ZG(n,e){function t(i,r=go){let l;const u=cn.getTransfer(r);if(i===Ws)return n.UNSIGNED_BYTE;if(i===iy)return n.UNSIGNED_SHORT_4_4_4_4;if(i===sy)return n.UNSIGNED_SHORT_5_5_5_1;if(i===uC)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===dC)return n.UNSIGNED_INT_10F_11F_11F_REV;if(i===lC)return n.BYTE;if(i===cC)return n.SHORT;if(i===qd)return n.UNSIGNED_SHORT;if(i===ny)return n.INT;if(i===Hr)return n.UNSIGNED_INT;if(i===kr)return n.FLOAT;if(i===Ra)return n.HALF_FLOAT;if(i===hC)return n.ALPHA;if(i===fC)return n.RGB;if(i===hr)return n.RGBA;if(i===ka)return n.DEPTH_COMPONENT;if(i===ll)return n.DEPTH_STENCIL;if(i===pC)return n.RED;if(i===ry)return n.RED_INTEGER;if(i===Fc)return n.RG;if(i===ay)return n.RG_INTEGER;if(i===oy)return n.RGBA_INTEGER;if(i===Sp||i===Ep||i===Cp||i===Np)if(u===yn)if(l=e.get("WEBGL_compressed_texture_s3tc_srgb"),l!==null){if(i===Sp)return l.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Ep)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Cp)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Np)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(l=e.get("WEBGL_compressed_texture_s3tc"),l!==null){if(i===Sp)return l.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Ep)return l.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Cp)return l.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Np)return l.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===lb||i===cb||i===ub||i===db)if(l=e.get("WEBGL_compressed_texture_pvrtc"),l!==null){if(i===lb)return l.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===cb)return l.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===ub)return l.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===db)return l.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===hb||i===fb||i===pb||i===mb||i===gb||i===xb||i===bb)if(l=e.get("WEBGL_compressed_texture_etc"),l!==null){if(i===hb||i===fb)return u===yn?l.COMPRESSED_SRGB8_ETC2:l.COMPRESSED_RGB8_ETC2;if(i===pb)return u===yn?l.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:l.COMPRESSED_RGBA8_ETC2_EAC;if(i===mb)return l.COMPRESSED_R11_EAC;if(i===gb)return l.COMPRESSED_SIGNED_R11_EAC;if(i===xb)return l.COMPRESSED_RG11_EAC;if(i===bb)return l.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===vb||i===yb||i===_b||i===wb||i===Sb||i===Eb||i===Cb||i===Nb||i===Tb||i===Mb||i===Ab||i===Rb||i===kb||i===jb)if(l=e.get("WEBGL_compressed_texture_astc"),l!==null){if(i===vb)return u===yn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:l.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===yb)return u===yn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:l.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===_b)return u===yn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:l.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===wb)return u===yn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:l.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Sb)return u===yn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:l.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Eb)return u===yn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:l.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Cb)return u===yn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:l.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Nb)return u===yn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:l.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Tb)return u===yn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:l.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Mb)return u===yn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:l.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Ab)return u===yn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:l.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Rb)return u===yn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:l.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===kb)return u===yn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:l.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===jb)return u===yn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:l.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Lb||i===Pb||i===Ob)if(l=e.get("EXT_texture_compression_bptc"),l!==null){if(i===Lb)return u===yn?l.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:l.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Pb)return l.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Ob)return l.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Db||i===Ub||i===Ib||i===zb)if(l=e.get("EXT_texture_compression_rgtc"),l!==null){if(i===Db)return l.COMPRESSED_RED_RGTC1_EXT;if(i===Ub)return l.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Ib)return l.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===zb)return l.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Wd?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}const QG=` 4104void main() { 4105 4106 gl_Position = vec4( position, 1.0 ); 4107 4108}`,JG=` 4109uniform sampler2DArray depthColor; 4110uniform float depthWidth; 4111uniform float depthHeight; 4112 4113void main() { 4114 4115 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 4116 4117 if ( coord.x >= 1.0 ) { 4118 4119 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 4120 4121 } else { 4122 4123 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 4124 4125 } 4126 4127}`;class eq{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const i=new EC(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new Gr({vertexShader:QG,fragmentShader:JG,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Vr(new Rm(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class tq extends su{constructor(e,t){super();const i=this;let r=null,l=1,u=null,h="local-floor",d=1,p=null,m=null,g=null,b=null,y=null,_=null;const C=typeof XRWebGLBinding<"u",w=new eq,S={},T=t.getContextAttributes();let N=null,j=null;const O=[],R=[],z=new Cn;let M=null;const P=new cr;P.viewport=new Kn;const G=new cr;G.viewport=new Kn;const U=[P,G],Y=new fF;let W=null,J=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let Se=O[le];return Se===void 0&&(Se=new Rx,O[le]=Se),Se.getTargetRaySpace()},this.getControllerGrip=function(le){let Se=O[le];return Se===void 0&&(Se=new Rx,O[le]=Se),Se.getGripSpace()},this.getHand=function(le){let Se=O[le];return Se===void 0&&(Se=new Rx,O[le]=Se),Se.getHandSpace()};function F(le){const Se=R.indexOf(le.inputSource);if(Se===-1)return;const de=O[Se];de!==void 0&&(de.update(le.inputSource,le.frame,p||u),de.dispatchEvent({type:le.type,data:le.inputSource}))}function $(){r.removeEventListener("select",F),r.removeEventListener("selectstart",F),r.removeEventListener("selectend",F),r.removeEventListener("squeeze",F),r.removeEventListener("squeezestart",F),r.removeEventListener("squeezeend",F),r.removeEventListener("end",$),r.removeEventListener("inputsourceschange",V);for(let le=0;le<O.length;le++){const Se=R[le];Se!==null&&(R[le]=null,O[le].disconnect(Se))}W=null,J=null,w.reset();for(const le in S)delete S[le];e.setRenderTarget(N),y=null,b=null,g=null,r=null,j=null,je.stop(),i.isPresenting=!1,e.setPixelRatio(M),e.setSize(z.width,z.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(le){l=le,i.isPresenting===!0&&Bt("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(le){h=le,i.isPresenting===!0&&Bt("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return p||u},this.setReferenceSpace=function(le){p=le},this.getBaseLayer=function(){return b!==null?b:y},this.getBinding=function(){return g===null&&C&&(g=new XRWebGLBinding(r,t)),g},this.getFrame=function(){return _},this.getSession=function(){return r},this.setSession=async function(le){if(r=le,r!==null){if(N=e.getRenderTarget(),r.addEventListener("select",F),r.addEventListener("selectstart",F),r.addEventListener("selectend",F),r.addEventListener("squeeze",F),r.addEventListener("squeezestart",F),r.addEventListener("squeezeend",F),r.addEventListener("end",$),r.addEventListener("inputsourceschange",V),T.xrCompatible!==!0&&await t.makeXRCompatible(),M=e.getPixelRatio(),e.getSize(z),C&&"createProjectionLayer"in XRWebGLBinding.prototype){let de=null,Me=null,Le=null;T.depth&&(Le=T.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,de=T.stencil?ll:ka,Me=T.stencil?Wd:Hr);const pe={colorFormat:t.RGBA8,depthFormat:Le,scaleFactor:l};g=this.getBinding(),b=g.createProjectionLayer(pe),r.updateRenderState({layers:[b]}),e.setPixelRatio(1),e.setSize(b.textureWidth,b.textureHeight,!1),j=new Ur(b.textureWidth,b.textureHeight,{format:hr,type:Ws,depthTexture:new Xd(b.textureWidth,b.textureHeight,Me,void 0,void 0,void 0,void 0,void 0,void 0,de),stencilBuffer:T.stencil,colorSpace:e.outputColorSpace,samples:T.antialias?4:0,resolveDepthBuffer:b.ignoreDepthValues===!1,resolveStencilBuffer:b.ignoreDepthValues===!1})}else{const de={antialias:T.antialias,alpha:!0,depth:T.depth,stencil:T.stencil,framebufferScaleFactor:l};y=new XRWebGLLayer(r,t,de),r.updateRenderState({baseLayer:y}),e.setPixelRatio(1),e.setSize(y.framebufferWidth,y.framebufferHeight,!1),j=new Ur(y.framebufferWidth,y.framebufferHeight,{format:hr,type:Ws,colorSpace:e.outputColorSpace,stencilBuffer:T.stencil,resolveDepthBuffer:y.ignoreDepthValues===!1,resolveStencilBuffer:y.ignoreDepthValues===!1})}j.isXRRenderTarget=!0,this.setFoveation(d),p=null,u=await r.requestReferenceSpace(h),je.setContext(r),je.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return w.getDepthTexture()};function V(le){for(let Se=0;Se<le.removed.length;Se++){const de=le.removed[Se],Me=R.indexOf(de);Me>=0&&(R[Me]=null,O[Me].disconnect(de))}for(let Se=0;Se<le.added.length;Se++){const de=le.added[Se];let Me=R.indexOf(de);if(Me===-1){for(let pe=0;pe<O.length;pe++)if(pe>=R.length){R.push(de),Me=pe;break}else if(R[pe]===null){R[pe]=de,Me=pe;break}if(Me===-1)break}const Le=O[Me];Le&&Le.connect(de)}}const se=new Ne,ue=new Ne;function Ce(le,Se,de){se.setFromMatrixPosition(Se.matrixWorld),ue.setFromMatrixPosition(de.matrixWorld);const Me=se.distanceTo(ue),Le=Se.projectionMatrix.elements,pe=de.projectionMatrix.elements,Be=Le[14]/(Le[10]-1),We=Le[14]/(Le[10]+1),dt=(Le[9]+1)/Le[5],Ct=(Le[9]-1)/Le[5],ut=(Le[8]-1)/Le[0],kt=(pe[8]+1)/pe[0],K=Be*ut,Nt=Be*kt,Tt=Me/(-ut+kt),Mt=Tt*-ut;if(Se.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(Mt),le.translateZ(Tt),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),Le[10]===-1)le.projectionMatrix.copy(Se.projectionMatrix),le.projectionMatrixInverse.copy(Se.projectionMatrixInverse);else{const nt=Be+Tt,I=We+Tt,k=K-Mt,Q=Nt+(Me-Mt),fe=dt*We/I*nt,be=Ct*We/I*nt;le.projectionMatrix.makePerspective(k,Q,fe,be,nt,I),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function D(le,Se){Se===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(Se.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(r===null)return;let Se=le.near,de=le.far;w.texture!==null&&(w.depthNear>0&&(Se=w.depthNear),w.depthFar>0&&(de=w.depthFar)),Y.near=G.near=P.near=Se,Y.far=G.far=P.far=de,(W!==Y.near||J!==Y.far)&&(r.updateRenderState({depthNear:Y.near,depthFar:Y.far}),W=Y.near,J=Y.far),Y.layers.mask=le.layers.mask|6,P.layers.mask=Y.layers.mask&-5,G.layers.mask=Y.layers.mask&-3;const Me=le.parent,Le=Y.cameras;D(Y,Me);for(let pe=0;pe<Le.length;pe++)D(Le[pe],Me);Le.length===2?Ce(Y,P,G):Y.projectionMatrix.copy(P.projectionMatrix),H(le,Y,Me)};function H(le,Se,de){de===null?le.matrix.copy(Se.matrixWorld):(le.matrix.copy(de.matrixWorld),le.matrix.invert(),le.matrix.multiply(Se.matrixWorld)),le.matrix.decompose(le.position,le.quaternion,le.scale),le.updateMatrixWorld(!0),le.projectionMatrix.copy(Se.projectionMatrix),le.projectionMatrixInverse.copy(Se.projectionMatrixInverse),le.isPerspectiveCamera&&(le.fov=$b*2*Math.atan(1/le.projectionMatrix.elements[5]),le.zoom=1)}this.getCamera=function(){return Y},this.getFoveation=function(){if(!(b===null&&y===null))return d},this.setFoveation=function(le){d=le,b!==null&&(b.fixedFoveation=le),y!==null&&y.fixedFoveation!==void 0&&(y.fixedFoveation=le)},this.hasDepthSensing=function(){return w.texture!==null},this.getDepthSensingMesh=function(){return w.getMesh(Y)},this.getCameraTexture=function(le){return S[le]};let Z=null;function Ee(le,Se){if(m=Se.getViewerPose(p||u),_=Se,m!==null){const de=m.views;y!==null&&(e.setRenderTargetFramebuffer(j,y.framebuffer),e.setRenderTarget(j));let Me=!1;de.length!==Y.cameras.length&&(Y.cameras.length=0,Me=!0);for(let We=0;We<de.length;We++){const dt=de[We];let Ct=null;if(y!==null)Ct=y.getViewport(dt);else{const kt=g.getViewSubImage(b,dt);Ct=kt.viewport,We===0&&(e.setRenderTargetTextures(j,kt.colorTexture,kt.depthStencilTexture),e.setRenderTarget(j))}let ut=U[We];ut===void 0&&(ut=new cr,ut.layers.enable(We),ut.viewport=new Kn,U[We]=ut),ut.matrix.fromArray(dt.transform.matrix),ut.matrix.decompose(ut.position,ut.quaternion,ut.scale),ut.projectionMatrix.fromArray(dt.projectionMatrix),ut.projectionMatrixInverse.copy(ut.projectionMatrix).invert(),ut.viewport.set(Ct.x,Ct.y,Ct.width,Ct.height),We===0&&(Y.matrix.copy(ut.matrix),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale)),Me===!0&&Y.cameras.push(ut)}const Le=r.enabledFeatures;if(Le&&Le.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&C){g=i.getBinding();const We=g.getDepthInformation(de[0]);We&&We.isValid&&We.texture&&w.init(We,r.renderState)}if(Le&&Le.includes("camera-access")&&C){e.state.unbindTexture(),g=i.getBinding();for(let We=0;We<de.length;We++){const dt=de[We].camera;if(dt){let Ct=S[dt];Ct||(Ct=new EC,S[dt]=Ct);const ut=g.getCameraImage(dt);Ct.sourceTexture=ut}}}}for(let de=0;de<O.length;de++){const Me=R[de],Le=O[de];Me!==null&&Le!==void 0&&Le.update(Me,Se,p||u)}Z&&Z(le,Se),Se.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:Se}),_=null}const je=new MC;je.setAnimationLoop(Ee),this.setAnimationLoop=function(le){Z=le},this.dispose=function(){}}}const Qo=new ja,nq=new hi;function iq(n,e){function t(w,S){w.matrixAutoUpdate===!0&&w.updateMatrix(),S.value.copy(w.matrix)}function i(w,S){S.color.getRGB(w.fogColor.value,CC(n)),S.isFog?(w.fogNear.value=S.near,w.fogFar.value=S.far):S.isFogExp2&&(w.fogDensity.value=S.density)}function r(w,S,T,N,j){S.isMeshBasicMaterial?l(w,S):S.isMeshLambertMaterial?(l(w,S),S.envMap&&(w.envMapIntensity.value=S.envMapIntensity)):S.isMeshToonMaterial?(l(w,S),g(w,S)):S.isMeshPhongMaterial?(l(w,S),m(w,S),S.envMap&&(w.envMapIntensity.value=S.envMapIntensity)):S.isMeshStandardMaterial?(l(w,S),b(w,S),S.isMeshPhysicalMaterial&&y(w,S,j)):S.isMeshMatcapMaterial?(l(w,S),_(w,S)):S.isMeshDepthMaterial?l(w,S):S.isMeshDistanceMaterial?(l(w,S),C(w,S)):S.isMeshNormalMaterial?l(w,S):S.isLineBasicMaterial?(u(w,S),S.isLineDashedMaterial&&h(w,S)):S.isPointsMaterial?d(w,S,T,N):S.isSpriteMaterial?p(w,S):S.isShadowMaterial?(w.color.value.copy(S.color),w.opacity.value=S.opacity):S.isShaderMaterial&&(S.uniformsNeedUpdate=!1)}function l(w,S){w.opacity.value=S.opacity,S.color&&w.diffuse.value.copy(S.color),S.emissive&&w.emissive.value.copy(S.emissive).multiplyScalar(S.emissiveIntensity),S.map&&(w.map.value=S.map,t(S.map,w.mapTransform)),S.alphaMap&&(w.alphaMap.value=S.alphaMap,t(S.alphaMap,w.alphaMapTransform)),S.bumpMap&&(w.bumpMap.value=S.bumpMap,t(S.bumpMap,w.bumpMapTransform),w.bumpScale.value=S.bumpScale,S.side===os&&(w.bumpScale.value*=-1)),S.normalMap&&(w.normalMap.value=S.normalMap,t(S.normalMap,w.normalMapTransform),w.normalScale.value.copy(S.normalScale),S.side===os&&w.normalScale.value.negate()),S.displacementMap&&(w.displacementMap.value=S.displacementMap,t(S.displacementMap,w.displacementMapTransform),w.displacementScale.value=S.displacementScale,w.displacementBias.value=S.displacementBias),S.emissiveMap&&(w.emissiveMap.value=S.emissiveMap,t(S.emissiveMap,w.emissiveMapTransform)),S.specularMap&&(w.specularMap.value=S.specularMap,t(S.specularMap,w.specularMapTransform)),S.alphaTest>0&&(w.alphaTest.value=S.alphaTest);const T=e.get(S),N=T.envMap,j=T.envMapRotation;N&&(w.envMap.value=N,Qo.copy(j),Qo.x*=-1,Qo.y*=-1,Qo.z*=-1,N.isCubeTexture&&N.isRenderTargetTexture===!1&&(Qo.y*=-1,Qo.z*=-1),w.envMapRotation.value.setFromMatrix4(nq.makeRotationFromEuler(Qo)),w.flipEnvMap.value=N.isCubeTexture&&N.isRenderTargetTexture===!1?-1:1,w.reflectivity.value=S.reflectivity,w.ior.value=S.ior,w.refractionRatio.value=S.refractionRatio),S.lightMap&&(w.lightMap.value=S.lightMap,w.lightMapIntensity.value=S.lightMapIntensity,t(S.lightMap,w.lightMapTransform)),S.aoMap&&(w.aoMap.value=S.aoMap,w.aoMapIntensity.value=S.aoMapIntensity,t(S.aoMap,w.aoMapTransform))}function u(w,S){w.diffuse.value.copy(S.color),w.opacity.value=S.opacity,S.map&&(w.map.value=S.map,t(S.map,w.mapTransform))}function h(w,S){w.dashSize.value=S.dashSize,w.totalSize.value=S.dashSize+S.gapSize,w.scale.value=S.scale}function d(w,S,T,N){w.diffuse.value.copy(S.color),w.opacity.value=S.opacity,w.size.value=S.size*T,w.scale.value=N*.5,S.map&&(w.map.value=S.map,t(S.map,w.uvTransform)),S.alphaMap&&(w.alphaMap.value=S.alphaMap,t(S.alphaMap,w.alphaMapTransform)),S.alphaTest>0&&(w.alphaTest.value=S.alphaTest)}function p(w,S){w.diffuse.value.copy(S.color),w.opacity.value=S.opacity,w.rotation.value=S.rotation,S.map&&(w.map.value=S.map,t(S.map,w.mapTransform)),S.alphaMap&&(w.alphaMap.value=S.alphaMap,t(S.alphaMap,w.alphaMapTransform)),S.alphaTest>0&&(w.alphaTest.value=S.alphaTest)}function m(w,S){w.specular.value.copy(S.specular),w.shininess.value=Math.max(S.shininess,1e-4)}function g(w,S){S.gradientMap&&(w.gradientMap.value=S.gradientMap)}function b(w,S){w.metalness.value=S.metalness,S.metalnessMap&&(w.metalnessMap.value=S.metalnessMap,t(S.metalnessMap,w.metalnessMapTransform)),w.roughness.value=S.roughness,S.roughnessMap&&(w.roughnessMap.value=S.roughnessMap,t(S.roughnessMap,w.roughnessMapTransform)),S.envMap&&(w.envMapIntensity.value=S.envMapIntensity)}function y(w,S,T){w.ior.value=S.ior,S.sheen>0&&(w.sheenColor.value.copy(S.sheenColor).multiplyScalar(S.sheen),w.sheenRoughness.value=S.sheenRoughness,S.sheenColorMap&&(w.sheenColorMap.value=S.sheenColorMap,t(S.sheenColorMap,w.sheenColorMapTransform)),S.sheenRoughnessMap&&(w.sheenRoughnessMap.value=S.sheenRoughnessMap,t(S.sheenRoughnessMap,w.sheenRoughnessMapTransform))),S.clearcoat>0&&(w.clearcoat.value=S.clearcoat,w.clearcoatRoughness.value=S.clearcoatRoughness,S.clearcoatMap&&(w.clearcoatMap.value=S.clearcoatMap,t(S.clearcoatMap,w.clearcoatMapTransform)),S.clearcoatRoughnessMap&&(w.clearcoatRoughnessMap.value=S.clearcoatRoughnessMap,t(S.clearcoatRoughnessMap,w.clearcoatRoughnessMapTransform)),S.clearcoatNormalMap&&(w.clearcoatNormalMap.value=S.clearcoatNormalMap,t(S.clearcoatNormalMap,w.clearcoatNormalMapTransform),w.clearcoatNormalScale.value.copy(S.clearcoatNormalScale),S.side===os&&w.clearcoatNormalScale.value.negate())),S.dispersion>0&&(w.dispersion.value=S.dispersion),S.iridescence>0&&(w.iridescence.value=S.iridescence,w.iridescenceIOR.value=S.iridescenceIOR,w.iridescenceThicknessMinimum.value=S.iridescenceThicknessRange[0],w.iridescenceThicknessMaximum.value=S.iridescenceThicknessRange[1],S.iridescenceMap&&(w.iridescenceMap.value=S.iridescenceMap,t(S.iridescenceMap,w.iridescenceMapTransform)),S.iridescenceThicknessMap&&(w.iridescenceThicknessMap.value=S.iridescenceThicknessMap,t(S.iridescenceThicknessMap,w.iridescenceThicknessMapTransform))),S.transmission>0&&(w.transmission.value=S.transmission,w.transmissionSamplerMap.value=T.texture,w.transmissionSamplerSize.value.set(T.width,T.height),S.transmissionMap&&(w.transmissionMap.value=S.transmissionMap,t(S.transmissionMap,w.transmissionMapTransform)),w.thickness.value=S.thickness,S.thicknessMap&&(w.thicknessMap.value=S.thicknessMap,t(S.thicknessMap,w.thicknessMapTransform)),w.attenuationDistance.value=S.attenuationDistance,w.attenuationColor.value.copy(S.attenuationColor)),S.anisotropy>0&&(w.anisotropyVector.value.set(S.anisotropy*Math.cos(S.anisotropyRotation),S.anisotropy*Math.sin(S.anisotropyRotation)),S.anisotropyMap&&(w.anisotropyMap.value=S.anisotropyMap,t(S.anisotropyMap,w.anisotropyMapTransform))),w.specularIntensity.value=S.specularIntensity,w.specularColor.value.copy(S.specularColor),S.specularColorMap&&(w.specularColorMap.value=S.specularColorMap,t(S.specularColorMap,w.specularColorMapTransform)),S.specularIntensityMap&&(w.specularIntensityMap.value=S.specularIntensityMap,t(S.specularIntensityMap,w.specularIntensityMapTransform))}function _(w,S){S.matcap&&(w.matcap.value=S.matcap)}function C(w,S){const T=e.get(S).light;w.referencePosition.value.setFromMatrixPosition(T.matrixWorld),w.nearDistance.value=T.shadow.camera.near,w.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function sq(n,e,t,i){let r={},l={},u=[];const h=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function d(T,N){const j=N.program;i.uniformBlockBinding(T,j)}function p(T,N){let j=r[T.id];j===void 0&&(_(T),j=m(T),r[T.id]=j,T.addEventListener("dispose",w));const O=N.program;i.updateUBOMapping(T,O);const R=e.render.frame;l[T.id]!==R&&(b(T),l[T.id]=R)}function m(T){const N=g();T.__bindingPointIndex=N;const j=n.createBuffer(),O=T.__size,R=T.usage;return n.bindBuffer(n.UNIFORM_BUFFER,j),n.bufferData(n.UNIFORM_BUFFER,O,R),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,N,j),j}function g(){for(let T=0;T<h;T++)if(u.indexOf(T)===-1)return u.push(T),T;return hn("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function b(T){const N=r[T.id],j=T.uniforms,O=T.__cache;n.bindBuffer(n.UNIFORM_BUFFER,N);for(let R=0,z=j.length;R<z;R++){const M=Array.isArray(j[R])?j[R]:[j[R]];for(let P=0,G=M.length;P<G;P++){const U=M[P];if(y(U,R,P,O)===!0){const Y=U.__offset,W=Array.isArray(U.value)?U.value:[U.value];let J=0;for(let F=0;F<W.length;F++){const $=W[F],V=C($);typeof $=="number"||typeof $=="boolean"?(U.__data[0]=$,n.bufferSubData(n.UNIFORM_BUFFER,Y+J,U.__data)):$.isMatrix3?(U.__data[0]=$.elements[0],U.__data[1]=$.elements[1],U.__data[2]=$.elements[2],U.__data[3]=0,U.__data[4]=$.elements[3],U.__data[5]=$.elements[4],U.__data[6]=$.elements[5],U.__data[7]=0,U.__data[8]=$.elements[6],U.__data[9]=$.elements[7],U.__data[10]=$.elements[8],U.__data[11]=0):($.toArray(U.__data,J),J+=V.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,Y,U.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function y(T,N,j,O){const R=T.value,z=N+"_"+j;if(O[z]===void 0)return typeof R=="number"||typeof R=="boolean"?O[z]=R:O[z]=R.clone(),!0;{const M=O[z];if(typeof R=="number"||typeof R=="boolean"){if(M!==R)return O[z]=R,!0}else if(M.equals(R)===!1)return M.copy(R),!0}return!1}function _(T){const N=T.uniforms;let j=0;const O=16;for(let z=0,M=N.length;z<M;z++){const P=Array.isArray(N[z])?N[z]:[N[z]];for(let G=0,U=P.length;G<U;G++){const Y=P[G],W=Array.isArray(Y.value)?Y.value:[Y.value];for(let J=0,F=W.length;J<F;J++){const $=W[J],V=C($),se=j%O,ue=se%V.boundary,Ce=se+ue;j+=ue,Ce!==0&&O-Ce<V.storage&&(j+=O-Ce),Y.__data=new Float32Array(V.storage/Float32Array.BYTES_PER_ELEMENT),Y.__offset=j,j+=V.storage}}}const R=j%O;return R>0&&(j+=O-R),T.__size=j,T.__cache={},this}function C(T){const N={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(N.boundary=4,N.storage=4):T.isVector2?(N.boundary=8,N.storage=8):T.isVector3||T.isColor?(N.boundary=16,N.storage=12):T.isVector4?(N.boundary=16,N.storage=16):T.isMatrix3?(N.boundary=48,N.storage=48):T.isMatrix4?(N.boundary=64,N.storage=64):T.isTexture?Bt("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Bt("WebGLRenderer: Unsupported uniform value type.",T),N}function w(T){const N=T.target;N.removeEventListener("dispose",w);const j=u.indexOf(N.__bindingPointIndex);u.splice(j,1),n.deleteBuffer(r[N.id]),delete r[N.id],delete l[N.id]}function S(){for(const T in r)n.deleteBuffer(r[T]);u=[],r={},l={}}return{bind:d,update:p,dispose:S}}const rq=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Tr=null;function aq(){return Tr===null&&(Tr=new tF(rq,16,16,Fc,Ra),Tr.name="DFG_LUT",Tr.minFilter=zi,Tr.magFilter=zi,Tr.wrapS=Sa,Tr.wrapT=Sa,Tr.generateMipmaps=!1,Tr.needsUpdate=!0),Tr}class oq{constructor(e={}){const{canvas:t=k$(),context:i=null,depth:r=!0,stencil:l=!1,alpha:u=!1,antialias:h=!1,premultipliedAlpha:d=!0,preserveDrawingBuffer:p=!1,powerPreference:m="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:b=!1,outputBufferType:y=Ws}=e;this.isWebGLRenderer=!0;let _;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=i.getContextAttributes().alpha}else _=u;const C=y,w=new Set([oy,ay,ry]),S=new Set([Ws,Hr,qd,Wd,iy,sy]),T=new Uint32Array(4),N=new Int32Array(4);let j=null,O=null;const R=[],z=[];let M=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Dr,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const P=this;let G=!1;this._outputColorSpace=Gs;let U=0,Y=0,W=null,J=-1,F=null;const $=new Kn,V=new Kn;let se=null;const ue=new _n(0);let Ce=0,D=t.width,H=t.height,Z=1,Ee=null,je=null;const le=new Kn(0,0,D,H),Se=new Kn(0,0,D,H);let de=!1;const Me=new wC;let Le=!1,pe=!1;const Be=new hi,We=new Ne,dt=new Kn,Ct={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ut=!1;function kt(){return W===null?Z:1}let K=i;function Nt(L,q){return t.getContext(L,q)}try{const L={alpha:!0,depth:r,stencil:l,antialias:h,premultipliedAlpha:d,preserveDrawingBuffer:p,powerPreference:m,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${ty}`),t.addEventListener("webglcontextlost",Ye,!1),t.addEventListener("webglcontextrestored",pt,!1),t.addEventListener("webglcontextcreationerror",Wt,!1),K===null){const q="webgl2";if(K=Nt(q,L),K===null)throw Nt(q)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(L){throw hn("WebGLRenderer: "+L.message),L}let Tt,Mt,nt,I,k,Q,fe,be,xe,Xe,$e,it,ht,X,oe,ke,Ae,De,st,te,Ie,Pe,Ze;function ze(){Tt=new oV(K),Tt.init(),Ie=new ZG(K,Tt),Mt=new JH(K,Tt,e,Ie),nt=new YG(K,Tt),Mt.reversedDepthBuffer&&b&&nt.buffers.depth.setReversed(!0),I=new uV(K),k=new OG,Q=new KG(K,Tt,nt,k,Mt,Ie,I),fe=new aV(P),be=new mF(K),Pe=new ZH(K,be),xe=new lV(K,be,I,Pe),Xe=new hV(K,xe,be,Pe,I),De=new dV(K,Mt,Q),oe=new eV(k),$e=new PG(P,fe,Tt,Mt,Pe,oe),it=new iq(P,k),ht=new UG,X=new HG(Tt),Ae=new KH(P,fe,nt,Xe,_,d),ke=new XG(P,Xe,Mt),Ze=new sq(K,I,Mt,nt),st=new QH(K,Tt,I),te=new cV(K,Tt,I),I.programs=$e.programs,P.capabilities=Mt,P.extensions=Tt,P.properties=k,P.renderLists=ht,P.shadowMap=ke,P.state=nt,P.info=I}ze(),C!==Ws&&(M=new pV(C,t.width,t.height,r,l));const ge=new tq(P,K);this.xr=ge,this.getContext=function(){return K},this.getContextAttributes=function(){return K.getContextAttributes()},this.forceContextLoss=function(){const L=Tt.get("WEBGL_lose_context");L&&L.loseContext()},this.forceContextRestore=function(){const L=Tt.get("WEBGL_lose_context");L&&L.restoreContext()},this.getPixelRatio=function(){return Z},this.setPixelRatio=function(L){L!==void 0&&(Z=L,this.setSize(D,H,!1))},this.getSize=function(L){return L.set(D,H)},this.setSize=function(L,q,ne=!0){if(ge.isPresenting){Bt("WebGLRenderer: Can't change size while VR device is presenting.");return}D=L,H=q,t.width=Math.floor(L*Z),t.height=Math.floor(q*Z),ne===!0&&(t.style.width=L+"px",t.style.height=q+"px"),M!==null&&M.setSize(t.width,t.height),this.setViewport(0,0,L,q)},this.getDrawingBufferSize=function(L){return L.set(D*Z,H*Z).floor()},this.setDrawingBufferSize=function(L,q,ne){D=L,H=q,Z=ne,t.width=Math.floor(L*ne),t.height=Math.floor(q*ne),this.setViewport(0,0,L,q)},this.setEffects=function(L){if(C===Ws){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(L){for(let q=0;q<L.length;q++)if(L[q].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}M.setEffects(L||[])},this.getCurrentViewport=function(L){return L.copy($)},this.getViewport=function(L){return L.copy(le)},this.setViewport=function(L,q,ne,re){L.isVector4?le.set(L.x,L.y,L.z,L.w):le.set(L,q,ne,re),nt.viewport($.copy(le).multiplyScalar(Z).round())},this.getScissor=function(L){return L.copy(Se)},this.setScissor=function(L,q,ne,re){L.isVector4?Se.set(L.x,L.y,L.z,L.w):Se.set(L,q,ne,re),nt.scissor(V.copy(Se).multiplyScalar(Z).round())},this.getScissorTest=function(){return de},this.setScissorTest=function(L){nt.setScissorTest(de=L)},this.setOpaqueSort=function(L){Ee=L},this.setTransparentSort=function(L){je=L},this.getClearColor=function(L){return L.copy(Ae.getClearColor())},this.setClearColor=function(){Ae.setClearColor(...arguments)},this.getClearAlpha=function(){return Ae.getClearAlpha()},this.setClearAlpha=function(){Ae.setClearAlpha(...arguments)},this.clear=function(L=!0,q=!0,ne=!0){let re=0;if(L){let me=!1;if(W!==null){const Je=W.texture.format;me=w.has(Je)}if(me){const Je=W.texture.type,qe=S.has(Je),Qe=Ae.getClearColor(),et=Ae.getClearAlpha(),mt=Qe.r,Ot=Qe.g,$t=Qe.b;qe?(T[0]=mt,T[1]=Ot,T[2]=$t,T[3]=et,K.clearBufferuiv(K.COLOR,0,T)):(N[0]=mt,N[1]=Ot,N[2]=$t,N[3]=et,K.clearBufferiv(K.COLOR,0,N))}else re|=K.COLOR_BUFFER_BIT}q&&(re|=K.DEPTH_BUFFER_BIT),ne&&(re|=K.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),re!==0&&K.clear(re)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Ye,!1),t.removeEventListener("webglcontextrestored",pt,!1),t.removeEventListener("webglcontextcreationerror",Wt,!1),Ae.dispose(),ht.dispose(),X.dispose(),k.dispose(),fe.dispose(),Xe.dispose(),Pe.dispose(),Ze.dispose(),$e.dispose(),ge.dispose(),ge.removeEventListener("sessionstart",Qn),ge.removeEventListener("sessionend",bi),qn.stop()};function Ye(L){L.preventDefault(),sE("WebGLRenderer: Context Lost."),G=!0}function pt(){sE("WebGLRenderer: Context Restored."),G=!1;const L=I.autoReset,q=ke.enabled,ne=ke.autoUpdate,re=ke.needsUpdate,me=ke.type;ze(),I.autoReset=L,ke.enabled=q,ke.autoUpdate=ne,ke.needsUpdate=re,ke.type=me}function Wt(L){hn("WebGLRenderer: A WebGL context could not be created. Reason: ",L.statusMessage)}function ce(L){const q=L.target;q.removeEventListener("dispose",ce),Ge(q)}function Ge(L){vt(L),k.remove(L)}function vt(L){const q=k.get(L).programs;q!==void 0&&(q.forEach(function(ne){$e.releaseProgram(ne)}),L.isShaderMaterial&&$e.releaseShaderCache(L))}this.renderBufferDirect=function(L,q,ne,re,me,Je){q===null&&(q=Ct);const qe=me.isMesh&&me.matrixWorld.determinant()<0,Qe=Ks(L,q,ne,re,me);nt.setMaterial(re,qe);let et=ne.index,mt=1;if(re.wireframe===!0){if(et=xe.getWireframeAttribute(ne),et===void 0)return;mt=2}const Ot=ne.drawRange,$t=ne.attributes.position;let ae=Ot.start*mt,Ve=(Ot.start+Ot.count)*mt;Je!==null&&(ae=Math.max(ae,Je.start*mt),Ve=Math.min(Ve,(Je.start+Je.count)*mt)),et!==null?(ae=Math.max(ae,0),Ve=Math.min(Ve,et.count)):$t!=null&&(ae=Math.max(ae,0),Ve=Math.min(Ve,$t.count));const ct=Ve-ae;if(ct<0||ct===1/0)return;Pe.setup(me,re,Qe,ne,et);let Dt,At=st;if(et!==null&&(Dt=be.get(et),At=te,At.setIndex(Dt)),me.isMesh)re.wireframe===!0?(nt.setLineWidth(re.wireframeLinewidth*kt()),At.setMode(K.LINES)):At.setMode(K.TRIANGLES);else if(me.isLine){let mn=re.linewidth;mn===void 0&&(mn=1),nt.setLineWidth(mn*kt()),me.isLineSegments?At.setMode(K.LINES):me.isLineLoop?At.setMode(K.LINE_LOOP):At.setMode(K.LINE_STRIP)}else me.isPoints?At.setMode(K.POINTS):me.isSprite&&At.setMode(K.TRIANGLES);if(me.isBatchedMesh)if(me._multiDrawInstances!==null)Kp("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),At.renderMultiDrawInstances(me._multiDrawStarts,me._multiDrawCounts,me._multiDrawCount,me._multiDrawInstances);else if(Tt.get("WEBGL_multi_draw"))At.renderMultiDraw(me._multiDrawStarts,me._multiDrawCounts,me._multiDrawCount);else{const mn=me._multiDrawStarts,ot=me._multiDrawCounts,an=me._multiDrawCount,It=et?be.get(et).bytesPerElement:1,Bi=k.get(re).currentProgram.getUniforms();for(let us=0;us<an;us++)Bi.setValue(K,"_gl_DrawID",us),At.render(mn[us]/It,ot[us])}else if(me.isInstancedMesh)At.renderInstances(ae,ct,me.count);else if(ne.isInstancedBufferGeometry){const mn=ne._maxInstanceCount!==void 0?ne._maxInstanceCount:1/0,ot=Math.min(ne.instanceCount,mn);At.renderInstances(ae,ct,ot)}else At.render(ae,ct)};function rn(L,q,ne){L.transparent===!0&&L.side===Rr&&L.forceSinglePass===!1?(L.side=os,L.needsUpdate=!0,Fi(L,q,ne),L.side=So,L.needsUpdate=!0,Fi(L,q,ne),L.side=Rr):Fi(L,q,ne)}this.compile=function(L,q,ne=null){ne===null&&(ne=L),O=X.get(ne),O.init(q),z.push(O),ne.traverseVisible(function(me){me.isLight&&me.layers.test(q.layers)&&(O.pushLight(me),me.castShadow&&O.pushShadow(me))}),L!==ne&&L.traverseVisible(function(me){me.isLight&&me.layers.test(q.layers)&&(O.pushLight(me),me.castShadow&&O.pushShadow(me))}),O.setupLights();const re=new Set;return L.traverse(function(me){if(!(me.isMesh||me.isPoints||me.isLine||me.isSprite))return;const Je=me.material;if(Je)if(Array.isArray(Je))for(let qe=0;qe<Je.length;qe++){const Qe=Je[qe];rn(Qe,ne,me),re.add(Qe)}else rn(Je,ne,me),re.add(Je)}),O=z.pop(),re},this.compileAsync=function(L,q,ne=null){const re=this.compile(L,q,ne);return new Promise(me=>{function Je(){if(re.forEach(function(qe){k.get(qe).currentProgram.isReady()&&re.delete(qe)}),re.size===0){me(L);return}setTimeout(Je,10)}Tt.get("KHR_parallel_shader_compile")!==null?Je():setTimeout(Je,10)})};let On=null;function Dn(L){On&&On(L)}function Qn(){qn.stop()}function bi(){qn.start()}const qn=new MC;qn.setAnimationLoop(Dn),typeof self<"u"&&qn.setContext(self),this.setAnimationLoop=function(L){On=L,ge.setAnimationLoop(L),L===null?qn.stop():qn.start()},ge.addEventListener("sessionstart",Qn),ge.addEventListener("sessionend",bi),this.render=function(L,q){if(q!==void 0&&q.isCamera!==!0){hn("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(G===!0)return;const ne=ge.enabled===!0&&ge.isPresenting===!0,re=M!==null&&(W===null||ne)&&M.begin(P,W);if(L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),q.parent===null&&q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),ge.enabled===!0&&ge.isPresenting===!0&&(M===null||M.isCompositing()===!1)&&(ge.cameraAutoUpdate===!0&&ge.updateCamera(q),q=ge.getCamera()),L.isScene===!0&&L.onBeforeRender(P,L,q,W),O=X.get(L,z.length),O.init(q),z.push(O),Be.multiplyMatrices(q.projectionMatrix,q.matrixWorldInverse),Me.setFromProjectionMatrix(Be,jr,q.reversedDepth),pe=this.localClippingEnabled,Le=oe.init(this.clippingPlanes,pe),j=ht.get(L,R.length),j.init(),R.push(j),ge.enabled===!0&&ge.isPresenting===!0){const qe=P.xr.getDepthSensingMesh();qe!==null&&cs(qe,q,-1/0,P.sortObjects)}cs(L,q,0,P.sortObjects),j.finish(),P.sortObjects===!0&&j.sort(Ee,je),ut=ge.enabled===!1||ge.isPresenting===!1||ge.hasDepthSensing()===!1,ut&&Ae.addToRenderList(j,L),this.info.render.frame++,Le===!0&&oe.beginShadows();const me=O.state.shadowsArray;if(ke.render(me,L,q),Le===!0&&oe.endShadows(),this.info.autoReset===!0&&this.info.reset(),(re&&M.hasRenderPass())===!1){const qe=j.opaque,Qe=j.transmissive;if(O.setupLights(),q.isArrayCamera){const et=q.cameras;if(Qe.length>0)for(let mt=0,Ot=et.length;mt<Ot;mt++){const $t=et[mt];xn(qe,Qe,L,$t)}ut&&Ae.render(L);for(let mt=0,Ot=et.length;mt<Ot;mt++){const $t=et[mt];Jn(j,L,$t,$t.viewport)}}else Qe.length>0&&xn(qe,Qe,L,q),ut&&Ae.render(L),Jn(j,L,q)}W!==null&&Y===0&&(Q.updateMultisampleRenderTarget(W),Q.updateRenderTargetMipmap(W)),re&&M.end(P),L.isScene===!0&&L.onAfterRender(P,L,q),Pe.resetDefaultState(),J=-1,F=null,z.pop(),z.length>0?(O=z[z.length-1],Le===!0&&oe.setGlobalState(P.clippingPlanes,O.state.camera)):O=null,R.pop(),R.length>0?j=R[R.length-1]:j=null};function cs(L,q,ne,re){if(L.visible===!1)return;if(L.layers.test(q.layers)){if(L.isGroup)ne=L.renderOrder;else if(L.isLOD)L.autoUpdate===!0&&L.update(q);else if(L.isLight)O.pushLight(L),L.castShadow&&O.pushShadow(L);else if(L.isSprite){if(!L.frustumCulled||Me.intersectsSprite(L)){re&&dt.setFromMatrixPosition(L.matrixWorld).applyMatrix4(Be);const qe=Xe.update(L),Qe=L.material;Qe.visible&&j.push(L,qe,Qe,ne,dt.z,null)}}else if((L.isMesh||L.isLine||L.isPoints)&&(!L.frustumCulled||Me.intersectsObject(L))){const qe=Xe.update(L),Qe=L.material;if(re&&(L.boundingSphere!==void 0?(L.boundingSphere===null&&L.computeBoundingSphere(),dt.copy(L.boundingSphere.center)):(qe.boundingSphere===null&&qe.computeBoundingSphere(),dt.copy(qe.boundingSphere.center)),dt.applyMatrix4(L.matrixWorld).applyMatrix4(Be)),Array.isArray(Qe)){const et=qe.groups;for(let mt=0,Ot=et.length;mt<Ot;mt++){const $t=et[mt],ae=Qe[$t.materialIndex];ae&&ae.visible&&j.push(L,qe,ae,ne,dt.z,$t)}}else Qe.visible&&j.push(L,qe,Qe,ne,dt.z,null)}}const Je=L.children;for(let qe=0,Qe=Je.length;qe<Qe;qe++)cs(Je[qe],q,ne,re)}function Jn(L,q,ne,re){const{opaque:me,transmissive:Je,transparent:qe}=L;O.setupLightsView(ne),Le===!0&&oe.setGlobalState(P.clippingPlanes,ne),re&&nt.viewport($.copy(re)),me.length>0&&Nn(me,q,ne),Je.length>0&&Nn(Je,q,ne),qe.length>0&&Nn(qe,q,ne),nt.buffers.depth.setTest(!0),nt.buffers.depth.setMask(!0),nt.buffers.color.setMask(!0),nt.setPolygonOffset(!1)}function xn(L,q,ne,re){if((ne.isScene===!0?ne.overrideMaterial:null)!==null)return;if(O.state.transmissionRenderTarget[re.id]===void 0){const ae=Tt.has("EXT_color_buffer_half_float")||Tt.has("EXT_color_buffer_float");O.state.transmissionRenderTarget[re.id]=new Ur(1,1,{generateMipmaps:!0,type:ae?Ra:Ws,minFilter:ol,samples:Math.max(4,Mt.samples),stencilBuffer:l,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:cn.workingColorSpace})}const Je=O.state.transmissionRenderTarget[re.id],qe=re.viewport||$;Je.setSize(qe.z*P.transmissionResolutionScale,qe.w*P.transmissionResolutionScale);const Qe=P.getRenderTarget(),et=P.getActiveCubeFace(),mt=P.getActiveMipmapLevel();P.setRenderTarget(Je),P.getClearColor(ue),Ce=P.getClearAlpha(),Ce<1&&P.setClearColor(16777215,.5),P.clear(),ut&&Ae.render(ne);const Ot=P.toneMapping;P.toneMapping=Dr;const $t=re.viewport;if(re.viewport!==void 0&&(re.viewport=void 0),O.setupLightsView(re),Le===!0&&oe.setGlobalState(P.clippingPlanes,re),Nn(L,ne,re),Q.updateMultisampleRenderTarget(Je),Q.updateRenderTargetMipmap(Je),Tt.has("WEBGL_multisampled_render_to_texture")===!1){let ae=!1;for(let Ve=0,ct=q.length;Ve<ct;Ve++){const Dt=q[Ve],{object:At,geometry:mn,material:ot,group:an}=Dt;if(ot.side===Rr&&At.layers.test(re.layers)){const It=ot.side;ot.side=os,ot.needsUpdate=!0,Si(At,ne,re,mn,ot,an),ot.side=It,ot.needsUpdate=!0,ae=!0}}ae===!0&&(Q.updateMultisampleRenderTarget(Je),Q.updateRenderTargetMipmap(Je))}P.setRenderTarget(Qe,et,mt),P.setClearColor(ue,Ce),$t!==void 0&&(re.viewport=$t),P.toneMapping=Ot}function Nn(L,q,ne){const re=q.isScene===!0?q.overrideMaterial:null;for(let me=0,Je=L.length;me<Je;me++){const qe=L[me],{object:Qe,geometry:et,group:mt}=qe;let Ot=qe.material;Ot.allowOverride===!0&&re!==null&&(Ot=re),Qe.layers.test(ne.layers)&&Si(Qe,q,ne,et,Ot,mt)}}function Si(L,q,ne,re,me,Je){L.onBeforeRender(P,q,ne,re,me,Je),L.modelViewMatrix.multiplyMatrices(ne.matrixWorldInverse,L.matrixWorld),L.normalMatrix.getNormalMatrix(L.modelViewMatrix),me.onBeforeRender(P,q,ne,re,L,Je),me.transparent===!0&&me.side===Rr&&me.forceSinglePass===!1?(me.side=os,me.needsUpdate=!0,P.renderBufferDirect(ne,q,re,me,L,Je),me.side=So,me.needsUpdate=!0,P.renderBufferDirect(ne,q,re,me,L,Je),me.side=Rr):P.renderBufferDirect(ne,q,re,me,L,Je),L.onAfterRender(P,q,ne,re,me,Je)}function Fi(L,q,ne){q.isScene!==!0&&(q=Ct);const re=k.get(L),me=O.state.lights,Je=O.state.shadowsArray,qe=me.state.version,Qe=$e.getParameters(L,me.state,Je,q,ne),et=$e.getProgramCacheKey(Qe);let mt=re.programs;re.environment=L.isMeshStandardMaterial||L.isMeshLambertMaterial||L.isMeshPhongMaterial?q.environment:null,re.fog=q.fog;const Ot=L.isMeshStandardMaterial||L.isMeshLambertMaterial&&!L.envMap||L.isMeshPhongMaterial&&!L.envMap;re.envMap=fe.get(L.envMap||re.environment,Ot),re.envMapRotation=re.environment!==null&&L.envMap===null?q.environmentRotation:L.envMapRotation,mt===void 0&&(L.addEventListener("dispose",ce),mt=new Map,re.programs=mt);let $t=mt.get(et);if($t!==void 0){if(re.currentProgram===$t&&re.lightsStateVersion===qe)return vi(L,Qe),$t}else Qe.uniforms=$e.getUniforms(L),L.onBeforeCompile(Qe,P),$t=$e.acquireProgram(Qe,et),mt.set(et,$t),re.uniforms=Qe.uniforms;const ae=re.uniforms;return(!L.isShaderMaterial&&!L.isRawShaderMaterial||L.clipping===!0)&&(ae.clippingPlanes=oe.uniform),vi(L,Qe),re.needsLights=He(L),re.lightsStateVersion=qe,re.needsLights&&(ae.ambientLightColor.value=me.state.ambient,ae.lightProbe.value=me.state.probe,ae.directionalLights.value=me.state.directional,ae.directionalLightShadows.value=me.state.directionalShadow,ae.spotLights.value=me.state.spot,ae.spotLightShadows.value=me.state.spotShadow,ae.rectAreaLights.value=me.state.rectArea,ae.ltc_1.value=me.state.rectAreaLTC1,ae.ltc_2.value=me.state.rectAreaLTC2,ae.pointLights.value=me.state.point,ae.pointLightShadows.value=me.state.pointShadow,ae.hemisphereLights.value=me.state.hemi,ae.directionalShadowMatrix.value=me.state.directionalShadowMatrix,ae.spotLightMatrix.value=me.state.spotLightMatrix,ae.spotLightMap.value=me.state.spotLightMap,ae.pointShadowMatrix.value=me.state.pointShadowMatrix),re.currentProgram=$t,re.uniformsList=null,$t}function Li(L){if(L.uniformsList===null){const q=L.currentProgram.getUniforms();L.uniformsList=Tp.seqWithValue(q.seq,L.uniforms)}return L.uniformsList}function vi(L,q){const ne=k.get(L);ne.outputColorSpace=q.outputColorSpace,ne.batching=q.batching,ne.batchingColor=q.batchingColor,ne.instancing=q.instancing,ne.instancingColor=q.instancingColor,ne.instancingMorph=q.instancingMorph,ne.skinning=q.skinning,ne.morphTargets=q.morphTargets,ne.morphNormals=q.morphNormals,ne.morphColors=q.morphColors,ne.morphTargetsCount=q.morphTargetsCount,ne.numClippingPlanes=q.numClippingPlanes,ne.numIntersection=q.numClipIntersection,ne.vertexAlphas=q.vertexAlphas,ne.vertexTangents=q.vertexTangents,ne.toneMapping=q.toneMapping}function Ks(L,q,ne,re,me){q.isScene!==!0&&(q=Ct),Q.resetTextureUnits();const Je=q.fog,qe=re.isMeshStandardMaterial||re.isMeshLambertMaterial||re.isMeshPhongMaterial?q.environment:null,Qe=W===null?P.outputColorSpace:W.isXRRenderTarget===!0?W.texture.colorSpace:Bc,et=re.isMeshStandardMaterial||re.isMeshLambertMaterial&&!re.envMap||re.isMeshPhongMaterial&&!re.envMap,mt=fe.get(re.envMap||qe,et),Ot=re.vertexColors===!0&&!!ne.attributes.color&&ne.attributes.color.itemSize===4,$t=!!ne.attributes.tangent&&(!!re.normalMap||re.anisotropy>0),ae=!!ne.morphAttributes.position,Ve=!!ne.morphAttributes.normal,ct=!!ne.morphAttributes.color;let Dt=Dr;re.toneMapped&&(W===null||W.isXRRenderTarget===!0)&&(Dt=P.toneMapping);const At=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,mn=At!==void 0?At.length:0,ot=k.get(re),an=O.state.lights;if(Le===!0&&(pe===!0||L!==F)){const ti=L===F&&re.id===J;oe.setState(re,L,ti)}let It=!1;re.version===ot.__version?(ot.needsLights&&ot.lightsStateVersion!==an.state.version||ot.outputColorSpace!==Qe||me.isBatchedMesh&&ot.batching===!1||!me.isBatchedMesh&&ot.batching===!0||me.isBatchedMesh&&ot.batchingColor===!0&&me.colorTexture===null||me.isBatchedMesh&&ot.batchingColor===!1&&me.colorTexture!==null||me.isInstancedMesh&&ot.instancing===!1||!me.isInstancedMesh&&ot.instancing===!0||me.isSkinnedMesh&&ot.skinning===!1||!me.isSkinnedMesh&&ot.skinning===!0||me.isInstancedMesh&&ot.instancingColor===!0&&me.instanceColor===null||me.isInstancedMesh&&ot.instancingColor===!1&&me.instanceColor!==null||me.isInstancedMesh&&ot.instancingMorph===!0&&me.morphTexture===null||me.isInstancedMesh&&ot.instancingMorph===!1&&me.morphTexture!==null||ot.envMap!==mt||re.fog===!0&&ot.fog!==Je||ot.numClippingPlanes!==void 0&&(ot.numClippingPlanes!==oe.numPlanes||ot.numIntersection!==oe.numIntersection)||ot.vertexAlphas!==Ot||ot.vertexTangents!==$t||ot.morphTargets!==ae||ot.morphNormals!==Ve||ot.morphColors!==ct||ot.toneMapping!==Dt||ot.morphTargetsCount!==mn)&&(It=!0):(It=!0,ot.__version=re.version);let Bi=ot.currentProgram;It===!0&&(Bi=Fi(re,q,me));let us=!1,Zs=!1,ds=!1;const gn=Bi.getUniforms(),ei=ot.uniforms;if(nt.useProgram(Bi.program)&&(us=!0,Zs=!0,ds=!0),re.id!==J&&(J=re.id,Zs=!0),us||F!==L){nt.buffers.depth.getReversed()&&L.reversedDepth!==!0&&(L._reversedDepth=!0,L.updateProjectionMatrix()),gn.setValue(K,"projectionMatrix",L.projectionMatrix),gn.setValue(K,"viewMatrix",L.matrixWorldInverse);const Qs=gn.map.cameraPosition;Qs!==void 0&&Qs.setValue(K,We.setFromMatrixPosition(L.matrixWorld)),Mt.logarithmicDepthBuffer&&gn.setValue(K,"logDepthBufFC",2/(Math.log(L.far+1)/Math.LN2)),(re.isMeshPhongMaterial||re.isMeshToonMaterial||re.isMeshLambertMaterial||re.isMeshBasicMaterial||re.isMeshStandardMaterial||re.isShaderMaterial)&&gn.setValue(K,"isOrthographic",L.isOrthographicCamera===!0),F!==L&&(F=L,Zs=!0,ds=!0)}if(ot.needsLights&&(an.state.directionalShadowMap.length>0&&gn.setValue(K,"directionalShadowMap",an.state.directionalShadowMap,Q),an.state.spotShadowMap.length>0&&gn.setValue(K,"spotShadowMap",an.state.spotShadowMap,Q),an.state.pointShadowMap.length>0&&gn.setValue(K,"pointShadowMap",an.state.pointShadowMap,Q)),me.isSkinnedMesh){gn.setOptional(K,me,"bindMatrix"),gn.setOptional(K,me,"bindMatrixInverse");const ti=me.skeleton;ti&&(ti.boneTexture===null&&ti.computeBoneTexture(),gn.setValue(K,"boneTexture",ti.boneTexture,Q))}me.isBatchedMesh&&(gn.setOptional(K,me,"batchingTexture"),gn.setValue(K,"batchingTexture",me._matricesTexture,Q),gn.setOptional(K,me,"batchingIdTexture"),gn.setValue(K,"batchingIdTexture",me._indirectTexture,Q),gn.setOptional(K,me,"batchingColorTexture"),me._colorsTexture!==null&&gn.setValue(K,"batchingColorTexture",me._colorsTexture,Q));const Hi=ne.morphAttributes;if((Hi.position!==void 0||Hi.normal!==void 0||Hi.color!==void 0)&&De.update(me,ne,Bi),(Zs||ot.receiveShadow!==me.receiveShadow)&&(ot.receiveShadow=me.receiveShadow,gn.setValue(K,"receiveShadow",me.receiveShadow)),(re.isMeshStandardMaterial||re.isMeshLambertMaterial||re.isMeshPhongMaterial)&&re.envMap===null&&q.environment!==null&&(ei.envMapIntensity.value=q.environmentIntensity),ei.dfgLUT!==void 0&&(ei.dfgLUT.value=aq()),Zs&&(gn.setValue(K,"toneMappingExposure",P.toneMappingExposure),ot.needsLights&&we(ei,ds),Je&&re.fog===!0&&it.refreshFogUniforms(ei,Je),it.refreshMaterialUniforms(ei,re,Z,H,O.state.transmissionRenderTarget[L.id]),Tp.upload(K,Li(ot),ei,Q)),re.isShaderMaterial&&re.uniformsNeedUpdate===!0&&(Tp.upload(K,Li(ot),ei,Q),re.uniformsNeedUpdate=!1),re.isSpriteMaterial&&gn.setValue(K,"center",me.center),gn.setValue(K,"modelViewMatrix",me.modelViewMatrix),gn.setValue(K,"normalMatrix",me.normalMatrix),gn.setValue(K,"modelMatrix",me.matrixWorld),re.isShaderMaterial||re.isRawShaderMaterial){const ti=re.uniformsGroups;for(let Qs=0,Yr=ti.length;Qs<Yr;Qs++){const _l=ti[Qs];Ze.update(_l,Bi),Ze.bind(_l,Bi)}}return Bi}function we(L,q){L.ambientLightColor.needsUpdate=q,L.lightProbe.needsUpdate=q,L.directionalLights.needsUpdate=q,L.directionalLightShadows.needsUpdate=q,L.pointLights.needsUpdate=q,L.pointLightShadows.needsUpdate=q,L.spotLights.needsUpdate=q,L.spotLightShadows.needsUpdate=q,L.rectAreaLights.needsUpdate=q,L.hemisphereLights.needsUpdate=q}function He(L){return L.isMeshLambertMaterial||L.isMeshToonMaterial||L.isMeshPhongMaterial||L.isMeshStandardMaterial||L.isShadowMaterial||L.isShaderMaterial&&L.lights===!0}this.getActiveCubeFace=function(){return U},this.getActiveMipmapLevel=function(){return Y},this.getRenderTarget=function(){return W},this.setRenderTargetTextures=function(L,q,ne){const re=k.get(L);re.__autoAllocateDepthBuffer=L.resolveDepthBuffer===!1,re.__autoAllocateDepthBuffer===!1&&(re.__useRenderToTexture=!1),k.get(L.texture).__webglTexture=q,k.get(L.depthTexture).__webglTexture=re.__autoAllocateDepthBuffer?void 0:ne,re.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(L,q){const ne=k.get(L);ne.__webglFramebuffer=q,ne.__useDefaultFramebuffer=q===void 0};const rt=K.createFramebuffer();this.setRenderTarget=function(L,q=0,ne=0){W=L,U=q,Y=ne;let re=null,me=!1,Je=!1;if(L){const Qe=k.get(L);if(Qe.__useDefaultFramebuffer!==void 0){nt.bindFramebuffer(K.FRAMEBUFFER,Qe.__webglFramebuffer),$.copy(L.viewport),V.copy(L.scissor),se=L.scissorTest,nt.viewport($),nt.scissor(V),nt.setScissorTest(se),J=-1;return}else if(Qe.__webglFramebuffer===void 0)Q.setupRenderTarget(L);else if(Qe.__hasExternalTextures)Q.rebindTextures(L,k.get(L.texture).__webglTexture,k.get(L.depthTexture).__webglTexture);else if(L.depthBuffer){const Ot=L.depthTexture;if(Qe.__boundDepthTexture!==Ot){if(Ot!==null&&k.has(Ot)&&(L.width!==Ot.image.width||L.height!==Ot.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Q.setupDepthRenderbuffer(L)}}const et=L.texture;(et.isData3DTexture||et.isDataArrayTexture||et.isCompressedArrayTexture)&&(Je=!0);const mt=k.get(L).__webglFramebuffer;L.isWebGLCubeRenderTarget?(Array.isArray(mt[q])?re=mt[q][ne]:re=mt[q],me=!0):L.samples>0&&Q.useMultisampledRTT(L)===!1?re=k.get(L).__webglMultisampledFramebuffer:Array.isArray(mt)?re=mt[ne]:re=mt,$.copy(L.viewport),V.copy(L.scissor),se=L.scissorTest}else $.copy(le).multiplyScalar(Z).floor(),V.copy(Se).multiplyScalar(Z).floor(),se=de;if(ne!==0&&(re=rt),nt.bindFramebuffer(K.FRAMEBUFFER,re)&&nt.drawBuffers(L,re),nt.viewport($),nt.scissor(V),nt.setScissorTest(se),me){const Qe=k.get(L.texture);K.framebufferTexture2D(K.FRAMEBUFFER,K.COLOR_ATTACHMENT0,K.TEXTURE_CUBE_MAP_POSITIVE_X+q,Qe.__webglTexture,ne)}else if(Je){const Qe=q;for(let et=0;et<L.textures.length;et++){const mt=k.get(L.textures[et]);K.framebufferTextureLayer(K.FRAMEBUFFER,K.COLOR_ATTACHMENT0+et,mt.__webglTexture,ne,Qe)}}else if(L!==null&&ne!==0){const Qe=k.get(L.texture);K.framebufferTexture2D(K.FRAMEBUFFER,K.COLOR_ATTACHMENT0,K.TEXTURE_2D,Qe.__webglTexture,ne)}J=-1},this.readRenderTargetPixels=function(L,q,ne,re,me,Je,qe,Qe=0){if(!(L&&L.isWebGLRenderTarget)){hn("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let et=k.get(L).__webglFramebuffer;
4127if(L.isWebGLCubeRenderTarget&&qe!==void 0&&(et=et[qe]),et){nt.bindFramebuffer(K.FRAMEBUFFER,et);try{const mt=L.textures[Qe],Ot=mt.format,$t=mt.type;if(L.textures.length>1&&K.readBuffer(K.COLOR_ATTACHMENT0+Qe),!Mt.textureFormatReadable(Ot)){hn("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Mt.textureTypeReadable($t)){hn("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}q>=0&&q<=L.width-re&&ne>=0&&ne<=L.height-me&&K.readPixels(q,ne,re,me,Ie.convert(Ot),Ie.convert($t),Je)}finally{const mt=W!==null?k.get(W).__webglFramebuffer:null;nt.bindFramebuffer(K.FRAMEBUFFER,mt)}}},this.readRenderTargetPixelsAsync=async function(L,q,ne,re,me,Je,qe,Qe=0){if(!(L&&L.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let et=k.get(L).__webglFramebuffer;if(L.isWebGLCubeRenderTarget&&qe!==void 0&&(et=et[qe]),et)if(q>=0&&q<=L.width-re&&ne>=0&&ne<=L.height-me){nt.bindFramebuffer(K.FRAMEBUFFER,et);const mt=L.textures[Qe],Ot=mt.format,$t=mt.type;if(L.textures.length>1&&K.readBuffer(K.COLOR_ATTACHMENT0+Qe),!Mt.textureFormatReadable(Ot))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Mt.textureTypeReadable($t))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const ae=K.createBuffer();K.bindBuffer(K.PIXEL_PACK_BUFFER,ae),K.bufferData(K.PIXEL_PACK_BUFFER,Je.byteLength,K.STREAM_READ),K.readPixels(q,ne,re,me,Ie.convert(Ot),Ie.convert($t),0);const Ve=W!==null?k.get(W).__webglFramebuffer:null;nt.bindFramebuffer(K.FRAMEBUFFER,Ve);const ct=K.fenceSync(K.SYNC_GPU_COMMANDS_COMPLETE,0);return K.flush(),await j$(K,ct,4),K.bindBuffer(K.PIXEL_PACK_BUFFER,ae),K.getBufferSubData(K.PIXEL_PACK_BUFFER,0,Je),K.deleteBuffer(ae),K.deleteSync(ct),Je}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(L,q=null,ne=0){const re=Math.pow(2,-ne),me=Math.floor(L.image.width*re),Je=Math.floor(L.image.height*re),qe=q!==null?q.x:0,Qe=q!==null?q.y:0;Q.setTexture2D(L,0),K.copyTexSubImage2D(K.TEXTURE_2D,ne,0,0,qe,Qe,me,Je),nt.unbindTexture()};const Ke=K.createFramebuffer(),lt=K.createFramebuffer();this.copyTextureToTexture=function(L,q,ne=null,re=null,me=0,Je=0){let qe,Qe,et,mt,Ot,$t,ae,Ve,ct;
vendor: 4,100 bytes, line 4127
4127const Dt=L.isCompressedTexture?L.mipmaps[Je]:L.image;if(ne!==null)qe=ne.max.x-ne.min.x,Qe=ne.max.y-ne.min.y,et=ne.isBox3?ne.max.z-ne.min.z:1,mt=ne.min.x,Ot=ne.min.y,$t=ne.isBox3?ne.min.z:0;else{const ei=Math.pow(2,-me);qe=Math.floor(Dt.width*ei),Qe=Math.floor(Dt.height*ei),L.isDataArrayTexture?et=Dt.depth:L.isData3DTexture?et=Math.floor(Dt.depth*ei):et=1,mt=0,Ot=0,$t=0}re!==null?(ae=re.x,Ve=re.y,ct=re.z):(ae=0,Ve=0,ct=0);const At=Ie.convert(q.format),mn=Ie.convert(q.type);let ot;q.isData3DTexture?(Q.setTexture3D(q,0),ot=K.TEXTURE_3D):q.isDataArrayTexture||q.isCompressedArrayTexture?(Q.setTexture2DArray(q,0),ot=K.TEXTURE_2D_ARRAY):(Q.setTexture2D(q,0),ot=K.TEXTURE_2D),K.pixelStorei(K.UNPACK_FLIP_Y_WEBGL,q.flipY),K.pixelStorei(K.UNPACK_PREMULTIPLY_ALPHA_WEBGL,q.premultiplyAlpha),K.pixelStorei(K.UNPACK_ALIGNMENT,q.unpackAlignment);const an=K.getParameter(K.UNPACK_ROW_LENGTH),It=K.getParameter(K.UNPACK_IMAGE_HEIGHT),Bi=K.getParameter(K.UNPACK_SKIP_PIXELS),us=K.getParameter(K.UNPACK_SKIP_ROWS),Zs=K.getParameter(K.UNPACK_SKIP_IMAGES);K.pixelStorei(K.UNPACK_ROW_LENGTH,Dt.width),K.pixelStorei(K.UNPACK_IMAGE_HEIGHT,Dt.height),K.pixelStorei(K.UNPACK_SKIP_PIXELS,mt),K.pixelStorei(K.UNPACK_SKIP_ROWS,Ot),K.pixelStorei(K.UNPACK_SKIP_IMAGES,$t);const ds=L.isDataArrayTexture||L.isData3DTexture,gn=q.isDataArrayTexture||q.isData3DTexture;if(L.isDepthTexture){const ei=k.get(L),Hi=k.get(q),ti=k.get(ei.__renderTarget),Qs=k.get(Hi.__renderTarget);nt.bindFramebuffer(K.READ_FRAMEBUFFER,ti.__webglFramebuffer),nt.bindFramebuffer(K.DRAW_FRAMEBUFFER,Qs.__webglFramebuffer);for(let Yr=0;Yr<et;Yr++)ds&&(K.framebufferTextureLayer(K.READ_FRAMEBUFFER,K.COLOR_ATTACHMENT0,k.get(L).__webglTexture,me,$t+Yr),K.framebufferTextureLayer(K.DRAW_FRAMEBUFFER,K.COLOR_ATTACHMENT0,k.get(q).__webglTexture,Je,ct+Yr)),K.blitFramebuffer(mt,Ot,qe,Qe,ae,Ve,qe,Qe,K.DEPTH_BUFFER_BIT,K.NEAREST);nt.bindFramebuffer(K.READ_FRAMEBUFFER,null),nt.bindFramebuffer(K.DRAW_FRAMEBUFFER,null)}else if(me!==0||L.isRenderTargetTexture||k.has(L)){const ei=k.get(L),Hi=k.get(q);nt.bindFramebuffer(K.READ_FRAMEBUFFER,Ke),nt.bindFramebuffer(K.DRAW_FRAMEBUFFER,lt);for(let ti=0;ti<et;ti++)ds?K.framebufferTextureLayer(K.READ_FRAMEBUFFER,K.COLOR_ATTACHMENT0,ei.__webglTexture,me,$t+ti):K.framebufferTexture2D(K.READ_FRAMEBUFFER,K.COLOR_ATTACHMENT0,K.TEXTURE_2D,ei.__webglTexture,me),gn?K.framebufferTextureLayer(K.DRAW_FRAMEBUFFER,K.COLOR_ATTACHMENT0,Hi.__webglTexture,Je,ct+ti):K.framebufferTexture2D(K.DRAW_FRAMEBUFFER,K.COLOR_ATTACHMENT0,K.TEXTURE_2D,Hi.__webglTexture,Je),me!==0?K.blitFramebuffer(mt,Ot,qe,Qe,ae,Ve,qe,Qe,K.COLOR_BUFFER_BIT,K.NEAREST):gn?K.copyTexSubImage3D(ot,Je,ae,Ve,ct+ti,mt,Ot,qe,Qe):K.copyTexSubImage2D(ot,Je,ae,Ve,mt,Ot,qe,Qe);nt.bindFramebuffer(K.READ_FRAMEBUFFER,null),nt.bindFramebuffer(K.DRAW_FRAMEBUFFER,null)}else gn?L.isDataTexture||L.isData3DTexture?K.texSubImage3D(ot,Je,ae,Ve,ct,qe,Qe,et,At,mn,Dt.data):q.isCompressedArrayTexture?K.compressedTexSubImage3D(ot,Je,ae,Ve,ct,qe,Qe,et,At,Dt.data):K.texSubImage3D(ot,Je,ae,Ve,ct,qe,Qe,et,At,mn,Dt):L.isDataTexture?K.texSubImage2D(K.TEXTURE_2D,Je,ae,Ve,qe,Qe,At,mn,Dt.data):L.isCompressedTexture?K.compressedTexSubImage2D(K.TEXTURE_2D,Je,ae,Ve,Dt.width,Dt.height,At,Dt.data):K.texSubImage2D(K.TEXTURE_2D,Je,ae,Ve,qe,Qe,At,mn,Dt);K.pixelStorei(K.UNPACK_ROW_LENGTH,an),K.pixelStorei(K.UNPACK_IMAGE_HEIGHT,It),K.pixelStorei(K.UNPACK_SKIP_PIXELS,Bi),K.pixelStorei(K.UNPACK_SKIP_ROWS,us),K.pixelStorei(K.UNPACK_SKIP_IMAGES,Zs),Je===0&&q.generateMipmaps&&K.generateMipmap(ot),nt.unbindTexture()},this.initRenderTarget=function(L){k.get(L).__webglFramebuffer===void 0&&Q.setupRenderTarget(L)},this.initTexture=function(L){L.isCubeTexture?Q.setTextureCube(L,0):L.isData3DTexture?Q.setTexture3D(L,0):L.isDataArrayTexture||L.isCompressedArrayTexture?Q.setTexture2DArray(L,0):Q.setTexture2D(L,0),nt.unbindTexture()},this.resetState=function(){U=0,Y=0,W=null,nt.reset(),Pe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return jr}get outputColorSpace(){return this._outputColorSpace}
4127set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=cn._getDrawingBufferColorSpace(e),t.unpackColorSpace=cn._getUnpackColorSpace()}}function Lm({className:n}){const e=E.useRef(null),t=E.useRef({scene:null,camera:null,renderer:null,mesh:null,uniforms:null,animationId:null,resizeObserver:null});return E.useEffect(()=>{if(!e.current)return;const i=e.current,r=t.current,l=` 4128 attribute vec3 position; 4129 void main() { 4130 gl_Position = vec4(position, 1.0); 4131 } 4132 `,u=` 4133 precision highp float; 4134 uniform vec2 resolution; 4135 uniform float time; 4136 uniform float xScale; 4137 uniform float yScale; 4138 uniform float distortion; 4139 4140 void main() { 4141 vec2 p = (gl_FragCoord.xy * 2.0 - resolution) / min(resolution.x, resolution.y); 4142 4143 float d = length(p) * distortion; 4144 4145 float rx = p.x * (1.0 + d); 4146 float gx = p.x; 4147 float bx = p.x * (1.0 - d); 4148 4149 float lightWave = 0.05 / abs(p.y + sin((rx + time) * xScale) * yScale); 4150 float whiteWave = 0.05 / abs(p.y + sin((gx + time) * xScale) * yScale); 4151 float darkWave = 0.05 / abs(p.y + sin((bx + time) * xScale) * yScale); 4152 4153 vec3 lightOrange = vec3(1.0, 0.62, 0.24); 4154 vec3 white = vec3(1.0, 0.98, 0.95); 4155 vec3 darkOrange = vec3(0.58, 0.18, 0.02); 4156 4157 vec3 color = lightOrange * lightWave + white * whiteWave + darkOrange * darkWave; 4158 color = clamp(color * 0.95, 0.0, 1.0); 4159 4160 gl_FragColor = vec4(color, 1.0); 4161 } 4162 `;r.scene=new X$,r.renderer=new oq({canvas:i,antialias:!0,alpha:!1}),r.renderer.setPixelRatio(Math.min(window.devicePixelRatio,2)),r.renderer.setClearColor(new _n(0)),r.camera=new hy(-1,1,1,-1,0,-1),r.uniforms={resolution:{value:[i.clientWidth||1,i.clientHeight||1]},time:{value:0},xScale:{value:1.05},yScale:{value:.55},distortion:{value:.08}};const h=[-1,-1,0,1,-1,0,-1,1,0,1,-1,0,-1,1,0,1,1,0],d=new gr(new Float32Array(h),3),p=new Xr;p.setAttribute("position",d);const m=new NC({vertexShader:l,fragmentShader:u,uniforms:r.uniforms,side:Rr});r.mesh=new Vr(p,m),r.scene.add(r.mesh);const g=()=>{if(!r.renderer||!r.uniforms)return;const _=i.parentElement??i,C=Math.max(1,_.clientWidth),w=Math.max(1,_.clientHeight);r.renderer.setSize(C,w,!1),r.uniforms.resolution.value=[C,w]};g();const b=()=>{r.uniforms&&(r.uniforms.time.value+=.01),r.renderer&&r.scene&&r.camera&&r.renderer.render(r.scene,r.camera),r.animationId=requestAnimationFrame(b)};b(),r.resizeObserver=new ResizeObserver(()=>g());const y=i.parentElement??i;return r.resizeObserver.observe(y),()=>{r.animationId&&cancelAnimationFrame(r.animationId),r.resizeObserver?.disconnect(),r.mesh&&(r.scene?.remove(r.mesh),r.mesh.geometry.dispose(),r.mesh.material instanceof ah&&r.mesh.material.dispose()),r.renderer?.dispose()}},[]),o.jsx("canvas",{ref:e,className:n??"absolute inset-0 h-full w-full block","aria-hidden":"true"})}const Hb="https://watch-server-production-c01b.up.railway.app/api",lq="https://image.tmdb.org/t/p/original",cq=[{title:"Pick a locked title",description:"Open any locked movie or series in PyroPlay."},{title:"Send $PYRO to that title wallet",description:"Each title has its own wallet so payment is easy to track."},{title:"Everyone gets access",description:"When the target is reached, the title unlocks for all users."},{title:"Paid tokens are burned",description:"After unlock, the paid $PYRO is removed from supply."}],uq=[{question:"Who gets access after a title is unlocked?",answer:"Everyone. One completed unlock opens that title for the full platform."},{question:"How is payment tracked?",answer:"Each title has a dedicated wallet address, so every transfer maps to that title."},{question:"What happens to the paid $PYRO?",answer:"Paid tokens are burned after the unlock is completed."},{question:"Why does burning matter?",answer:"It lowers supply over time and ties token use to real actions in the app."}],dq=[{title:"Pay once, everyone watches",description:"Unlocks are shared with the whole community."},{title:"Clear payment tracking",description:"A dedicated wallet per title keeps the flow transparent."},{title:"Burn linked to usage",description:"When people unlock content, supply is reduced."}],hq=[{label:"1. Choose",title:"A user picks a locked title",copy:"Any locked movie or series can be selected for unlock."},{label:"2. Pay",title:"Contributor sends $PYRO",copy:"Payment goes to that title wallet and counts toward the goal."},{label:"3. Unlock",title:"Title opens for everyone",copy:"When paid in full, all users can stream it right away."},{label:"4. Burn",title:"$PYRO is burned",copy:"The completed payment amount is removed from supply."}],fq=async()=>{const n=[`${Hb}/token/supply`,`${Hb}/api/token/supply`];for(const e of n){const t=await fetch(e);if(t.ok)return await t.json();if(t.status!==404)throw new Error(`Token supply endpoint failed with status ${t.status}`)}throw new Error("Token supply endpoint failed with status 404")};function pq(){const[n,e]=E.useState([]),[t,i]=Ki(),[r,l]=E.useState({unlockedTitles:null,totalBurned:null});E.useEffect(()=>{const b=new AbortController;return(async()=>{try{const C=await(await fetch(`${Hb}/movies/trending`,{signal:b.signal})).json();Array.isArray(C?.results)&&e(C.results)}catch(_){if(_ instanceof DOMException&&_.name==="AbortError")return;console.error("Failed to load trending movies for token page:",_)}})(),()=>{b.abort()}},[]),E.useEffect(()=>{(async()=>{try{const[y,_,C]=await Promise.all([Fe?Fe.from("movie_wallets_public").select("is_paid").eq("is_paid",!0):Promise.resolve({data:[],error:null}),Fe?Fe.from("tv_wallets_public").select("is_paid").eq("is_paid",!0):Promise.resolve({data:[],error:null}),fq()]);if(y.error)throw y.error;if(_.error)throw _.error;const w=y.data||[],S=_.data||[];l({unlockedTitles:w.length+S.length,totalBurned:Number(C.burned_supply||0)})}catch(y){console.error("Failed to load live token stats:",y)}})()},[]);const u=E.useMemo(()=>n.filter(b=>!!b.backdrop_path).slice(0,24).map(b=>({id:b.id,title:b.title||b.name||b.original_title||`Title ${b.id}`,image:`${lq}${b.backdrop_path}`,logo:b.logoUrl||null})),[n]),h=u[0]?.image,d=E.useMemo(()=>r.totalBurned===null?"--":new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(r.totalBurned),[r.totalBurned]),p=b=>{const y=b%12;return y===0||y===7?"sm:col-span-2 md:col-span-2 md:row-span-2":y===3||y===10?"md:row-span-2":""},m=b=>{const y=b%12;return y===0||y===7?"h-56 md:h-full":y===3||y===10?"h-44 md:h-full":"h-36 md:h-40"},g=b=>{const y=new URLSearchParams(t);y.set("watch",`movie-${b}`),i(y)};return o.jsxs("main",{className:"min-h-screen bg-zinc-950 text-white animate-fade-in",children:[o.jsxs("section",{className:"relative overflow-hidden border-b border-white/10 pt-24 md:pt-28",children:[o.jsx(Lm,{className:"absolute inset-0 h-full w-full"}),h&&o.jsx("img",{src:h,alt:"Trending title backdrop",className:"absolute inset-0 h-full w-full object-cover opacity-30",loading:"lazy"}),o.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[linear-gradient(180deg,rgba(4,4,5,0.68)_0%,rgba(9,9,11,0.82)_60%,rgba(17,17,19,0.9
41626)_100%)]"}),o.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_18%_12%,rgba(226,94,12,0.36),transparent_34%),radial-gradient(circle_at_82%_14%,rgba(250,204,21,0.17),transparent_30%),radial-gradient(circle_at_52%_82%,rgba(249,115,22,0.14),transparent_36%)]"}),o.jsx("div",{className:"pointer-events-none absolute -left-24 top-20 h-72 w-72 rounded-full bg-[#E25E0C]/15 blur-3xl motion-safe:animate-token-float"}),o.jsx("div",{className:"pointer-events-none absolute right-0 top-24 h-64 w-64 rounded-full bg-amber-400/10 blur-3xl motion-safe:animate-token-pulse"}),o.jsxs("div",{className:"relative mx-auto max-w-6xl px-4 md:px-12 pb-20 pt-12 md:pb-24 md:pt-16 motion-safe:animate-token-reveal",children:[o.jsxs("div",{className:"grid gap-6 md:gap-8 lg:grid-cols-[1.15fr_0.85fr] lg:items-end",children:[o.jsxs("div",{children:[o.jsx("p",{className:"inline-flex rounded-full border border-orange-300/40 bg-orange-400/10 px-3 py-1 text-[11px] font-semibold uppercase tracking-[0.2em] text-orange-200",children:"PyroPlay Token Utility"}),o.jsxs("h1",{className:"mt-5 max-w-4xl text-4xl font-black leading-[0.94] tracking-tight md:text-7xl",children:["Unlock movies",o.jsx("span",{className:"block text-[#ffb078]",children:"with $PYRO"})]}),o.jsx("p",{className:"mt-6 max-w-2xl text-base leading-relaxed text-zinc-200 md:text-lg",children:"It is simple: users pay to unlock a title, everyone gets access, and the paid tokens are burned."}),o.jsxs("div",{className:"mt-8 flex flex-col gap-3 sm:flex-row sm:flex-wrap",children:[o.jsx(Ut,{to:"/movies",className:"w-full rounded-md bg-[#E25E0C] px-5 py-3 text-center text-sm font-bold transition hover:bg-[#ff7a27] sm:w-auto",children:"Watch NOW"}),o.jsx("a",{href:"https://pump.fun/coin/14qW8bcMkmHQtgJ8VohkR4FXiuYWqvLy4AtpGbuDpyro",target:"_blank",rel:"noreferrer",className:"w-full rounded-md border border-[#E25E0C]/45 bg-black/45 px-5 py-3 text-center text-sm font-semibold text-zinc-100 transition hover:bg-black/65 sm:w-auto",children:o.jsxs("span",{className:"inline-flex items-center justify-center gap-2",children:[o.jsx("img",{src:"/pumpfun.png",alt:"Pump.fun",className:"h-4 w-4 rounded-sm object-cover",loading:"lazy"}),"Buy $PYRO"]})})]})]}),o.jsxs("aside",{className:"rounded-2xl border border-orange-300/25 bg-black/45 p-6 backdrop-blur-sm motion-safe:animate-token-reveal [animation-delay:120ms]",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.16em] text-orange-200/80",children:"Live Signals"}),o.jsxs("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2",children:[o.jsxs("div",{className:"rounded-xl border border-white/10 bg-zinc-900/70 p-4",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.12em] text-zinc-400",children:"Movies + Series Unlocked"}),o.jsx("p",{className:"mt-2 text-2xl font-black text-white",children:r.unlockedTitles??"--"})]}),o.jsxs("div",{className:"rounded-xl border border-white/10 bg-zinc-900/70 p-4",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.12em] text-zinc-400",children:"Total Tokens Burned"}),o.jsx("p",{className:"mt-2 text-2xl font-black text-white",children:d})]})]})]})]}),o.jsx("div",{className:"mt-10 grid max-w-4xl grid-cols-1 gap-3 sm:grid-cols-3 motion-safe:animate-token-reveal [animation-delay:200ms]",children:o.jsxs("div",{className:"rounded-xl border border-white/15 bg-black/35 p-4",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.16em] text-zinc-400",children:"Model"}),o.jsx("p",{className:"mt-2 text-lg font-extrabold",children:"Pay Once, Watch Together"})]})})]})]}),u.length>0&&o.jsxs("section",{className:"relative px-4 py-12 md:px-12 md:py-14 motion-safe:animate-token-reveal [animation-delay:260ms]",children:[o.jsxs("div",{className:"mx-auto mb-8 flex max-w-6xl flex-col items-start justify-between gap-3 sm:flex-row sm:items-end",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.16em] text-zinc-400",children:"Trending Visuals"}),o.jsx("h2",{className:"mt-2 text-2xl font-black tracking-tight md:text-4xl",children:"What people are watching now"})]}),o.jsx(Ut,{to:"/movies",className:"text-sm font-semibold text-orange-300 transition hover:text-orange-200",children:"View all movies"})]}),o.jsx("div",{className:"grid auto-rows-[8.5rem] grid-cols-1 gap-3 min-[460px]:grid-cols-2 sm:auto-rows-[9rem] sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8",children:u.map((b,y)=>o.jsxs("article",{className:`group cursor-pointer relative overflow-hidden rounded-2xl border border-white/12 bg-zinc-900/70 ${p(y)}`,role:"button",tabIndex:0,onClick:()=>g(b.id),onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),g(b.id))},style:{animationDelay:`${y%10*70}ms`},children:[o.jsx("img",{src:b.image,alt:`${b.title} backdrop`,className:`${m(y)} w-full object-cover transition-transform duration-500 group-hover:scale-110`,loading:"lazy"}),o.jsx("div",{className:"absolute inset-0 bg-linear-to-t from-black/75 via-black/20 to-transparent"}),o.jsxs("button",{type:"button",onClick:_=>{_.stopPropagation(),g(b.id)},className:"absolute inset-x-2 bottom-2 inline-flex items-center justify-center gap-2 rounded-md border border-white/35 bg-black/70 px-3 py-2 text-xs font-semibold text-white opacity-100 transition duration-200 sm:opacity-0 sm:group-hover:opacity-100 sm:focus:opacity-100","aria-label":`Open details for ${b.title}`,children:[o.jsx(Ts,{className:"h-3.5 w-3.5 fill-white"}),"Play"]}),b.logo?o.jsx("img",{src:b.logo,alt:`${b.title} logo`,className:"absolute bottom-12 left-2 max-h-9 max-w-[75%] object-contain drop-shadow-[0_6px_12px_rgba(0,0,0,0.7)] transition group-hover:opacity-90 md:max-h-10",loading:"lazy"}):o.jsx("p",{className:"absolute bottom-12 left-2 right-2 line-clamp-2 text-xs font-semibold text-zinc-100 drop-shadow-md",children:b.title})]},b.id))})]}),o.jsxs("section",{className:"relative mx-auto max-w-6xl px-4 py-16 md:px-12 md:py-20",children:[o.jsxs("div",{className:"mb-10 grid gap-4 md:grid-cols-2 md:items-end motion-safe:animate-token-reveal [animation-delay:320ms]",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.16em] text-zinc-400",children:"Why This System"}),o.jsx("h2",{className:"mt-2 text-3xl font-black tracking-tight md:text-5xl",children:"Why this works"})]}),o.jsx("p",{className:"max-w-xl text-sm leading-relaxed text-zinc-300 md:text-base",children:"The value is easy to follow: pay for a title, unlock it for everyone, then burn the tokens used."})]}),o.jsx("div",{className:"grid gap-4 md:grid-cols-3",children:dq.map(b=>o.jsxs("article",{className:"rounded-2xl border border-white/12 bg-zinc-900/60 p-5 md:p-6",children:[o.jsx("h3",{className:"text-lg font-extrabold",children:b.title}),o.jsx("p",{className:"mt-2 leading-relaxed text-zinc-300",children:b.description})]},b.title))})]}),o.jsx("section",{className:"relative border-y border-white/10 bg-linear-to-r from-[#160b05] via-[#261108] to-[#120f0
4162d] motion-safe:animate-token-reveal [animation-delay:380ms]",children:o.jsxs("div",{className:"mx-auto grid max-w-6xl grid-cols-1 items-start gap-8 px-4 py-14 md:px-12 md:py-16 lg:grid-cols-[1.05fr_0.95fr]",children:[o.jsxs("article",{children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.16em] text-orange-200/80",children:"Economic Loop"}),o.jsx("h2",{className:"mt-2 text-3xl font-black tracking-tight md:text-5xl",children:"From payment to public access"}),o.jsx("p",{className:"mt-4 max-w-xl leading-relaxed text-zinc-200",children:"A user contributes, the title unlocks for everyone, then the payment is burned."}),o.jsx("div",{className:"mt-6 inline-flex items-center rounded-full border border-orange-300/45 bg-orange-400/10 px-4 py-2 text-sm font-semibold text-orange-100",children:"User transfer -> Unlock event -> Burn event"})]}),o.jsx("article",{className:"rounded-2xl border border-orange-300/30 bg-black/35 p-6",children:o.jsx("div",{className:"space-y-4",children:hq.map(b=>o.jsxs("div",{className:"rounded-xl border border-white/10 bg-zinc-900/55 p-4",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.13em] text-orange-200/85",children:b.label}),o.jsx("h3",{className:"mt-1 text-base font-bold text-white md:text-lg",children:b.title}),o.jsx("p",{className:"mt-1 text-sm leading-relaxed text-zinc-300",children:b.copy})]},b.label))})})]})}),o.jsxs("section",{className:"relative mx-auto max-w-6xl px-4 py-16 md:px-12 md:py-20 motion-safe:animate-token-reveal [animation-delay:430ms]",children:[o.jsxs("div",{className:"mb-10",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.16em] text-zinc-400",children:"How It Works"}),o.jsx("h2",{className:"mt-2 text-3xl font-black tracking-tight md:text-5xl",children:"How unlocks happen"})]}),o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"absolute bottom-1 left-4 top-1 w-px bg-linear-to-b from-[#E25E0C] via-orange-300/50 to-transparent md:left-6"}),o.jsx("div",{className:"space-y-7",children:cq.map((b,y)=>o.jsxs("article",{className:"relative pl-12 md:pl-16",children:[o.jsx("span",{className:"absolute left-0 top-1.5 inline-flex h-8 w-8 items-center justify-center rounded-full border border-orange-300/50 bg-zinc-900 text-sm font-bold text-orange-200 md:left-1",children:y+1}),o.jsxs("div",{className:"rounded-2xl border border-white/12 bg-zinc-900/60 p-5 md:p-6",children:[o.jsx("h3",{className:"text-lg font-extrabold md:text-xl",children:b.title}),o.jsx("p",{className:"mt-2 leading-relaxed text-zinc-300",children:b.description})]})]},b.title))})]})]}),o.jsxs("section",{className:"mx-auto max-w-6xl px-4 py-16 md:px-12 md:py-20 motion-safe:animate-token-reveal [animation-delay:500ms]",children:[o.jsxs("div",{className:"mb-8",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.16em] text-zinc-400",children:"FAQ"}),o.jsx("h2",{className:"mt-2 text-3xl font-black tracking-tight md:text-5xl",children:"Straight answers"})]}),o.jsx("div",{className:"space-y-3",children:uq.map(b=>o.jsxs("article",{className:"rounded-xl border border-white/12 bg-zinc-900/60 p-5 md:p-6",children:[o.jsx("h3",{className:"text-lg font-bold text-white",children:b.question}),o.jsx("p",{className:"mt-2 leading-relaxed text-zinc-300",children:b.answer})]},b.question))}
4162),o.jsxs("div",{className:"mt-10 flex flex-col gap-4 rounded-2xl border border-white/15 bg-zinc-900/70 p-6 md:flex-row md:items-center md:justify-between md:p-8",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xl font-black tracking-tight md:text-2xl",children:"Ready to unlock the next title?"}),o.jsx("p",{className:"mt-1 text-zinc-300",children:"Open a locked movie or series and trigger the next community unlock."})]}),o.jsx(Ut,{to:"/movies",className:"inline-flex items-center justify-center rounded-md bg-[#E25E0C] px-5 py-3 text-sm font-bold transition hover:bg-[#ff7a27]",children:"Start Unlocking"})]})]})]})}const Jx="https://watch-server-production-c01b.up.railway.app/api",e1="C1BFNrqT4wLY8fE3yRkADisY5aJV8xLA315VF7GwQpcv";function mq(){const[n,e]=Ki(),[t,i]=E.useState(!1),[r,l]=E.useState(!1),[u,h]=E.useState(!1),[d,p]=E.useState(!1),[m,g]=E.useState(null),[b,y]=E.useState(null),[_,C]=E.useState(""),[w,S]=E.useState({}),T=E.useMemo(()=>{if(!m)return[];if(Array.isArray(m.unlocked_media)&&m.unlocked_media.length>0)return m.unlocked_media;const P=(m.unlocked_movies||[]).map(U=>({media_id:U.movie_id,media_title:U.movie_title,watch_param:U.watch_param,media_type:"movie"})),G=(m.unlocked_series||[]).map(U=>({media_id:U.tv_id,media_title:U.tv_title,watch_param:U.watch_param,media_type:"tv"}));return[...P,...G]},[m]),N=!!e1,j=E.useMemo(()=>m?.burn_signature?`https://solscan.io/tx/${m.burn_signature}`:"",[m?.burn_signature]),O=async()=>{try{await navigator.clipboard.writeText(e1),l(!0),setTimeout(()=>l(!1),1500)}catch(P){console.error("Failed to copy wallet address:",P)}},R=async()=>{i(!0),C(""),g(null),S({});const P=async G=>{if(G.length!==0){h(!0);try{const U=await fetch(`${Jx}/movies/get-images?movies=${G.join(",")}`);if(!U.ok)throw new Error("Failed to fetch movie backdrops");const J=((await U.json())?.results||[]).reduce((F,$)=>($?.movie_id&&$?.backdrop_url&&(F[`movie-${$.movie_id}`]=$.backdrop_url),F),{});S(J)}catch(U){console.error("Failed to load unlocked movie backdrops:",U)}finally{h(!1)}}};try{const G=await fetch(`${Jx}/unlock-random-movies`,{method:"POST",headers:{"Content-Type":"application/json"}}),U=await G.json();if(!G.ok)throw new Error(U?.error||"Failed to unlock random content");g(U);const Y=(U.unlocked_media||[]).filter(W=>W.media_type==="movie").map(W=>W.media_id);if(Y.length===0){const W=(U.unlocked_movies||[]).map(J=>J.movie_id);P(W)}else P(Y)}catch(G){C(G instanceof Error?G.message:"Failed to unlock random content")}finally{i(!1)}},z=async()=>{p(!0),C("");try{const P=await fetch(`${Jx}/community-wallet/balance`),G=await P.json();if(!P.ok)throw new Error(G?.error||"Failed to check wallet balance");y(G)}catch(P){C(P instanceof Error?P.message:"Failed to check wallet balance")}finally{p(!1)}},M=P=>{const G=new URLSearchParams(n);G.set("watch",P),e(G)};return o.jsx("main",{className:"min-h-screen bg-zinc-950 px-4 pb-16 pt-28 text-white md:px-12",children:o.jsx("section",{className:"mx-auto max-w-5xl",children:o.jsxs("div",{className:"rounded-3xl border border-white/10 bg-[radial-gradient(circle_at_top_left,rgba(226,94,12,0.2),transparent_45%),radial-gradient(circle_at_bottom_right,rgba(251,146,60,0.1),transparent_50%),rgba(24,24,27,0.8)] p-6 shadow-2xl backdrop-blur md:p-8",children:[o.jsxs("p",{className:"inline-flex items-center gap-2 rounded-full border border-orange-300/30 bg-orange-400/10 px-3 py-1 text-xs font-semibold uppercase tracking-[0.16em] text-orange-200",children:[o.jsx(gR,{className:"h-3.5 w-3.5"}),"Community Unlock Pool"]}),o.jsx("h1",{className:"mt-4 text-3xl font-black tracking-tight md:text-5xl",children:"Deposit to unlock random content"}),o.jsx("p",{className:"mt-4 max-w-3xl text-sm leading-relaxed text-zinc-300 md:text-base",children:"Send $PYRO to the community wallet below. After funds land, trigger random unlocks to open movies and series for everyone."}),o.jsxs("div",{className:"mt-8 grid gap-4 md:grid-cols-2",children:[o.jsxs("div",{className:"rounded-2xl border border-white/10 bg-black/35 p-4",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.14em] text-zinc-400",children:"Step 1"}),o.jsxs("h2",{className:"mt-2 flex items-center gap-2 text-lg font-bold",children:[o.jsx(M3,{className:"h-4 w-4 text-orange-300"}),"Deposit wallet"]}),o.jsx("div",{className:"mt-3 rounded-xl border border-white/10 bg-zinc-900/70 p-3",children:o.jsx("p",{className:"break-all font-mono text-xs text-zinc-200",children:e1})}),o.jsxs("button",{type:"button",onClick:O,disabled:!N,className:"mt-3 inline-flex items-center gap-2 rounded-md border border-white/15 bg-zinc-900 px-3 py-2 text-xs font-semibold text-zinc-100 transition hover:border-white/30 hover:bg-zinc-800 disabled:cursor-not-allowed disabled:opacity-50",children:[o.jsx(Wc,{className:"h-3.5 w-3.5"}),r?"Copied":"Copy wallet"]})]}),o.jsxs("div",{className:"rounded-2xl border border-white/10 bg-black/35 p-4",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.14em] text-zinc-400",children:"Step 2"}),o.jsxs("h2",{className:"mt-2 flex items-center gap-2 text-lg font-bold",children:[o.jsx(x1,{className:"h-4 w-4 text-orange-300"}),"Trigger random unlocks"]}),o.jsx("p",{className:"mt-3 text-xs text-zinc-300",children:"Anyone can click the button below to attempt a random unlock from the community pool."}),o.jsxs("button",{type:"button",onClick:z,disabled:d,className:"mt-3 inline-flex w-full items-center justify-center gap-2 rounded-md border border-white/20 bg-zinc-900 px-4 py-2.5 text-sm font-semibold text-zinc-100 transition hover:border-white/35 hover:bg-zinc-800 disabled:cursor-not-allowed disabled:opacity-60",children:[d?o.jsx(fr,{className:"h-4 w-4 animate-spin"}):o.jsx(M3,{className:"h-4 w-4"}),d?"Checking balance...":"Check Community Balance"]}),o.jsxs("button",{type:"button",onClick:R,disabled:t,className:"mt-3 inline-flex w-full items-center justify-center gap-2 rounded-md bg-[#E25E0C] px-4 py-2.5 text-sm font-bold transition hover:bg-[#ff7a27] disabled:cursor-not-allowed disabled:opacity-60",children:[t?o.jsx(fr,{className:"h-4 w-4 animate-spin"}):o.jsx(x1,{className:"h-4 w-4"}),t?"Unlocking...":"Unlock Random Content"]}),b&&o.jsxs("div",{className:"mt-3 rounded-lg border border-white/10 bg-zinc-900/65 p-3",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.12em] text-zinc-400",children:"Community Wallet Status"}),o.jsxs("p",{className:"mt-2 text-sm text-zinc-100",children:["Balance: ",o.jsx("span",{className:"font-semibold",children:Number(b.balance||0).toLocaleStr
4162ing()})]}),o.jsxs("p",{className:"mt-1 text-xs text-zinc-300",children:["Unlock price: ",Number(b.unlock_price||0).toLocaleString()," | Unlockable now: ",b.unlockable_now]}),o.jsx("p",{className:`mt-2 text-xs font-semibold ${b.can_unlock_more?"text-emerald-300":"text-amber-300"}`,children:b.can_unlock_more?"Enough balance to unlock more content.":"Not enough balance to unlock more content yet."})]})]})]}),_&&o.jsx("div",{className:"mt-4 rounded-xl border border-red-400/35 bg-red-500/10 px-4 py-3 text-sm text-red-200",children:_}),m&&o.jsxs("div",{className:"mt-5 rounded-2xl border border-emerald-300/25 bg-emerald-500/10 p-4",children:[o.jsx("p",{className:"text-sm font-semibold text-emerald-200",children:"Unlock complete"}),o.jsxs("p",{className:"mt-1 text-sm text-zinc-200",children:["Burned amount: ",o.jsx("span",{className:"font-semibold text-white",children:Number(m.burned_amount||0).toLocaleString()})]}),j&&o.jsx("a",{href:j,target:"_blank",rel:"noreferrer",className:"mt-2 inline-flex text-xs font-semibold text-emerald-300 hover:text-emerald-200",children:"View burn transaction"}),o.jsxs("div",{className:"mt-3",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.12em] text-zinc-300",children:"Unlocked content"}),T.length>0?o.jsx("div",{className:"mt-3 grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:T.map(P=>{const G=P.media_type==="movie"?w[`movie-${P.media_id}`]:void 0,U=P.watch_param||`${P.media_type}-${P.media_id}`;return o.jsx("article",{className:"overflow-hidden rounded-lg border border-white/10 bg-black/35 transition hover:border-orange-300/45",children:o.jsxs("button",{type:"button",onClick:()=>M(U),className:"block w-full text-left",children:[G?o.jsx("img",{src:G,alt:`${P.media_title} backdrop`,className:"h-24 w-full object-cover",loading:"lazy"}):o.jsx("div",{className:"h-24 w-full bg-[linear-gradient(135deg,#27272a,#18181b)]"}),o.jsx("div",{className:"px-3 py-2 text-sm text-zinc-100",children:P.media_title}),o.jsx("div",{className:"px-3 pb-2 text-[11px] uppercase tracking-[0.14em] text-zinc-400",children:P.media_type==="tv"?"Series":"Movie"})]})},`${P.media_type}-${P.media_id}`)})}):o.jsx("p",{className:"mt-2 text-sm text-zinc-300",children:"No unpaid movies or series were available to unlock."}),u&&T.some(P=>P.media_type==="movie")&&o.jsx("p",{className:"mt-2 text-xs text-zinc-400",children:"Loading backdrops..."})]})]}),o.jsxs("div",{className:"mt-8 flex flex-wrap gap-3",children:[o.jsx(Ut,{to:"/movies",className:"rounded-md border border-white/20 px-4 py-2 text-sm font-semibold text-zinc-100 transition hover:bg-white/10",children:"Browse movies"}),o.jsx(Ut,{to:"/unlocked",className:"rounded-md border border-orange-300/35 bg-orange-400/10 px-4 py-2 text-sm font-semibold text-orange-200 transition hover:bg-orange-400/20",children:"View unlocked library"})]})]})})})}const qr=Object.create(null);qr.open="0";qr.close="1";qr.ping="2";qr.pong="3";qr.message="4";qr.upgrade="5";qr.noop="6";const Mp=Object.create(null);Object.keys(qr).forEach(n=>{Mp[qr[n]]=n});const Vb={type:"error",data:"parser error"},PC=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",OC=typeof ArrayBuffer=="function",DC=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,fy=({type:n,data:e},t,i)=>PC&&e instanceof Blob?t?i(e):GE(e,i):OC&&(e instanceof ArrayBuffer||DC(e))?t?i(e):GE(new Blob([e]),i):i(qr[n]+(e||"")),GE=(n,e)=>{const t=new FileReader;return t.onload=function(){const i=t.result.split(",")[1];e("b"+(i||""))},t.readAsDataURL(n)};function qE(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let t1;function gq(n,e){if(PC&&n.data instanceof Blob)return n.data.arrayBuffer().then(qE).then(e);if(OC&&(n.data instanceof ArrayBuffer||DC(n.data)))return e(qE(n.data));fy(n,!1,t=>{t1||(t1=new TextEncoder),e(t1.encode(t))})}const WE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vd=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<WE.length;
vendor: 4,877 bytes, line 4162
4162n++)vd[WE.charCodeAt(n)]=n;const xq=n=>{let e=n.length*.75,t=n.length,i,r=0,l,u,h,d;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const p=new ArrayBuffer(e),m=new Uint8Array(p);for(i=0;i<t;i+=4)l=vd[n.charCodeAt(i)],u=vd[n.charCodeAt(i+1)],h=vd[n.charCodeAt(i+2)],d=vd[n.charCodeAt(i+3)],m[r++]=l<<2|u>>4,m[r++]=(u&15)<<4|h>>2,m[r++]=(h&3)<<6|d&63;return p},bq=typeof ArrayBuffer=="function",py=(n,e)=>{if(typeof n!="string")return{type:"message",data:UC(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:vq(n.substring(1),e)}:Mp[t]?n.length>1?{type:Mp[t],data:n.substring(1)}:{type:Mp[t]}:Vb},vq=(n,e)=>{if(bq){const t=xq(n);return UC(t,e)}else return{base64:!0,data:n}},UC=(n,e)=>e==="blob"?n instanceof Blob?n:new Blob([n]):n instanceof ArrayBuffer?n:n.buffer,IC="�",yq=(n,e)=>{const t=n.length,i=new Array(t);let r=0;n.forEach((l,u)=>{fy(l,!1,h=>{i[u]=h,++r===t&&e(i.join(IC))})})},_q=(n,e)=>{const t=n.split(IC),i=[];for(let r=0;r<t.length;r++){const l=py(t[r],e);if(i.push(l),l.type==="error")break}return i};function wq(){return new TransformStream({transform(n,e){gq(n,t=>{const i=t.length;let r;if(i<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,i);else if(i<65536){r=new Uint8Array(3);const l=new DataView(r.buffer);l.setUint8(0,126),l.setUint16(1,i)}else{r=new Uint8Array(9);const l=new DataView(r.buffer);l.setUint8(0,127),l.setBigUint64(1,BigInt(i))}n.data&&typeof n.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let n1;function hp(n){return n.reduce((e,t)=>e+t.length,0)}function fp(n,e){if(n[0].length===e)return n.shift();const t=new Uint8Array(e);let i=0;for(let r=0;r<e;r++)t[r]=n[0][i++],i===n[0].length&&(n.shift(),i=0);return n.length&&i<n[0].length&&(n[0]=n[0].slice(i)),t}function Sq(n,e){n1||(n1=new TextDecoder);const t=[];let i=0,r=-1,l=!1;return new TransformStream({transform(u,h){for(t.push(u);;){if(i===0){if(hp(t)<1)break;const d=fp(t,1);l=(d[0]&128)===128,r=d[0]&127,r<126?i=3:r===126?i=1:i=2}else if(i===1){if(hp(t)<2)break;const d=fp(t,2);r=new DataView(d.buffer,d.byteOffset,d.length).getUint16(0),i=3}else if(i===2){if(hp(t)<8)break;const d=fp(t,8),p=new DataView(d.buffer,d.byteOffset,d.length),m=p.getUint32(0);if(m>Math.pow(2,21)-1){h.enqueue(Vb);break}r=m*Math.pow(2,32)+p.getUint32(4),i=3}else{if(hp(t)<r)break;const d=fp(t,r);h.enqueue(py(l?d:n1.decode(d),e)),i=0}if(r===0||r>n){h.enqueue(Vb);break}}}})}const zC=4;function ui(n){if(n)return Eq(n)}function Eq(n){for(var e in ui.prototype)n[e]=ui.prototype[e];return n}ui.prototype.on=ui.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};ui.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this};ui.prototype.off=ui.prototype.removeListener=ui.prototype.removeAllListeners=ui.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var i,r=0;r<t.length;r++)if(i=t[r],i===e||i.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+n],this};ui.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(t){t=t.slice(0);for(var i=0,r=t.length;i<r;++i)t[i].apply(this,e)}return this};ui.prototype.emitReserved=ui.prototype.emit;ui.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};ui.prototype.hasListeners=function(n){return!!this.listeners(n).length};const Pm=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),qs=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Cq="arraybuffer";function $C(n,...e){return e.reduce((t,i)=>(n.hasOwnProperty(i)&&(t[i]=n[i]),t),{})}const Nq=qs.setTimeout,Tq=qs.clearTimeout;function Om(n,e){e.useNativeTimers?(n.setTimeoutFn=Nq.bind(qs),n.clearTimeoutFn=Tq.bind(qs)):(n.setTimeoutFn=qs.setTimeout.bind(qs),n.clearTimeoutFn=qs.clearTimeout.bind(qs))}const Mq=1.33;function Aq(n){return typeof n=="string"?Rq(n):Math.ceil((n.byteLength||n.size)*Mq)}function Rq(n){let e=0,t=0;for(let i=0,r=n.length;i<r;i++)e=n.charCodeAt(i),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(i++,t+=4);return t}function FC(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function kq(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function jq(n){let e={},t=n.split("&");for(let i=0,r=t.length;i<r;i++){let l=t[i].split("=");e[decodeURIComponent(l[0])]=decodeURIComponent(l[1])}return e}
vendor: 6,199 bytes, line 4162
4162class Lq extends Error{constructor(e,t,i){super(e),this.description=t,this.context=i,this.type="TransportError"}}class my extends ui{constructor(e){super(),this.writable=!1,Om(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,i){return super.emitReserved("error",new Lq(e,t,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=py(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=kq(e);return t.length?"?"+t:""}}class Pq extends my{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||t()})),this.writable||(i++,this.once("drain",function(){--i||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};_q(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,yq(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=FC()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let BC=!1;try{BC=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Oq=BC;function Dq(){}class Uq extends Pq{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let i=location.port;i||(i=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,t){const i=this.request({method:"POST",data:e});i.on("success",t),i.on("error",(r,l)=>{this.onError("xhr post error",r,l)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,i)=>{this.onError("xhr poll error",t,i)}),this.pollXhr=e}}class Ir extends ui{constructor(e,t,i){super(),this.createRequest=e,Om(this,i),this._opts=i,this._method=i.method||"GET",this._uri=t,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var e;const t=$C(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(t);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&i.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var r;i.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=Ir.requestsCount++,Ir.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Dq,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Ir.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Ir.requestsCount=0;Ir.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",XE);else if(typeof addEventListener=="function"){const n="onpagehide"in qs?"pagehide":"unload";addEventListener(n,XE,!1)}}function XE(){for(let n in Ir.requests)Ir.requests.hasOwnProperty(n)&&Ir.requests[n].abort()}const Iq=(function(){const n=HC({xdomain:!1});return n&&n.responseType!==null})();class zq extends Uq{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Iq&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Ir(HC,this.uri(),e)}}function HC(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Oq))return new XMLHttpRequest}catch{}if(!e)try{return new qs[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const VC=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class $q extends my{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,i=VC?{}:$C(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,i)}catch(r){return this.emitReserved("error",r)}
vendor: 17,830 bytes, line 4162
4162this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const i=e[t],r=t===e.length-1;fy(i,this.supportsBinary,l=>{try{this.doWrite(i,l)}catch{}r&&Pm(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=FC()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const i1=qs.WebSocket||qs.MozWebSocket;class Fq extends $q{createSocket(e,t,i){return VC?new i1(e,t,i):t?new i1(e,t):new i1(e)}doWrite(e,t){this.ws.send(t)}}class Bq extends my{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=Sq(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(t).getReader(),r=wq();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const l=()=>{i.read().then(({done:h,value:d})=>{h||(this.onPacket(d),l())}).catch(h=>{})};l();const u={type:"open"};this.query.sid&&(u.data=`{"sid":"${this.query.sid}"}`),this._writer.write(u).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const i=e[t],r=t===e.length-1;this._writer.write(i).then(()=>{r&&Pm(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Hq={websocket:Fq,webtransport:Bq,polling:zq},Vq=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Gq=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Gb(n){if(n.length>8e3)throw"URI too long";const e=n,t=n.indexOf("["),i=n.indexOf("]");t!=-1&&i!=-1&&(n=n.substring(0,t)+n.substring(t,i).replace(/:/g,";")+n.substring(i,n.length));let r=Vq.exec(n||""),l={},u=14;for(;u--;)l[Gq[u]]=r[u]||"";return t!=-1&&i!=-1&&(l.source=e,l.host=l.host.substring(1,l.host.length-1).replace(/;/g,":"),l.authority=l.authority.replace("[","").replace("]","").replace(/;/g,":"),l.ipv6uri=!0),l.pathNames=qq(l,l.path),l.queryKey=Wq(l,l.query),l}function qq(n,e){const t=/\/{2,9}/g,i=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function Wq(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,r,l){r&&(t[r]=l)}),t}const qb=typeof addEventListener=="function"&&typeof removeEventListener=="function",Ap=[];qb&&addEventListener("offline",()=>{Ap.forEach(n=>n())},!1);class yo extends ui{constructor(e,t){if(super(),this.binaryType=Cq,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const i=Gb(e);t.hostname=i.host,t.secure=i.protocol==="https"||i.protocol==="wss",t.port=i.port,i.query&&(t.query=i.query)}else t.host&&(t.hostname=Gb(t.host).host);Om(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(i=>{const r=i.prototype.name;this.transports.push(r),this._transportsByName[r]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=jq(this.opts.query)),qb&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Ap.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=zC,t.transport=e,this.id&&(t.sid=this.id);const i=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&yo.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",yo.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let i=0;i<this.writeBuffer.length;i++){const r=this.writeBuffer[i].data;if(r&&(t+=Aq(r)),i>0&&t>this._maxPayload)return this.writeBuffer.slice(0,i);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Pm(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,i){return this._sendPacket("message",e,t,i),this}send(e,t,i){return this._sendPacket("message",e,t,i),this}_sendPacket(e,t,i,r){if(typeof t=="function"&&(r=t,t=void 0),typeof i=="function"&&(r=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const l={type:e,data:t,options:i};this.emitReserved("packetCreate",l),this.writeBuffer.push(l),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},i=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}_onError(e){if(yo.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),qb&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=Ap.indexOf(this._offlineEventListener);i!==-1&&Ap.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}yo.protocol=zC;class Xq extends yo{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),i=!1;yo.priorWebsocketSuccess=!1;const r=()=>{i||(t.send([{type:"ping",data:"probe"}]),t.once("packet",g=>{if(!i)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;yo.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(m(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const b=new Error("probe error");b.transport=t.name,this.emitReserved("upgradeError",b)}}))};function l(){i||(i=!0,m(),t.close(),t=null)}const u=g=>{const b=new Error("probe error: "+g);b.transport=t.name,l(),this.emitReserved("upgradeError",b)};function h(){u("transport closed")}function d(){u("socket closed")}function p(g){t&&g.name!==t.name&&l()}const m=()=>{t.removeListener("open",r),t.removeListener("error",u),t.removeListener("close",h),this.off("close",d),this.off("upgrading",p)};t.once("open",r),t.once("error",u),t.once("close",h),this.once("close",d),this.once("upgrading",p),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&t.push(e[i]);return t}}let Yq=class extends Xq{constructor(e,t={}){const i=typeof e=="object"?e:t;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(r=>Hq[r]).filter(r=>!!r)),super(e,i)}};function Kq(n,e="",t){let i=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),i=Gb(n)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const l=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+l+":"+i.port+e,i.href=i.protocol+"://"+l+(t&&t.port===i.port?"":":"+i.port),i}const Zq=typeof ArrayBuffer=="function",Qq=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,GC=Object.prototype.toString,Jq=typeof Blob=="function"||typeof Blob<"u"&&GC.call(Blob)==="[object BlobConstructor]",eW=typeof File=="function"||typeof File<"u"&&GC.call(File)==="[object FileConstructor]";function gy(n){return Zq&&(n instanceof ArrayBuffer||Qq(n))||Jq&&n instanceof Blob||eW&&n instanceof File}function Rp(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,i=n.length;t<i;t++)if(Rp(n[t]))return!0;return!1}if(gy(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return Rp(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&Rp(n[t]))return!0;return!1}function tW(n){const e=[],t=n.data,i=n;return i.data=Wb(t,e),i.attachments=e.length,{packet:i,buffers:e}}function Wb(n,e){if(!n)return n;if(gy(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let i=0;i<n.length;i++)t[i]=Wb(n[i],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=Wb(n[i],e));return t}return n}function nW(n,e){return n.data=Xb(n.data,e),delete n.attachments,n}function Xb(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=Xb(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=Xb(n[t],e));return n}const iW=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var nn;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(nn||(nn={}));class sW{constructor(e){this.replacer=e}encode(e){return(e.type===nn.EVENT||e.type===nn.ACK)&&Rp(e)?this.encodeAsBinary({type:e.type===nn.EVENT?nn.BINARY_EVENT:nn.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===nn.BINARY_EVENT||e.type===nn.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=tW(e),i=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(i),r}}class xy extends ui{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const i=t.type===nn.BINARY_EVENT;i||t.type===nn.BINARY_ACK?(t.type=i?nn.EVENT:nn.ACK,this.reconstructor=new rW(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(gy(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const i={type:Number(e.charAt(0))};if(nn[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===nn.BINARY_EVENT||i.type===nn.BINARY_ACK){const l=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const u=e.substring(l,t);if(u!=Number(u)||e.charAt(t)!=="-")throw new Error("Illegal attachments");i.attachments=Number(u)}if(e.charAt(t+1)==="/"){const l=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););i.nsp=e.substring(l,t)}else i.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const l=t+1;for(;++t;){const u=e.charAt(t);if(u==null||Number(u)!=u){--t;break}if(t===e.length)break}i.id=Number(e.substring(l,t+1))}if(e.charAt(++t)){const l=this.tryParse(e.substr(t));if(xy.isPayloadValid(i.type,l))i.data=l;else throw new Error("invalid payload")}return i}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case nn.CONNECT:return YE(t);case nn.DISCONNECT:return t===void 0;case nn.CONNECT_ERROR:return typeof t=="string"||YE(t);case nn.EVENT:case nn.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&iW.indexOf(t[0])===-1);case nn.ACK:case nn.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class rW{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=nW(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function YE(n){return Object.prototype.toString.call(n)==="[object Object]"}const aW=Object.freeze(Object.defineProperty({__proto__:null,Decoder:xy,Encoder:sW,get PacketType(){return nn}},Symbol.toStringTag,{value:"Module"}));function lr(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const oW=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class qC extends ui{constructor(e,t,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[lr(e,"open",this.onopen.bind(this)),lr(e,"packet",this.onpacket.b
vendor: 2,660 bytes, line 4162
4162ind(this)),lr(e,"error",this.onerror.bind(this)),lr(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var i,r,l;if(oW.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const u={type:nn.EVENT,data:t};if(u.options={},u.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const m=this.ids++,g=t.pop();this._registerAckCallback(m,g),u.id=m}const h=(r=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||r===void 0?void 0:r.writable,d=this.connected&&!(!((l=this.io.engine)===null||l===void 0)&&l._hasPingExpired());return this.flags.volatile&&!h||(d?(this.notifyOutgoingListeners(u),this.packet(u)):this.sendBuffer.push(u)),this.flags={},this}_registerAckCallback(e,t){var i;const r=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const l=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let h=0;h<this.sendBuffer.length;h++)this.sendBuffer[h].id===e&&this.sendBuffer.splice(h,1);t.call(this,new Error("operation has timed out"))},r),u=(...h)=>{this.io.clearTimeoutFn(l),t.apply(this,h)};u.withError=!0,this.acks[e]=u}emitWithAck(e,...t){return new Promise((i,r)=>{const l=(u,h)=>u?r(u):i(h);l.withError=!0,t.push(l),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...l)=>(this._queue[0],r!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...l)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:nn.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}
vendor: 7,049 bytes, line 4162
4162_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){const i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case nn.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case nn.EVENT:case nn.BINARY_EVENT:this.onevent(e);break;case nn.ACK:case nn.BINARY_ACK:this.onack(e);break;case nn.DISCONNECT:this.ondisconnect();break;case nn.CONNECT_ERROR:this.destroy();const i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const i of t)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let i=!1;return function(...r){i||(i=!0,t.packet({type:nn.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:nn.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let i=0;i<t.length;i++)if(e===t[i])return t.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let i=0;i<t.length;i++)if(e===t[i])return t.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const i of t)i.apply(this,e.data)}}}function ou(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}ou.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-t:n+t}return Math.min(n,this.max)|0};ou.prototype.reset=function(){this.attempts=0};ou.prototype.setMin=function(n){this.ms=n};ou.prototype.setMax=function(n){this.max=n};ou.prototype.setJitter=function(n){this.jitter=n};class Yb extends ui{constructor(e,t){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,Om(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((i=t.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new ou({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||aW;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Yq(this.uri,this.opts);const t=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const r=lr(t,"open",function(){i.onopen(),e&&e()}),l=h=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",h),e?e(h):this.maybeReconnectOnOpen()},u=lr(t,"error",l);if(this._timeout!==!1){const h=this._timeout,d=this.setTimeoutFn(()=>{r(),l(new Error("timeout")),t.close()},h);this.opts.autoUnref&&d.unref(),this.subs.push(()=>{this.clearTimeoutFn(d)})}return this.subs.push(r),this.subs.push(u),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(lr(e,"ping",this.onping.bind(this)),lr(e,"data",this.ondata.bind(this)),lr(e,"error",this.onerror.bind(this)),lr(e,"close",this.onclose.bind(this)),lr(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Pm(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new qC(this,e,t),this.nsps[e]=i),i}_destroy(e){const t=Object.keys(this.nsps);for(const i of t)if(this.nsps[i].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let i=0;i<t.length;
4162i++)this.engine.write(t[i],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const fd={};function jd(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=Kq(n,e.path||"/socket.io"),i=t.source,r=t.id,l=t.path,u=fd[r]&&l in fd[r].nsps,h=e.forceNew||e["force new connection"]||e.multiplex===!1||u;let d;return h?d=new Yb(i,e):(fd[r]||(fd[r]=new Yb(i,e)),d=fd[r]),t.query&&!e.query&&(e.query=t.queryKey),d.socket(t.path,e)}Object.assign(jd,{Manager:Yb,Socket:qC,io:jd,connect:jd});const lW=["https://vidfast.pro","https://vidfast.in","https://vidfast.io","https://vidfast.me","https://vidfast.net","https://vidfast.pm","https://vidfast.xyz"],WC="cinema-room-chat-v1",Dm="https://watch-server-production-c01b.up.railway.app.tv",cW=`${Dm}/api/cinema/rooms`,KE=`${Dm}/api/admin/cinema/rooms`,s1=59,uW="https://image.tmdb.org/t/p/w780",ZE=[];function dW(n){return Array.isArray(n?.rooms)?n.rooms.map(e=>{if(!e||typeof e!="object")return null;const t=e,i=typeof t.id=="string"?t.id.trim():"",r=typeof t.name=="string"?t.name.trim():"",l=typeof t.movieTitle=="string"?t.movieTitle.trim():"",u=Number(t.movieId),h=typeof t.description=="string"?t.description.trim():"",d=typeof t.posterPath=="string"?t.posterPath.trim():"",p=Number(t.members);return!i||!r||!l||!Number.isFinite(u)||u<=0||!h||!d?null:{id:i,name:r,movieTitle:l,movieId:u,type:"movie",members:Number.isFinite(p)?Math.max(0,p):0,description:h,posterPath:d}}).filter(e=>!!e):[]}function Zp(n){return`/cinema/room/${n}`}function XC(n){return typeof window>"u"?Zp(n):`${window.location.origin}${Zp(n)}`}function YC(n){return`${uW}${n.posterPath}`}function hW(n){const e=new URLSearchParams({autoPlay:"true",server:"vfast",theme:"FF0000"});return`https://vidfast.pro/movie/${n.movieId}?${e.toString()}`}function fW(){try{const n=localStorage.getItem(WC);if(!n)return[];const e=JSON.parse(n);return Array.isArray(e)?e.filter(t=>t&&typeof t.roomId=="string"&&typeof t.text=="string"):[]}catch{return[]}}function pW(){const n="cinema-viewer-name-v1",e=localStorage.getItem(n);if(e)return e;const t=`Guest-${Math.floor(Math.random()*1e4).toString().padStart(4,"0")}`;return localStorage.setItem(n,t),t}function by(){const[n,e]=E.useState(ZE),[t,i]=E.useState(!0);return E.useEffect(()=>{let r=!0;const l=async()=>{try{const h=await fetch(cW);if(!h.ok)throw new Error(`Failed to fetch rooms: ${h.status}`);const d=await h.json(),p=dW(d);r&&p.length>0&&e(p)}catch{r&&e(ZE)}finally{r&&i(!1)}};l();const u=window.setInterval(l,15e3);return()=>{r=!1,window.clearInterval(u)}},[]),{rooms:n,isLoadingRooms:t}}function mW(){return o.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[o.jsx("path",{d:"M2 12s3.8-6 10-6 10 6 10 6-3.8 6-10 6-10-6-10-6Z"}),o.jsx("circle",{cx:"12",cy:"12",r:"2.9"})]})}function gW(){const{rooms:n,isLoadingRooms:e}=by(),[t,i]=E.useState({}),[r,l]=E.useState(!1),[u,h]=E.useState(null);E.useEffect(()=>{const m=jd(Dm,{transports:["websocket"]}),g=()=>{m.emit("room:counts:request",{roomIds:n.map(y=>y.id)})};m.on("connect",()=>{l(!0),g()}),m.on("disconnect",()=>{l(!1)}),m.on("room:counts",y=>{y?.counts&&i(_=>({..._,...y.counts}))});const b=setInterval(g,1e4);return()=>{clearInterval(b),m.disconnect()}},[n]);const d=async m=>{try{await navigator.clipboard.writeText(XC(m)),h(m),window.setTimeout(()=>{h(g=>g===m?null:g)},1500)}catch{h(null)}},p=m=>{const g=t[m.id];return typeof g=="number"?Math.max(0,g):m.members};return o.jsxs("div",{className:"pt-28 px-4 md:px-12 pb-12",children:[o.jsxs("div",{className:"mb-6",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("h2",{className:"text-3xl md:text-4xl font-black tracking-tight text-white",children:"Cinema Mode"}),o.jsx(Ut,{to:"/cinema/admin",className:"inline-flex items-center justify-center rounded-md border border-white/20 bg-white/5 px-3 py-2 text-xs font-semibold text-zinc-200 hover:bg-white/10",children:"Admin"})]}),o.jsx("p",{className:"text-zinc-300 mt-2",children:"Choose a room to watch. Share the room URL so others can join instantly."}),o.jsx("p",{className:"text-zinc-500 text-xs mt-1",children:e?"Loading rooms...":r?"Connected":"Connecting"})]}),n.length===0&&!e?o.jsxs("div",{className:"rounded-2xl border border-white/15 bg-zinc-900/60 p-8 text-center shadow-[0_18px_50px_rgba(0,0,0,0.45)]",children:[o.jsx("p",{className:"text-white text-xl font-extrabold",children:"No rooms are live right now"}),o.jsx("p",{className:"mt-2 text-sm text-zinc-300",children:"Create one from the admin panel and it will appear here instantly."}),o.jsx("div",{className:"mt-5",children:o.jsx(Ut,{to:"/cinema/admin",className:"inline-flex items-center justify-center rounded-md bg-[#E25E0C] px-4 py-2 text-sm font-semibold text-white hover:bg-[#ff7a27]",children:"Open Admin"})})]}):o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-4",children:n.map(m=>o.jsxs("article",{className:"group relative isolate overflow-hidden rounded-2xl border border-white/15 bg-zinc-900/60 min-h-[22rem] shadow-[0_18px_50px_rgba(0,0,0,0.45)]",children:[o.jsx("img",{src:YC(m),alt:`${m.movieTitle} poster`,className:"absolute inset-0 h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",loading:"lazy"}),o.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-zinc-950/25 via-zinc-950/40 to-zinc-950/95"}),o.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_top_right,rgba(226,94,12,0.35),transparent_38%)]"}),o.jsxs("div",{className:"relative flex h-full flex-col p-4",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx("p",{className:"rounded-full border border-white/25 bg-black/35 px-3 py-1 text-xs font-semibold uppercase tracking-[0.12em] text-zinc-100 backdrop-blur",children:m.name}),o.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-[#
4162E25E0C]/70 bg-[#E25E0C]/20 px-3 py-1 text-xs font-semibold text-orange-100 backdrop-blur",children:[o.jsx(mW,{}),p(m)]})]}),o.jsxs("div",{className:"mt-auto",children:[o.jsx("p",{className:"text-white text-xl font-extrabold leading-tight drop-shadow-[0_2px_8px_rgba(0,0,0,0.7)]",children:m.movieTitle}),o.jsx("p",{className:"text-zinc-200/95 text-sm mt-2 line-clamp-3",children:m.description}),o.jsxs("div",{className:"mt-4 flex items-center gap-2 flex-wrap",children:[o.jsx(Ut,{to:Zp(m.id),className:"inline-flex items-center justify-center rounded-md bg-[#E25E0C] hover:bg-[#ff7a27] px-4 py-2 text-sm font-semibold text-white",children:"Join Room"}),o.jsx("button",{type:"button",onClick:()=>d(m.id),className:"inline-flex items-center justify-center rounded-md border border-white/25 bg-black/35 hover:bg-black/45 px-3 py-2 text-xs font-semibold text-zinc-100 backdrop-blur",children:u===m.id?"Copied!":"Copy Room Link"}),o.jsx("span",{className:"text-xs text-zinc-300/75",children:Zp(m.id)})]})]})]})]},m.id))})]})}const r1="cinema-admin-key-v1";function xW(){const{rooms:n,isLoadingRooms:e}=by(),[t,i]=E.useState(()=>localStorage.getItem(r1)||""),[r,l]=E.useState(!1),[u,h]=E.useState(null),[d,p]=E.useState({id:"",name:"",movieId:"",description:"",posterPath:""}),m=_=>{i(_),_.trim()?localStorage.setItem(r1,_.trim()):localStorage.removeItem(r1)},g=(_,C)=>{p(w=>({...w,[_]:C}))},b=async _=>{_.preventDefault(),h(null);const C=t.trim();if(!C){h("Enter admin password first.");return}const w={id:d.id.trim()||void 0,name:d.name.trim()||void 0,movieId:Number(d.movieId),description:d.description.trim()||void 0,posterPath:d.posterPath.trim()||void 0};if(!Number.isFinite(w.movieId)||w.movieId<=0){h("Please enter a valid TMDB movie ID.");return}l(!0);try{const S=await fetch(KE,{method:"POST",headers:{"Content-Type":"application/json","x-admin-key":C},body:JSON.stringify(w)}),T=await S.json().catch(()=>({}));if(!S.ok){h(T?.error||"Failed to create room.");return}h(`Room ${T?.room?.name||w.name} created.`),p({id:"",name:"",movieId:"",description:"",posterPath:""})}catch{h("Failed to create room. Check server connection.")}finally{l(!1)}},y=async _=>{const C=t.trim();if(!C){h("Enter admin password first.");return}h(null),l(!0);try{const w=await fetch(`${KE}/${_}`,{method:"DELETE",headers:{"x-admin-key":C}}),S=await w.json().catch(()=>({}));if(!w.ok){h(S?.error||"Failed to remove room.");return}h(`Room ${_} removed.`)}catch{h("Failed to remove room. Check server connection.")}finally{l(!1)}};return o.jsxs("div",{className:"pt-28 px-4 md:px-12 pb-12",children:[o.jsxs("div",{className:"mb-6 flex items-center justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-3xl md:text-4xl font-black tracking-tight text-white",children:"Cinema Admin"}),o.jsx("p",{className:"text-zinc-300 mt-2",children:"Create and remove cinema rooms from the server."})]}),o.jsx(Ut,{to:"/cinema",className:"rounded-md bg-white/10 hover:bg-white/20 px-3 py-2 text-sm font-semibold text-white",children:"Back to Cinema"})]}),o.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-[420px_minmax(0,1fr)] gap-6",children:[o.jsxs("section",{className:"rounded-xl border border-white/10 bg-zinc-900/70 p-4",children:[o.jsx("h3",{className:"text-white font-semibold",children:"Admin Password"}),o.jsx("input",{type:"password",value:t,onChange:_=>m(_.target.value),placeholder:"Enter CINEMA_ADMIN_KEY",className:"mt-3 w-full rounded-md border border-white/10 bg-black/40 px-3 py-2 text-sm text-white placeholder:text-zinc-500 focus:outline-none focus:ring-1 focus:ring-[#E25E0C]"}),o.jsx("p",{className:"text-zinc-500 text-xs mt-2",children:"Used as `x-admin-key` for create/remove requests."}),o.jsxs("form",{onSubmit:b,className:"mt-6 space-y-3",children:[o.jsx("h3",{className:"text-white font-semibold",children:"Create Room"}),o.jsx("input",{required:!0,value:d.movieId,onChange:_=>g("movieId",_.target.value),placeholder:"TMDB movie id (required)",className:"w-full rounded-md border border-white/10 bg-black/40 px-3 py-2 text-sm text-white placeholder:text-zinc-500"}),o.jsx("input",{value:d.id,onChange:_=>g("id",_.target.value),placeholder:"Custom room id (optional, e.g. dune-night)",className:"w-full rounded-md border border-white/10 bg-black/40 px-3 py-2 text-sm text-white placeholder:text-zinc-500"}),o.jsx("input",{value:d.name,onChange:_=>g("name",_.target.value),placeholder:"Custom room name (optional)",className:"w-full rounded-md border border-white/10 bg-black/40 px-3 py-2 text-sm text-white placeholder:text-zinc-500"}),o.jsx("input",{value:d.posterPath,onChange:_=>g("posterPath",_.target.value),placeholder:"Poster path override (optional, e.g. /abc.jpg)",className:"w-full rounded-md border border-white/10 bg-black/40 px-3 py-2 text-sm text-white placeholder:text-zinc-500"}),o.jsx("textarea",{value:d.description,onChange:_=>g("description",_.target.value),placeholder:"Description override (optional)",rows:3,className:"w-full rounded-md border border-white/10 bg-black/40 px-3 py-2 text-sm text-white placeholder:text-zinc-500"}),o.jsx("p",{className:"text-zinc-500 text-xs",children:"Only movie ID is required. Title, poster, and description are pulled from TMDB automatically."}),o.jsx("button",{disabled:r,type:"submit",className:"w-full rounded-md bg-[#E25E0C] hover:bg-[#
4162E25E0C] disabled:bg-zinc-700 px-4 py-2 text-sm font-semibold text-white",children:r?"Saving...":"Create Room"})]})]}),o.jsxs("section",{className:"rounded-xl border border-white/10 bg-zinc-900/70 p-4",children:[o.jsx("h3",{className:"text-white font-semibold",children:"Existing Rooms"}),o.jsx("p",{className:"text-zinc-500 text-xs mt-1",children:e?"Loading rooms...":`${n.length} rooms`}),o.jsx("div",{className:"mt-4 space-y-3",children:n.map(_=>o.jsxs("div",{className:"rounded-lg border border-white/10 bg-black/30 p-3 flex items-center justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-white",children:_.name}),o.jsxs("p",{className:"text-xs text-zinc-400",children:[_.movieTitle," (",_.id,")"]})]}),o.jsx("button",{disabled:r,type:"button",onClick:()=>y(_.id),className:"rounded-md bg-red-700 hover:bg-[#E25E0C] disabled:bg-zinc-700 px-3 py-1.5 text-xs font-semibold text-white",children:"Remove"})]},_.id))})]})]}),u&&o.jsx("p",{className:"mt-4 text-sm text-zinc-300",children:u})]})}function bW(){const{id:n}=nv(),{rooms:e,isLoadingRooms:t}=by(),i=E.useMemo(()=>e.find(H=>H.id===n)||null,[e,n]),r=i?.id||"",l=i?.movieId||null,[u,h]=E.useState(""),[d,p]=E.useState(()=>fW()),[m,g]=E.useState(null),[b,y]=E.useState(!1),[_,C]=E.useState(1),[w]=E.useState(()=>pW()),[S,T]=E.useState(null),[N,j]=E.useState(!1),[O,R]=E.useState(!1),[z,M]=E.useState(!1),P=E.useRef(null),G=E.useRef(null),U=E.useRef(null),Y=E.useRef(null),W=E.useRef(null),J=E.useRef(null),F=E.useMemo(()=>d.filter(H=>H.roomId===r),[d,r]),$=H=>{if(!i||!H||H.tmdbId!==i.movieId)return;const Z=U.current,Ee=Z?.currentTime??0,je=H.currentTime??0,le=Math.abs(Ee-je);(!Z||le>
41622.5)&&P.current?.contentWindow?.postMessage({command:"seek",time:je},"*"),(!Z||!!Z.playing!=!!H.playing)&&P.current?.contentWindow?.postMessage({command:H.playing?"play":"pause"},"*")};E.useEffect(()=>{localStorage.setItem(WC,JSON.stringify(d))},[d]),E.useEffect(()=>{G.current?.scrollIntoView({behavior:"smooth"})},[F.length]),E.useEffect(()=>{U.current=m},[m]),E.useEffect(()=>{const H=jd(Dm,{transports:["websocket"]});return W.current=H,H.on("connect",()=>{y(!0)}),H.on("disconnect",()=>{y(!1),J.current=null}),H.on("room:joined",Z=>{Z.roomId===r&&(J.current=Z.socketId,C(Z.participantCount||1),T(Z.leaderSocketId||null),j(!!Z.isLeader))}),H.on("room:error",Z=>{Z?.roomId&&Z.roomId!==r||Z?.code==="ROOM_NOT_FOUND"&&y(!1)}),H.on("room:removed",Z=>{!Z?.roomId||Z.roomId!==r||y(!1)}),H.on("room:leader",Z=>{!Z||Z.roomId!==r||(T(Z.leaderSocketId),j(Z.leaderSocketId===J.current))}),H.on("room:user-joined",Z=>{Z.roomId===r&&C(Z.participantCount||1)}),H.on("room:user-left",Z=>{Z.roomId===r&&C(Math.max(1,Z.participantCount||1))}),H.on("chat:rate-limit",Z=>{if(!Z||Z.roomId!==r)return;const Ee=Math.max(1,Math.ceil((Z.retryAfterMs||0)/1e3));p(je=>[...je,{id:crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random()}`,roomId:r,user:"System",text:`Please wait ${Ee}s before sending another message.`,createdAt:Date.now(),system:!0}])}),H.on("chat:message",Z=>{!Z||Z.roomId!==r||p(Ee=>Ee.some(je=>je.id===Z.id)?Ee:[...Ee,Z])}),H.on("watch:command",Z=>{if(!(!Z||Z.roomId!==r)&&!(Z.sourceSocketId&&Z.sourceSocketId===J.current)&&!(Z.action==="play"||Z.action==="pause"||Z.action==="seek")){if(Z.action==="mute"&&typeof Z.muted=="boolean"){P.current?.contentWindow?.postMessage({command:"mute",muted:Z.muted},"*");return}if(Z.action==="volume"&&Number.isFinite(Z.level)){P.current?.contentWindow?.postMessage({command:"volume",level:Z.level},"*");return}P.current?.contentWindow?.postMessage({command:Z.action},"*")}}),H.on("watch:status",Z=>{if(!(!Z||Z.roomId!==r||!Z.data)){if(Z.sourceSocketId&&Z.sourceSocketId!==J.current){Y.current=Z.data,R(!0);return}g(Z.data)}}),()=>{H.disconnect(),W.current=null}},[r,w]),E.useEffect(()=>{if(!l)return;const H=({origin:Z,data:Ee})=>{if(!(!lW.includes(Z)||!Ee)&&(Ee.type==="MEDIA_DATA"&&localStorage.setItem("vidFastProgress",JSON.stringify(Ee.data)),Ee.type==="PLAYER_EVENT")){const je=Ee.data;if(!je||je.tmdbId!==l)return;g(je),(je.event==="playerstatus"||je.event==="playerstatusTriggered")&&N&&W.current?.emit("watch:status",je)}};return window.addEventListener("message",H),()=>window.removeEventListener("message",H)},[l,N]),E.useEffect(()=>{const H=setInterval(()=>{P.current?.contentWindow?.postMessage({command:"getStatus"},"*")},N?4e3:8e3);return()=>clearInterval(H)},[N]),E.useEffect(()=>{r&&(g(null),Y.current=null,R(!1),W.current?.emit("room:join",{roomId:r,username:w}),P.current?.contentWindow?.postMessage({command:"getStatus"},"*"))},[r,w]);const V=H=>{P.current?.contentWindow?.postMessage(H,"*")},se=H=>{V(H),setTimeout(()=>V(H),250),setTimeout(()=>V(H),750)},ue=()=>{const H=Y.current;H&&($(H),se({command:"getStatus"}))},Ce=async()=>{if(r)try{await navigator.clipboard.writeText(XC(r)),M(!0),window.setTimeout(()=>M(!1),1500)}catch{M(!1)}},D=H=>{if(H.preventDefault(),!r)return;const Z=u.trim().slice(0,s1);if(!Z)return;const Ee={id:crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random()}`,roomId:r,user:w,text:Z,createdAt:Date.now()};W.current?.emit("chat:message",Ee),h("")};return i?o.jsx("div",{className:"h-screen w-full overflow-hidden bg-zinc-950",children:o.jsxs("div",{className:"grid h-full w-full grid-cols-[minmax(0,1fr)_360px]",children:[o.jsxs("section",{className:"h-full min-h-0 bg-black border-r border-white/10 flex flex-col",children:[o.jsxs("div",{className:"border-b border-white/10 p-3 flex items-center justify-between gap-3 bg-zinc-950/80",children:[o.jsx(Ut,{to:"/cinema",className:"rounded-md bg-white/10 hover:bg-white/20 px-3 py-1.5 text-sm font-semibold text-white",children:"Back"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{type:"button",onClick:Ce,className:"rounded-md bg-white/10 hover:bg-white/20 px-3 py-1.5 text-sm font-semibold text-white",children:z?"Copied!":"Copy Room Link"}),o.jsx("button",{type:"button",onClick:ue,disabled:N||!O,className:"rounded-md bg-[#E25E0C] hover:bg-[#
4162E25E0C] disabled:bg-white/10 disabled:text-zinc-500 px-3 py-1.5 text-sm font-semibold text-white",children:"Sync with Everyone"})]})]}),o.jsx("div",{className:"flex-1 min-h-0 bg-black relative",children:o.jsx("iframe",{ref:P,id:"cinema-vidfast-player",src:hW(i),onLoad:()=>{se({command:"getStatus"})},className:"w-full h-full",frameBorder:"0",allowFullScreen:!0,allow:"encrypted-media; autoplay; fullscreen",title:`${i.movieTitle} player`,style:{pointerEvents:"auto"}},i.id)})]}),o.jsxs("section",{className:"h-full min-h-0 bg-zinc-900/80 backdrop-blur flex flex-col",children:[o.jsxs("div",{className:"p-4 border-b border-white/10",children:[o.jsx("div",{className:"mb-3 overflow-hidden rounded-lg border border-white/10",children:o.jsx("img",{src:YC(i),alt:`${i.movieTitle} poster`,className:"h-32 w-full object-cover"})}),o.jsxs("h3",{className:"text-white font-semibold",children:[i.name," Chat"]}),o.jsx("p",{className:"text-zinc-400 text-xs mt-1",children:b?`${_} watching live ⢠Playback local ⢠${N?"You are sync source":O?`Manual sync available from ${S?"room leader":"leader"}`:"Waiting for room sync status"}`:"Reconnecting to room..."})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:[F.length===0&&o.jsx("p",{className:"text-zinc-500 text-sm",children:"No messages yet. Start the conversation."}),F.map(H=>o.jsxs("div",{className:`rounded-lg px-3 py-2 ${H.system?"bg-white/5 text-zinc-400 text-xs":"bg-black/40"}`,children:[!H.system&&o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsx("span",{className:"text-zinc-200 text-sm font-semibold",children:H.user}),o.jsx("span",{className:"text-zinc-500 text-xs",children:new Date(H.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),o.jsx("p",{className:"text-sm leading-relaxed",children:H.text})]},H.id)),o.jsx("div",{ref:G})]}),o.jsxs("form",{onSubmit:D,className:"p-4 border-t border-white/10 flex items-center gap-2",children:[o.jsx("input",{value:u,onChange:H=>h(H.target.value.slice(0,s1)),maxLength:s1,placeholder:"Type a message",className:"flex-1 rounded-md border border-white/10 bg-black/40 px-3 py-2 text-sm text-white placeholder:text-zinc-500 focus:outline-none focus:ring-1 focus:ring-[#E25E0C]"}),o.jsx("button",{type:"submit",className:"rounded-md bg-[#E25E0C] hover:bg-[#E25E0C] px-4 py-2 text-sm font-semibold text-white",children:"Send"})]})]})]})}):t?o.jsx("div",{className:"pt-28 px-4 md:px-12 pb-12",children:o.jsx("p",{className:"text-zinc-300",children:"Loading room..."})}):o.jsx(pd,{to:"/cinema",replace:!0})}const vW="https://watch-server-production-c01b.up.railway.app/api",QE="a418d58c-24aa-49b8-ae62-4dbe05c06340";function KC(n){return n.trim().toLowerCase().replace(/[^a-z0-9_.-]/g,"")}function ZC(n){return`${n}@pyroplay.tv`}function JE(n){const e=n.trim().toLowerCase();if(!e)return null;if(e.includes("@"))return e;const t=KC(e);return t?ZC(t):null}function yW(){const[n]=Ki(),e=ml(),t=E.useMemo(()=>n.get("next")||"/",[n]),i=E.useMemo(()=>{const J=new URLSearchParams(window.location.hash.replace(/^#/,""));return n.get("type")==="recovery"||J.get("type")==="recovery"},[n]),[r,l]=E.useState(i?"recovery":"login"),[u,h]=E.useState(""),[d,p]=E.useState(""),[m,g]=E.useState(""),[b,y]=E.useState(null),[_,C]=E.useState(null),[w,S]=E.useState(!1),[T,N]=E.useState(!1),[j,O]=E.useState(""),[R,z]=E.useState(!1),[M,P]=E.useState(0),G=()=>{O(""),z(!1),P(J=>J+1)};E.useEffect(()=>{if(r==="recovery"){O(""),z(!1);return}G()},[r]);const U=async J=>{if(J)try{const F=await fetch(`${vW}/users/wallet/provision`,{method:"POST",headers:{Authorization:`Bearer ${J}`}});if(!F.ok){const $=await F.text().catch(()=>"");console.warn("Wallet provisioning request failed:",$||F.statusText)}}catch(F){console.warn("Wallet provisioning request failed:",F)}};E.useEffect(()=>{if(!Fe)return;let J=!0;Fe.auth.getSession().then(({data:$})=>{if(J){if(i){l("recovery"),$.session&&C("Reset link verified. Enter a new password below.");return}$.session&&e(t,{replace:!0})}});const{data:{subscription:F}}=Fe.auth.onAuthStateChange(($,V)=>{if(J){if($==="PASSWORD_RECOVERY"){l("recovery"),y(null),C("Reset link verified. Enter a new password below.");return}V&&!i&&e(t,{replace:!0})}});return()=>{J=!1,F.unsubscribe()}},[i,e,t]),E.useEffect(()=>{!i||r==="recovery"||l("recovery")},[i,r]);const Y=async()=>
4162{if(y(null),C(null),!Fe){y("Authentication is unavailable. Add Supabase env variables first.");return}const J=JE(u);if(!J){y("Enter your username or email first so we know where to send the reset link.");return}N(!0);try{const{error:F}=await Fe.auth.resetPasswordForEmail(J,{redirectTo:`${window.location.origin}/login?type=recovery`});if(F){y(F.message);return}C("Password reset email sent. Open the link in your inbox to choose a new password.")}finally{N(!1)}},W=async J=>{if(J.preventDefault(),y(null),C(null),!Fe){y("Authentication is unavailable. Add Supabase env variables first.");return}if(r==="recovery"){if(d.length<6){y("Password must be at least 6 characters.");return}if(d!==m){y("Passwords do not match.");return}S(!0);try{const{error:$}=await Fe.auth.updateUser({password:d});if($){y($.message);return}C("Password updated. Redirecting you back into PyroPlay."),p(""),g(""),e(t,{replace:!0})}finally{S(!1)}return}const F=KC(u);if(r==="register"&&!F){y("Please enter a valid username using letters, numbers, ., _, or -.");return}if(d.length<6){y("Password must be at least 6 characters.");return}if(r==="register"&&d!==m){y("Passwords do not match.");return}if(!j){y(r==="login"?"Complete the captcha before logging in.":"Complete the captcha before creating your account.");return}S(!0);try{if(r==="login"){const ue=JE(u);if(!ue){y("Please enter a valid username or email address.");return}const{data:Ce,error:D}=await Fe.auth.signInWithPassword({email:ue,password:d,options:{...j?{captchaToken:j}:{}}});if(D){j&&G(),y(D.message);return}await U(Ce.session?.access_token),j&&G(),e(t,{replace:!0});return}const $=ZC(F),{data:V,error:se}=await Fe.auth.signUp({email:$,password:d,options:{data:{username:F},...j?{captchaToken:j}:{}}});if(se){j&&G(),y(se.message);return}await U(V.session?.access_token),j&&G(),C("Account created. Check your inbox to verify your email before logging in."),l("login"),h(""),p(""),g("")}finally{S(!1)}};return o.jsx("main",{className:"min-h-screen bg-zinc-950 pt-28 pb-12 px-4 text-white",children:o.jsxs("div",{className:"mx-auto w-full max-w-md rounded-2xl border border-white/10 bg-zinc-900/70 p-6 shadow-2xl backdrop-blur",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.2em] text-zinc-400",children:"Account"}),o.jsx("h1",{className:"mt-2 text-2xl font-bold",children:r==="recovery"?"Reset your password":"Log in to PyroPlay"}),o.jsx("p",{className:"mt-2 text-sm text-zinc-300",children:r==="recovery"?"Choose a new password for your account.":"Create an account or log in to access PyroPlay."}),r!=="recovery"?o.jsxs("div",{className:"mt-5 grid grid-cols-2 rounded-lg bg-zinc-800 p-1 text-sm",children:[o.jsx("button",{type:"button",onClick:()=>l("login"),className:`rounded-md px-3 py-2 font-semibold transition ${r==="login"?"bg-zinc-100 text-zinc-900":"text-zinc-300 hover:text-white"}`,children:"Log in"}),o.jsx("button",{type:"button",onClick:()=>l("register"),className:`rounded-md px-3 py-2 font-semibold transition ${r==="register"?"bg-zinc-100 text-zinc-900":"text-zinc-300 hover:text-white"}`,children:"Register"})]}):o.jsx("button",{type:"button",onClick:()=>{l("login"),p(""),g(""),y(null),C(null),e("/login",{replace:!0})},className:"mt-5 text-sm font-semibold text-zinc-300 transition hover:text-white",children:"Back to login"}),o.jsxs("form",{onSubmit:W,className:"mt-5 space-y-4",children:[r!=="recovery"&&o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm text-zinc-300",children:r==="login"?"Username or email":"Username"}),o.jsx("input",{type:"text",value:u,onChange:J=>h(J.target.value),className:"w-full rounded-md border border-white/10 bg-zinc-950 px-3 py-2 text-sm text-white outline-none transition focus:border-[#E25E0C]",placeholder:r==="login"?"yourname or [email protected]":"yourname",autoComplete:"username",required:!0})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm text-zinc-300",children:r==="recovery"?"New password":"Password"}),o.jsx("input",{type:"password",value:d,onChange:J=>p(J.target.value),className:"w-full rounded-md border border-white/10 bg-zinc-950 px-3 py-2 text-sm text-white outline-none transition focus:border-[#
4162E25E0C]",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",autoComplete:r==="login"?"current-password":"new-password",required:!0})]}),(r==="register"||r==="recovery")&&o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1 block text-sm text-zinc-300",children:"Confirm password"}),o.jsx("input",{type:"password",value:m,onChange:J=>g(J.target.value),className:"w-full rounded-md border border-white/10 bg-zinc-950 px-3 py-2 text-sm text-white outline-none transition focus:border-[#E25E0C]",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",autoComplete:"new-password",required:!0})]}),r==="login"&&o.jsx("div",{className:"flex justify-end",children:o.jsx("button",{type:"button",onClick:()=>{Y()},disabled:T,className:"text-sm font-semibold text-zinc-300 transition hover:text-white disabled:cursor-not-allowed disabled:opacity-60",children:T?"Sending reset link...":"Forgot password?"})}),r!=="recovery"&&QE&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"min-h-19.5 overflow-hidden rounded-md border border-white/10 bg-zinc-950 p-1",children:o.jsx(q6,{sitekey:QE,theme:"dark",onLoad:()=>z(!0),onVerify:J=>{O(J),y(F=>F==="Complete the captcha before creating your account."||F==="Complete the captcha before logging in."?null:F)},onExpire:()=>O(""),onError:()=>{O(""),y("Captcha failed to load. Refresh and try again.")}},M)}),o.jsx("p",{className:"text-xs text-zinc-400",children:R?r==="login"?"Complete the captcha before logging in.":"Complete the captcha before creating your account.":"Loading captcha protection..."})]}),b&&o.jsx("p",{className:"rounded-md border border-red-500/40 bg-red-500/10 px-3 py-2 text-sm text-red-200",children:b}),_&&o.jsx("p",{className:"rounded-md border border-emerald-500/40 bg-emerald-500/10 px-3 py-2 text-sm text-emerald-200",children:_}),o.jsx("button",{type:"submit",disabled:w,className:"w-full rounded-md bg-[#E25E0C] px-4 py-2 text-sm font-bold text-white transition hover:bg-[#f76c15] disabled:opacity-60 disabled:cursor-not-allowed",children:w?"Please wait...":r==="login"?"Log in":r==="register"?"Create account":"Save new password"})]}),o.jsx("p",{className:"mt-4 text-xs text-zinc-400",children:"By continuing, you agree to the platform terms."})]})})}var _W=Object.defineProperty,Qp=Object.getOwnPropertySymbols,QC=Object.prototype.hasOwnProperty,JC=Object.prototype.propertyIsEnumerable,e6=(n,e,t)=>e in n?_W(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Kb=(n,e)=>{for(var t in e||(e={}))QC.call(e,t)&&e6(n,t,e[t]);if(Qp)for(var t of Qp(e))JC.call(e,t)&&e6(n,t,e[t]);return n},Zb=(n,e)=>{var t={};for(var i in n)QC.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&Qp)for(var i of Qp(n))e.indexOf(i)<0&&JC.call(n,i)&&(t[i]=n[i]);return t};var pl;(n=>{const e=class Qt{constructor(d,p,m,g){if(this.version=d,this.errorCorrectionLevel=p,this.modules=[],this.isFunction=[],d<Qt.MIN_VERSION||d>Qt.MAX_VERSION)throw new RangeError("Version value out of range");if(g<-1||g>7)throw new RangeError("Mask value out of range");this.size=d*4+17;let b=[];for(let _=0;_<this.size;_++)b.push(!1);for(let _=0;_<this.size;_++)this.modules.push(b.slice()),this.isFunction.push(b.slice());this.drawFunctionPatterns();const y=this.addEccAndInterleave(m);if(this.drawCodewords(y),g==-1){let _=1e9;for(let C=0;C<8;C++){this.applyMask(C),this.drawFormatBits(C);const w=this.getPenaltyScore();w<_&&(g=C,_=w),this.applyMask(C)}}r(0<=g&&g<=7),this.mask=g,this.applyMask(g),this.drawFormatBits(g),this.isFunction=[]}static encodeText(d,p){const m=n.QrSegment.makeSegments(d);return Qt.encodeSegments(m,p)}static encodeBinary(d,p){const m=n.QrSegment.makeBytes(d);return Qt.encodeSegments([m],p)}static encodeSegments(d,p,m=1,g=40,b=-1,y=!0){if(!(Qt.MIN_VERSION<=m&&m<=g&&g<=Qt.MAX_VERSION)||b<-1||b>7)throw new RangeError("Invalid value");let _,C;for(_=m;;_++){const N=Qt.getNumDataCodewords(_,p)*8,j=u.getTotalBits(d,_);if(j<=N){C=j;break}if(_>=g)throw new RangeError("Data too long")}for(const N of[Qt.Ecc.MEDIUM,Qt.Ecc.QUARTILE,Qt.Ecc.HIGH])y&&C<=Qt.getNumDataCodewords(_,N)*8&&(p=N);let w=[];for(const N of d){t(N.mode.modeBits,4,w),t(N.numChars,N.mode.numCharCountBits(_),w);for(const j of N.getData())w.push(j)}r(w.length==C);const S=Qt.getNumDataCodewords(_,p)*8;r(w.length<=S),t(0,Math.min(4,S-w.length),w),t(0,(8-w.length%8)%8,w),r(w.length%8==0);for(let N=236;w.length<S;N^=253)t(N,8,w);let T=[];for(;T.length*8<w.length;)T.push(0);
4162return w.forEach((N,j)=>T[j>>>3]|=N<<7-(j&7)),new Qt(_,p,T,b)}getModule(d,p){return 0<=d&&d<this.size&&0<=p&&p<this.size&&this.modules[p][d]}getModules(){return this.modules}drawFunctionPatterns(){for(let m=0;m<this.size;m++)this.setFunctionModule(6,m,m%2==0),this.setFunctionModule(m,6,m%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const d=this.getAlignmentPatternPositions(),p=d.length;for(let m=0;m<p;m++)for(let g=0;g<p;g++)m==0&&g==0||m==0&&g==p-1||m==p-1&&g==0||this.drawAlignmentPattern(d[m],d[g]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(d){const p=this.errorCorrectionLevel.formatBits<<3|d;let m=p;for(let b=0;b<10;b++)m=m<<1^(m>>>9)*1335;const g=(p<<10|m)^21522;r(g>>>15==0);for(let b=0;b<=5;b++)this.setFunctionModule(8,b,i(g,b));this.setFunctionModule(8,7,i(g,6)),this.setFunctionModule(8,8,i(g,7)),this.setFunctionModule(7,8,i(g,8));for(let b=9;b<15;b++)this.setFunctionModule(14-b,8,i(g,b));for(let b=0;b<8;b++)this.setFunctionModule(this.size-1-b,8,i(g,b));for(let b=8;b<15;b++)this.setFunctionModule(8,this.size-15+b,i(g,b));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let d=this.version;for(let m=0;m<12;m++)d=d<<1^(d>>>11)*7973;const p=this.version<<12|d;r(p>>>18==0);for(let m=0;m<18;m++){const g=i(p,m),b=this.size-11+m%3,y=Math.floor(m/3);this.setFunctionModule(b,y,g),this.setFunctionModule(y,b,g)}}drawFinderPattern(d,p){for(let m=-4;m<=4;m++)for(let g=-4;g<=4;g++){const b=Math.max(Math.abs(g),Math.abs(m)),y=d+g,_=p+m;0<=y&&y<this.size&&0<=_&&_<this.size&&this.setFunctionModule(y,_,b!=2&&b!=4)}}drawAlignmentPattern(d,p){for(let m=-2;m<=2;m++)for(let g=-2;g<=2;g++)this.setFunctionModule(d+g,p+m,Math.max(Math.abs(g),Math.abs(m))!=1)}setFunctionModule(d,p,m){this.modules[p][d]=m,this.isFunction[p][d]=!0}addEccAndInterleave(d){const p=this.version,m=this.errorCorrectionLevel;if(d.length!=Qt.getNumDataCodewords(p,m))throw new RangeError("Invalid argument");const g=Qt.NUM_ERROR_CORRECTION_BLOCKS[m.ordinal][p],b=Qt.ECC_CODEWORDS_PER_BLOCK[m.ordinal][p],y=Math.floor(Qt.getNumRawDataModules(p)/8),_=g-y%g,C=Math.floor(y/g);let w=[];const S=Qt.reedSolomonComputeDivisor(b);for(let N=0,j=0;N<g;N++){let O=d.slice(j,j+C-b+(N<_?0:1));j+=O.length;const R=Qt.reedSolomonComputeRemainder(O,S);N<_&&O.push(0),w.push(O.concat(R))}let T=[];for(let N=0;N<w[0].length;N++)w.forEach((j,O)=>{(N!=C-b||O>=_)&&T.push(j[N])});return r(T.length==y),T}drawCodewords(d){if(d.length!=Math.floor(Qt.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let p=0;for(let m=this.size-1;m>=1;m-=2){m==6&&(m=5);for(let g=0;g<this.size;g++)for(let b=0;b<2;b++){const y=m-b,C=(m+1&2)==0?this.size-1-g:g;!this.isFunction[C][y]&&p<d.length*8&&(this.modules[C][y]=i(d[p>>>3],7-(p&7)),p++)}}r(p==d.length*8)}applyMask(d){if(d<0||d>7)throw new RangeError("Mask value out of range");for(let p=0;p<this.size;p++)for(let m=0;m<this.size;m++){let g;switch(d){case 0:g=(m+p)%2==0;break;case 1:g=p%2==0;break;case 2:g=m%3==0;break;case 3:g=(m+p)%3==0;break;case 4:g=(Math.floor(m/3)+Math.floor(p/2))%2==0;break;case 5:g=m*p%2+m*p%3==0;break;case 6:g=(m*p%2+m*p%3)%2==0;break;case 7:g=((m+p)%2+m*p%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[p][m]&&g&&(this.modules[p][m]=!this.modules[p][m])}}getPenaltyScore(){let d=0;for(let b=0;b<this.size;b++){let y=!1,_=0,C=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[b][w]==y?(_++,_==5?d+=Qt.PENALTY_N1:_>5&&d++):(this.finderPenaltyAddHistory(_,C),y||(d+=this.finderPenaltyCountPatterns(C)*Qt.PENALTY_N3),y=this.modules[b][w],_=1);d+=this.finderPenaltyTerminateAndCount(y,_,C)*Qt.PENALTY_N3}for(let b=0;b<this.size;b++){let y=!1,_=0,C=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[w][b]==y?(_++,_==5?d+=Qt.PENALTY_N1:_>5&&d++):(this.finderPenaltyAddHistory(_,C),y||(d+=this.finderPenaltyCountPatterns(C)*Qt.PENALTY_N3),y=this.modules[w][b],_=1);d+=this.finderPenaltyTerminateAndCount(y,_,C)*Qt.PENALTY_N3}for(let b=0;b<this.size-1;b++)for(let y=0;y<this.size-1;y++){const _=this.modules[b][y];_==this.modules[b][y+1]&&_==this.modules[b+1][y]&&_==this.modules[b+1][y+1]&&(d+=Qt.PENALTY_N2)}let p=0;for(const b of this.modules)p=b.reduce((y,_)=>y+(_?1:0),p);const m=this.size*this.size,g=Math.ceil(Math.abs(p*20-m*10)/m)-1;return r(0<=g&&g<=9),d+=g*Qt.PENALTY_N4,r(0<=d&&d<=2568888),d}getAlignmentPatternPositions(){if(this.version==1)return[];{const d=Math.floor(this.version/7)+2,p=this.version==32?26:Math.ceil((this.version*4+4)/(d*2-2))*2;let m=[6];for(let g=this.size-7;m.length<d;g-=p)m.splice(1,0,g);return m}}static getNumRawDataModules(d){if(d<Qt.MIN_VERSION||d>Qt.MAX_VERSION)throw new RangeError("Version number out of range");let p=(16*d+128)*d+64;if(d>=2){const m=Math.floor(d/7)+2;p-=(25*m-10)*m-55,d>=7&&(p-=36)}
4162return r(208<=p&&p<=29648),p}static getNumDataCodewords(d,p){return Math.floor(Qt.getNumRawDataModules(d)/8)-Qt.ECC_CODEWORDS_PER_BLOCK[p.ordinal][d]*Qt.NUM_ERROR_CORRECTION_BLOCKS[p.ordinal][d]}static reedSolomonComputeDivisor(d){if(d<1||d>255)throw new RangeError("Degree out of range");let p=[];for(let g=0;g<d-1;g++)p.push(0);p.push(1);let m=1;for(let g=0;g<d;g++){for(let b=0;b<p.length;b++)p[b]=Qt.reedSolomonMultiply(p[b],m),b+1<p.length&&(p[b]^=p[b+1]);m=Qt.reedSolomonMultiply(m,2)}return p}static reedSolomonComputeRemainder(d,p){let m=p.map(g=>0);for(const g of d){const b=g^m.shift();m.push(0),p.forEach((y,_)=>m[_]^=Qt.reedSolomonMultiply(y,b))}return m}static reedSolomonMultiply(d,p){if(d>>>8||p>>>8)throw new RangeError("Byte out of range");let m=0;for(let g=7;g>=0;g--)m=m<<1^(m>>>7)*285,m^=(p>>>g&1)*d;return r(m>>>8==0),m}finderPenaltyCountPatterns(d){const p=d[1];r(p<=this.size*3);const m=p>0&&d[2]==p&&d[3]==p*3&&d[4]==p&&d[5]==p;return(m&&d[0]>=p*4&&d[6]>=p?1:0)+(m&&d[6]>=p*4&&d[0]>=p?1:0)}finderPenaltyTerminateAndCount(d,p,m){return d&&(this.finderPenaltyAddHistory(p,m),p=0),p+=this.size,this.finderPenaltyAddHistory(p,m),this.finderPenaltyCountPatterns(m)}finderPenaltyAddHistory(d,p){p[0]==0&&(d+=this.size),p.pop(),p.unshift(d)}};e.MIN_VERSION=1,e.MAX_VERSION=40,e.PENALTY_N1=3,e.PENALTY_N2=3,e.PENALTY_N3=40,e.PENALTY_N4=10,e.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],e.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],n.QrCode=e;function t(h,d,p){if(d<0||d>31||h>>>d)throw new RangeError("Value out of range");for(let m=d-1;m>=0;m--)p.push(h>>>m&1)}function i(h,d){return(h>>>d&1)!=0}function r(h){if(!h)throw new Error("Assertion error")}const l=class Fn{constructor(d,p,m){if(this.mode=d,this.numChars=p,this.bitData=m,p<0)throw new RangeError("Invalid argument");this.bitData=m.slice()}static makeBytes(d){let p=[];for(const m of d)t(m,8,p);return new Fn(Fn.Mode.BYTE,d.length,p)}static makeNumeric(d){if(!Fn.isNumeric(d))throw new RangeError("String contains non-numeric characters");let p=[];for(let m=0;m<d.length;){const g=Math.min(d.length-m,3);t(parseInt(d.substring(m,m+g),10),g*3+1,p),m+=g}return new Fn(Fn.Mode.NUMERIC,d.length,p)}static makeAlphanumeric(d){if(!Fn.isAlphanumeric(d))throw new RangeError("String contains unencodable characters in alphanumeric mode");let p=[],m;for(m=0;m+2<=d.length;m+=2){let g=Fn.ALPHANUMERIC_CHARSET.indexOf(d.charAt(m))*45;g+=Fn.ALPHANUMERIC_CHARSET.indexOf(d.charAt(m+1)),t(g,11,p)}return m<d.length&&t(Fn.ALPHANUMERIC_CHARSET.indexOf(d.charAt(m)),6,p),new Fn(Fn.Mode.ALPHANUMERIC,d.length,p)}static makeSegments(d){return d==""?[]:Fn.isNumeric(d)?[Fn.makeNumeric(d)]:Fn.isAlphanumeric(d)?[Fn.makeAlphanumeric(d)]:[Fn.makeBytes(Fn.toUtf8ByteArray(d))]}static makeEci(d){let p=[];if(d<0)throw new RangeError("ECI assignment value out of range");if(d<128)t(d,8,p);else if(d<16384)t(2,2,p),t(d,14,p);else if(d<1e6)t(6,3,p),t(d,21,p);else throw new RangeError("ECI assignment value out of range");return new Fn(Fn.Mode.ECI,0,p)}static isNumeric(d){return Fn.NUMERIC_REGEX.test(d)}static isAlphanumeric(d){return Fn.ALPHANUMERIC_REGEX.test(d)}getData(){return this.bitData.slice()}static getTotalBits(d,p){let m=0;for(const g of d){const b=g.mode.numCharCountBits(p);if(g.numChars>=1<<b)return 1/0;m+=4+b+g.bitData.length}return m}static toUtf8ByteArray(d){d=encodeURI(d);let p=[];for(let m=0;m<d.length;
4162m++)d.charAt(m)!="%"?p.push(d.charCodeAt(m)):(p.push(parseInt(d.substring(m+1,m+3),16)),m+=2);return p}};l.NUMERIC_REGEX=/^[0-9]*$/,l.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,l.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let u=l;n.QrSegment=l})(pl||(pl={}));(n=>{(e=>{const t=class{constructor(r,l){this.ordinal=r,this.formatBits=l}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(n.QrCode||(n.QrCode={}))})(pl||(pl={}));(n=>{(e=>{const t=class{constructor(r,l){this.modeBits=r,this.numBitsCharCount=l}numCharCountBits(r){return this.numBitsCharCount[Math.floor((r+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(n.QrSegment||(n.QrSegment={}))})(pl||(pl={}));var Nc=pl;var wW={L:Nc.QrCode.Ecc.LOW,M:Nc.QrCode.Ecc.MEDIUM,Q:Nc.QrCode.Ecc.QUARTILE,H:Nc.QrCode.Ecc.HIGH},eN=128,tN="L",nN="#FFFFFF",iN="#000000",sN=!1,rN=1,SW=4,EW=0,CW=.1;function aN(n,e=0){const t=[];return n.forEach(function(i,r){let l=null;i.forEach(function(u,h){if(!u&&l!==null){t.push(`M${l+e} ${r+e}h${h-l}v1H${l+e}z`),l=null;return}if(h===i.length-1){if(!u)return;l===null?t.push(`M${h+e},${r+e} h1v1H${h+e}z`):t.push(`M${l+e},${r+e} h${h+1-l}v1H${l+e}z`);return}u&&l===null&&(l=h)})}),t.join("")}function oN(n,e){return n.slice().map((t,i)=>i<e.y||i>=e.y+e.h?t:t.map((r,l)=>l<e.x||l>=e.x+e.w?r:!1))}function NW(n,e,t,i){if(i==null)return null;const r=n.length+t*2,l=Math.floor(e*CW),u=r/e,h=(i.width||l)*u,d=(i.height||l)*u,p=i.x==null?n.length/2-h/2:i.x*u,m=i.y==null?n.length/2-d/2:i.y*u,g=i.opacity==null?1:i.opacity;let b=null;if(i.excavate){let _=Math.floor(p),C=Math.floor(m),w=Math.ceil(h+p-_),S=Math.ceil(d+m-C);b={x:_,y:C,w,h:S}}const y=i.crossOrigin;return{x:p,y:m,h:d,w:h,excavation:b,opacity:g,crossOrigin:y}}function TW(n,e){return e!=null?Math.max(Math.floor(e),0):n?SW:EW}function lN({value:n,level:e,minVersion:t,includeMargin:i,marginSize:r,imageSettings:l,size:u,boostLevel:h}){let d=li.useMemo(()=>{const _=(Array.isArray(n)?n:[n]).reduce((C,w)=>(C.push(...Nc.QrSegment.makeSegments(w)),C),[]);return Nc.QrCode.encodeSegments(_,wW[e],t,void 0,void 0,h)},[n,e,t,h]);const{cells:p,margin:m,numCells:g,calculatedImageSettings:b}=li.useMemo(()=>{let y=d.getModules();const _=TW(i,r),C=y.length+_*2,w=NW(y,u,_,l);return{cells:y,margin:_,numCells:C,calculatedImageSettings:w}},[d,u,l,i,r]);return{qrcode:d,margin:m,cells:p,numCells:g,calculatedImageSettings:b}}var MW=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),AW=li.forwardRef(function(e,t){const i=e,{value:r,size:l=eN,level:u=tN,bgColor:h=nN,fgColor:d=iN,includeMargin:p=sN,minVersion:m=rN,boostLevel:g,marginSize:b,imageSettings:y}=i,C=Zb(i,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:w}=C,S=Zb(C,["style"]),T=y?.src,N=li.useRef(null),j=li.useRef(null),O=li.useCallback(J=>{N.current=J,typeof t=="function"?t(J):t&&(t.current=J)},[t]),[R,z]=li.useState(!1),{margin:M,cells:P,numCells:G,calculatedImageSettings:U}=lN({value:r,level:u,minVersion:m,boostLevel:g,includeMargin:p,marginSize:b,imageSettings:y,size:l});li.useEffect(()=>{if(N.current!=null){const J=N.current,F=J.getContext("2d");if(!F)return;let $=P;const V=j.current,se=U!=null&&V!==null&&V.complete&&V.naturalHeight!==0&&V.naturalWidth!==0;se&&U.excavation!=null&&($=oN(P,U.excavation));const ue=window.devicePixelRatio||1;J.height=J.width=l*ue;const Ce=l/G*ue;F.scale(Ce,Ce),F.fillStyle=h,F.fillRect(0,0,G,G),F.fillStyle=d,MW?F.fill(new Path2D(aN($,M))):P.forEach(function(D,H){D.forEach(function(Z,Ee){Z&&F.fillRect(Ee+M,H+M,1,1)})}),U&&(F.globalAlpha=U.opacity),se&&F.drawImage(V,U.x+M,U.y+M,U.w,U.h)}}),li.useEffect(()=>{z(!1)},[T]);const Y=Kb({height:l,width:l},w);let W=null;return T!=null&&(W=li.createElement("img",{src:T,key:T,style:{display:"none"},onLoad:()=>{z(!0)},ref:j,crossOrigin:U?.crossOrigin})),li.createElement(li.Fragment,null,li.createElement("canvas",Kb({style:Y,height:l,width:l,ref:O,role:"img"},S)),W)});AW.displayName="QRCodeCanvas";var cN=li.forwardRef(function(e,t){const i=e,{value:r,size:l=eN,level:u=tN,bgColor:h=nN,fgColor:d=iN,includeMargin:p=sN,minVersion:m=rN,boostLevel:g,title:b,marginSize:y,imageSettings:_}=i,C=Zb(i,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:w,cells:S,numCells:T,calculatedImageSettings:N}=lN({value:r,level:u,minVersion:m,boostLevel:g,includeMargin:p,marginSize:y,imageSettings:_,size:l});let j=S,O=null;_!=null&&N!=null&&(N.excavation!=null&&(j=oN(S,N.excavation)),O=li.createElement("image",{href:_.src,height:N.h,width:N.w,x:N.x+w,y:N.y+w,preserveAspectRatio:"none",opacity:N.opacity,crossOrigin:N.crossOrigin}));const R=aN(j,w);return li.createElement("svg",Kb({height:l,width:l,viewBox:`0 0 ${T} ${T}`,ref:t,role:"img"},C),!!b&&li.createElement("title",null,b),li.createElement("path",{fill:h,d:`M0,0 h${T}v${T}H0z`,shapeRendering:"crispEdges"}),li.createElement("path",{fill:d,d:R,shapeRendering:"crispEdges"}),O)});cN.displayName="QRCodeSVG";const vy="code",yy="watchpump:pending-referral-code:v1";function Um(n){return String(n||"").trim().toUpperCase().replace(/[^A-Z0-9_-]/g,"").slice(0,24)}function RW(){return vy}function kW(){if(typeof window>"u")return null;try{const n=window.localStorage.getItem(yy);return Um(n||"")||null}catch{return null}}function jW(n){if(typeof window>"u")return null;const e=Um(n);if(!e)return null;try{return window.localStorage.setItem(yy,e),e}catch{return e}}function t6(){if(!(typeof window>"u"))try{window.localStorage.removeItem(yy)}catch{}}function LW(n){const e=Um(n.get(vy)||"");return e?jW(e):null}function uN(n,e){const t=Um(n);if(!t)return null;const i=typeof window<"u"?window.location.origin:"https://pyroplay.tv",r=new URL("/",i);return r.searchParams.set(vy,t),r.toString()}async function n6(n,e){const t=kW();if(!n||!t)return"none";const i=await fetch(`${e}/users/referral/apply`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({referralCode:t})}
4162),r=await i.json().catch(()=>null);if(i.ok)return t6(),"applied";if(i.status===400||i.status===404||i.status===409)return t6(),"cleared";throw new Error(r?.error||"Failed to apply stored referral code")}const PW="https://watch-server-production-c01b.up.railway.app/api";async function OW(){if(!Fe)throw new Error("Authentication is unavailable.");const{data:n}=await Fe.auth.getSession(),e=n.session?.access_token;if(!e)throw new Error("Log in to access quests.");return{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}async function ji(n,e){const t=await OW(),i=await fetch(`${PW}${n}`,{...e,headers:{...t,...e?.headers||{}}}),r=await i.json().catch(()=>({}));if(!i.ok)throw new Error(r.error||i.statusText||"Request failed");return r}const dN=()=>ji("/users/quests/daily"),DW=n=>ji(`/users/quests/${n}/claim`,{method:"POST"}),UW=()=>ji("/users/quests/claim-all",{method:"POST"}),IW=()=>ji("/admin/gamification/access"),zW=()=>ji("/users/movie-prize-quests"),$W=(n,e)=>ji(`/users/movie-prize-quests/${n}/claim`,{method:"POST",body:JSON.stringify({recipient_wallet:e})}),FW=()=>ji("/admin/gamification/movie-prize-quests"),BW=n=>ji("/admin/gamification/movie-prize-quests",{method:"POST",body:JSON.stringify(n)}),HW=n=>ji(`/admin/gamification/movie-prize-quests/${n}/activate`,{method:"POST"}),VW=()=>ji("/admin/gamification/quest-templates"),GW=n=>ji("/admin/gamification/quest-templates",{method:"POST",body:JSON.stringify(n)}),qW=(n,e)=>ji(`/admin/gamification/quest-templates/${n}`,{method:"PATCH",body:JSON.stringify(e)}),WW=n=>ji(`/admin/gamification/quest-templates/${n}`,{method:"DELETE"}),XW=()=>ji("/admin/gamification/seasons"),YW=n=>ji("/admin/gamification/seasons",{method:"POST",body:JSON.stringify(n)}),i6=(n,e=!1)=>ji(`/admin/gamification/seasons/${n}/publish`,{method:"POST",body:JSON.stringify({confirmShortage:e})}),KW=n=>ji(`/admin/gamification/seasons/${n}/waves/preview`);function ZW(n){return(Math.max(0,Number(n||0))/3600).toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1})}function QW(n){return n?`#${n.toLocaleString()}`:"Unranked"}function JW(n){return n?n===1?"bg-linear-to-r from-amber-300 to-yellow-500 bg-clip-text text-transparent":n===2?"bg-linear-to-r from-zinc-300 to-zinc-400 bg-clip-text text-transparent":n===3?"bg-linear-to-r from-orange-400 to-amber-700 bg-clip-text text-transparent":n<=10?"bg-linear-to-r from-amber-400 to-orange-500 bg-clip-text text-transparent":n<=100?"bg-linear-to-r from-orange-300 to-amber-500 bg-clip-text text-transparent":"text-white":"text-zinc-500"}function eX(n){return n>=100?"Legendary":n>=50?"Elite Curator":n>=40?"Veteran Watcher":n>=30?"Dedicated Viewer":n>=20?"Enthusiast":n>=10?"Regular":"Newcomer"}function tX({profile:n,isLoading:e,error:t,onRefresh:i,onOpenWatch:r}){const[l,u]=E.useState("movies"),[h,d]=E.useState(null);E.useEffect(()=>{dN().then(d).catch(()=>d(null))},[n?.user_id]);const p=n?.activity?.top_watched?.[l]?.slice(0,3)||[],m=n?.activity?.currently_watching||null;return o.jsxs("section",{className:"space-y-4 rounded-2xl border border-white/10 bg-zinc-900/65 p-4 shadow-[0_10px_45px_-30px_rgba(0,0,0,0.9)] md:p-6",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("h2",{className:"text-lg font-semibold text-white",children:"Your Full Stats"}),o.jsx("button",{type:"button",onClick:i,className:"rounded-md border border-white/20 px-3 py-2 text-xs font-semibold text-zinc-100 hover:bg-zinc-800",children:"Refresh stats"})]}),e?o.jsx("div",{className:"rounded-xl border border-white/10 bg-black/20 px-4 py-8 text-center text-sm text-zinc-300",children:"Loading stats..."}):t?o.jsx("div",{className:"rounded-xl border border-red-500/30 bg-red-500/10 px-4 py-6 text-sm text-red-200",children:t}):n?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid gap-4 lg:grid-cols-3",children:[h?.season&&o.jsxs(Ut,{to:"/quests",className:"flex items-center justify-between rounded-3xl border border-violet-500/20 bg-violet-500/8 p-6 transition hover:bg-violet-500/12 lg:col-span-3",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"text-xs font-bold uppercase tracking-[0.16em] text-violet-300",children:[h.season.name," ⢠Week ",h.wave?.wave_number||1]}),o.jsxs("p",{className:"mt-2 text-2xl font-black text-white",children:[h.season.points||0," season points"]}),o.jsxs("p",{className:"mt-1 text-sm text-zinc-400",children:["Season rank ",h.season.rank?`#${h.season.rank}`:"unranked"," ⢠Open your quests"]})]}),o.jsx(_o,{className:"h-9 w-9 text-violet-300"})]}),o.jsxs("div",{className:"flex flex-col justify-between rounded-3xl border border-white/5 bg-white/2 p-6 lg:col-span-2",children:[o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-bold uppercase tracking-[0.15em] text-zinc-500",children:"Current Standing"}),o.jsx("p",{className:"mt-1 text-2xl font-bold text-white",children:eX(n.level)})]}),o.jsxs("div",{className:"text-right",children:[o.jsxs("p",{className:"text-xl font-bold text-orange-400",children:[n.level_progress_percent,"%"]}),o.jsxs("p",{className:"text-[10px] font-bold uppercase tracking-wider text-zinc-500",children:["To Level ",n.level+1]})]})]}),o.jsxs("div",{className:"mt-6",children:[o.jsx("div",{className:"h-3 w-full overflow-hidden rounded-full border border-white/10 bg-white/5",children:o.jsx("div",{className:"h-full rounded-full bg-linear-to-r from-amber-500 via-orange-500 to-red-500",style:{width:`${Math.max(0,Math.min(100,n.level_progress_percent))}%`}})}),o.jsx("div",{className:"mt-2 flex items-center justify-between text-xs font-medium tracking-wide text-zinc-500",children:o.jsxs("span",{children:[n.total_xp.toLocaleStr
4162ing()," XP EARNED"]})})]})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center rounded-3xl border border-white/5 bg-white/2 p-6 text-center",children:[o.jsx("div",{className:"mb-3 rounded-full bg-orange-500/20 p-3",children:o.jsx(dl,{className:"h-6 w-6 fill-orange-400 text-orange-400"})}),o.jsx("h3",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-zinc-500",children:"Total XP"}),o.jsx("p",{className:"mt-1 text-3xl font-black tracking-tight text-white",children:n.total_xp.toLocaleString()})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center rounded-3xl border border-white/5 bg-white/2 p-6 text-center",children:[o.jsx("div",{className:"mb-3 rounded-full bg-orange-500/20 p-3",children:o.jsx(J6,{className:"h-6 w-6 text-orange-400"})}),o.jsx("h3",{className:"text-[14px] font-bold uppercase tracking-[0.2em] text-zinc-500",children:"Watch Time"}),o.jsxs("p",{className:"mt-1 flex items-baseline justify-center gap-1",children:[o.jsx("span",{className:"text-5xl font-black tracking-tight text-white",children:ZW(n.total_watch_seconds)}),o.jsx("span",{className:"text-sm font-semibold text-zinc-500",children:"hrs"})]})]}),o.jsxs("div",{className:"flex flex-col gap-6 rounded-3xl border border-white/5 bg-white/2 p-6 lg:col-span-2 md:flex-row",children:[o.jsxs("div",{className:"shrink-0 flex-1",children:[o.jsx("h3",{className:"mb-4 text-[10px] font-bold uppercase tracking-[0.2em] text-zinc-500",children:"Content Stats"}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-orange-500/10 bg-orange-500/5 px-3 py-2 text-orange-200",children:[o.jsx(Pc,{className:"h-4 w-4 text-orange-400"}),o.jsxs("span",{className:"text-sm font-semibold",children:[n.movies_completed.toLocaleString()," ",o.jsx("span",{className:"font-normal text-orange-200/50",children:"Movies"})]})]}),o.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-orange-500/10 bg-orange-500/5 px-3 py-2 text-orange-200",children:[o.jsx(wo,{className:"h-4 w-4 text-orange-400"}),o.jsxs("span",{className:"text-sm font-semibold",children:[n.series_episodes_completed.toLocaleString()," ",o.jsx("span",{className:"font-normal text-orange-200/50",children:"Episodes"})]})]}),o.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-orange-500/10 bg-orange-500/5 px-3 py-2 text-orange-200",children:[o.jsx(pr,{className:"h-4 w-4 text-orange-400"}),o.jsxs("span",{className:"text-sm font-semibold",children:[n.anime_titles_started.toLocaleString()," ",o.jsx("span",{className:"font-normal text-orange-200/50",children:"Anime"})]})]})]})]}),o.jsx("div",{className:"hidden w-px bg-white/5 md:block"}),o.jsxs("div",{className:"min-w-0 flex-2",children:[o.jsxs("h3",{className:"mb-4 flex items-center justify-between text-[10px] font-bold uppercase tracking-[0.2em] text-zinc-500",children:["Currently Watching",m&&o.jsx("span",{className:"rounded-md bg-orange-400/10 px-2 py-0.5 text-orange-400",children:"Live"})]}),m?o.jsxs("button",{type:"button",onClick:()=>r(m.content_type,m.content_id,m.watch_param),className:"group -m-3 flex w-full cursor-pointer flex-col items-center gap-4 roun
4162ded-2xl p-3 text-left transition hover:bg-white/3",children:[o.jsx("div",{className:"flex h-14 w-14 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-white/10 bg-zinc-900 text-zinc-700 shadow-lg transition-all group-hover:border-orange-500/50 sm:h-28 sm:w-full",children:m.image_url?o.jsx("img",{src:m.image_url,alt:"",className:"h-full w-full object-cover"}):o.jsx(Z6,{className:"h-6 w-6 sm:h-8 sm:w-8"})}),o.jsxs("div",{className:"w-full flex-1",children:[o.jsx("h4",{className:"truncate text-sm font-bold text-white sm:text-base",children:m.title||"Watching now"}),o.jsxs("p",{className:"mt-1.5 truncate text-[10px] text-zinc-400 transition-colors group-hover:text-orange-300 sm:text-xs",children:[m.watched_minutes.toLocaleString()," min session"]})]})]}):o.jsx("div",{className:"flex h-14 items-center justify-center rounded-xl border border-dashed border-white/5 sm:h-16",children:o.jsx("p",{className:"text-xs font-medium text-zinc-600",children:"No active sessions"})})]})]})]}),o.jsxs("div",{className:"mt-6",children:[o.jsx("h3",{className:"mb-4 text-xl font-bold text-white",children:"Global Rankings"}),o.jsx("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[{label:"Overall",icon:n5,rank:n.ranks.overall},{label:"Movies",icon:Pc,rank:n.ranks.movies},{label:"Series",icon:wo,rank:n.ranks.series},{label:"Anime",icon:pr,rank:n.ranks.anime}].map(g=>o.jsxs("div",{className:"flex flex-col rounded-3xl border border-white/5 bg-white/2 p-5 transition hover:bg-white/4",children:[o.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-zinc-500",children:g.label}),o.jsx(g.icon,{className:"h-4 w-4 text-zinc-600"})]}),o.jsx("p",{className:"mb-1 text-xs font-semibold text-zinc-500",children:"RANK"}),o.jsx("p",{className:`text-2xl font-black tracking-tighter ${JW(g.rank)}`,children:QW(g.rank)})]},g.label))})]}),o.jsxs("div",{className:"mt-6",children:[o.jsxs("div",{className:"mb-4 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[o.jsx("h3",{className:"text-xl font-bold text-white",children:l==="unlocks"?"Recent Unlocks":"Top Watched"}),o.jsx("div",{className:"flex w-fit gap-1 rounded-lg bg-white/5 p-1",children:["movies","series","anime","unlocks"].map(g=>o.jsx("button",{type:"button",onClick:()=>u(g),className:`rounded-md px-4 py-1.5 text-[11px] font-bold uppercase tracking-wider transition ${l===g?"bg-orange-500 text-white shadow-[0_0_15px_rgba(249,115,22,0.3)]":"text-zinc-500 hover:text-white"}`,children:g},g))})]}),o.jsx("div",{className:"grid gap-3 lg:grid-cols-3",children:p.length>0?p.map((g,b)=>{const y=g.content_type,_=g.content_id;return!_||!y?null:o.jsxs("button",{type:"button",onClick:()=>r(y,_,g.watch_param),className:"group flex cursor-pointer items-center gap-4 roun
4162ded-2xl border border-white/5 bg-white/2 p-4 text-left transition hover:border-orange-500/30 hover:bg-white/6",children:[o.jsx("span",{className:"text-2xl font-black italic text-white/10 transition-colors group-hover:text-orange-500/30",children:(b+1).toString().padStart(2,"0")}),o.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-white/10 bg-zinc-900 transition-all group-hover:border-orange-500/50 group-hover:shadow-[0_0_15px_rgba(249,115,22,0.2)]",children:g.image_url?o.jsx("img",{src:g.image_url,alt:"",className:"h-full w-full object-cover"}):o.jsx(p1,{className:"h-5 w-5 text-zinc-700"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h4",{className:"truncate text-sm font-bold text-white",children:g.title||"Untitled"}),l==="unlocks"?o.jsx("p",{className:"mt-0.5 text-xs font-semibold text-orange-400",children:"Unlocked"}):o.jsxs("p",{className:"mt-0.5 text-xs font-semibold text-orange-400",children:[g.watched_minutes?.toLocaleString()||0," min watched"]})]})]},`${l}-${_}-${b}`)}):o.jsx("div",{className:"col-span-3 flex h-20 items-center justify-center rounded-2xl border border-dashed border-white/5 bg-white/2",children:o.jsxs("p",{className:"text-sm font-medium text-zinc-600",children:["No ",l," data yet"]})})})]})]}):o.jsx("div",{className:"rounded-xl border border-white/10 bg-black/20 px-4 py-8 text-center text-sm text-zinc-300",children:"Profile stats are not available yet."})]})}const s6=2400,nX=240;function hN({className:n}){return o.jsxs("svg",{viewBox:"0 0 48 48","aria-hidden":"true",className:n,fill:"none",children:[o.jsx("circle",{cx:"24",cy:"24",r:"21.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M21.7057 8.0484c-1.7461 10.97-1.8981 20.6988.4763 28.9383",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M10.9878 13.7646a159.9268 159.9268 0 0 0 24.3534-1.1314",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M31.7091 17.3372c-3.311 9.7334-7.69 17.1859-14.5287 19.1731-8.8763 2.5795-7.4027-5.1545-5.24-8.4552 4.4974-6.8635 11.14-7.6115 15.005-7.86C37.8344 19.496 40.3436 28.8758 37.7825 32.7c-2.6869 4.0117-6.1271 5.5711-10.2415 6.2521",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function fN({className:n}){const[e,t]=E.useState(0),[i,r]=E.useState(!1);E.useEffect(()=>{const u=window.setTimeout(()=>{r(!0)},s6-nX),h=window.setTimeout(()=>{t(d=>(d+1)%5),r(!1)},s6);return()=>{window.clearTimeout(u),window.clearTimeout(h)}},[e]);const l=`${n||""} transform-gpu transition-all duration-250 ease-out ${i?"opacity-0 rotate-18 scale-90":"opacity-100 rotate-0 scale-100"}`.trim();return e===0?o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",className:l,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21.5262 17.4999C18.4887 22.7611 11.7612 24.5637 6.49994 21.5262C1.23873 18.4886 -0.563901 11.7611 2.47367 6.49988C5.51123 1.23866 12.2387 -0.563962 17.4999 2.4736C22.7612 5.51117 24.5638 12.2387 21.5262 17.4999ZM5.84382 7.87995C5.25279 7.64272 4.74291 7.45257 4.3292 7.30543C5.59153 5.24057 7.56267 3.85898 9.74648 3.29362C9.77176 3.62621 9.82851 4.00289 9.93722 4.40861C10.3269 5.86297 11.3579 7.58777 13.75 8.96886C14.0666 9.15165 14.3765 9.31079 14.6793 9.44842C14.4757 10.219 14.1794 11.0351 13.7614 11.8848C13.3566 11.6365 12.936 11.3857 12.5 11.1339C9.85449 9.60655 7.52076 8.55305 5.84382 7.87995ZM12.7587 13.6161C12.3555 13.3682 11.9358 13.1176 11.5 12.866C8.94938 11.3934 6.70297 10.3799 5.09882 9.73602C4.44209 9.47241 3.89359 9.27099 3.47664 9.12556C2.8887 10.8629 2.86217 12.7007 3.33339 14.4015C3.63406 14.2571 3.98864 14.1179 4.39435 14.0092C5.84872 13.6195 7.85792 13.65 10.25 15.0311C10.5667 15.2139 10.8594 15.4027 11.13 15.5961C11.6875 15.0424 12.2384 14.3885 12.7587 13.6161ZM12.6204 16.9341C13.4037 17.8315 13.839 18.756 14.0628 19.5913C14.1715 19.997 14.2283 20.3736 14.2536 20.7061C15.962 20.2638 17.54
416203 19.3219 18.7509 17.9441C18.4164 17.6557 17.9678 17.2815 17.4112 16.8446C16.6284 16.2301 15.633 15.4925 14.4426 14.6962C13.8639 15.5605 13.2482 16.3006 12.6204 16.9341ZM9.52737 16.9296C9.43788 16.8737 9.34548 16.8182 9.25005 16.7631C7.31205 15.6442 5.84818 15.6902 4.91199 15.9411C4.58 16.03 4.30141 16.1484 4.0805 16.2639C4.53358 17.1073 5.12461 17.8846 5.84359 18.5583C5.87614 18.5513 5.90977 18.5439 5.94444 18.5361C6.44532 18.4223 7.15871 18.2112 7.97658 17.8245C8.4626 17.5947 8.98712 17.3022 9.52737 16.9296ZM7.92672 20.018C8.21347 19.909 8.51642 19.7815 8.83145 19.6326C9.54844 19.2936 10.3256 18.8442 11.1145 18.2503C11.6989 18.9202 11.9873 19.5728 12.131 20.109C12.2199 20.4409 12.2567 20.7413 12.2672 20.9903C10.8031 21.0352 9.31171 20.7231 7.92672 20.018ZM18.6461 15.2714C17.8061 14.612 16.7364 13.8204 15.4558 12.968C15.9672 11.9634 16.3317 10.9922 16.5833 10.0701C17.7521 10.2998 18.7704 10.2145 19.6057 9.99072C20.0114 9.88202 20.3659 9.74284 20.6666 9.59846C21.2688 11.7723 21.0579 14.1701 19.9008 16.2957C19.5666 16.011 19.147 15.6645 18.6461 15.2714ZM16.9702 8.10789C17.8425 8.27902 18.5519 8.20254 19.0881 8.05887C19.42 7.96992 19.6986 7.85154 19.9195 7.73607C19.2263 6.44565 18.2102 5.3101 16.907 4.46319C16.956 4.76614 16.9971 5.09234 17.0257 5.43977C17.0906 6.23015 17.09 7.1278 16.9702 8.10789ZM15.0328 7.39372C15.0854 6.73963 15.0764 6.13922 15.0324 5.60348C14.9583 4.70183 14.7845 3.97847 14.6326 3.4878C14.622 3.45374 14.6116 3.42082 14.6013 3.38905C13.6584 3.10331 12.6898 2.9801 11.7329 3.00943C11.7433 3.2585 11.7801 3.55897 11.8691 3.89097C12.1199 4.82716 12.812 6.11791 14.75 7.23681C14.8454 7.2919 14.9397 7.34416 15.0328 7.39372Z",fill:"currentColor"})}):e===1?o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",className:l,children:[o.jsx("path",{d:"M5.51971 11.6679C5.38628 12.0125 4.9682 12.1706 4.61602 12.0587C4.26384 11.9468 4.07911 11.593 4.17097 11.2351L4.30609 10.7086C4.41418 10.2874 4.80736 10.021 5.22175 10.1526C5.63614 10.2843 5.87297 10.7555 5.71598 11.161L5.51971 11.6679Z",fill:"currentColor"}),o.jsx("path",{d:"M8.01677 12.9936C7.80606 13.2969 7.37725 13.3614 7.06167 13.1697C6.74609 12.9779 6.63437 12.5827 6.80738 12.2565L7.06187 11.7766C7.26583 11.392 7.72803 11.2343 8.10009 11.4604C8.47215 11.6864 8.57514 12.1901 8.32672 12.5476L8.01677 12.9936Z",fill:"currentColor"}),o.jsx("path",{d:"M9.17133 14.8286C8.90951 14.5668 8.88327 14.1441 9.12924 13.8673L9.48892 13.4626C9.77806 13.1372 10.2777 13.1066 10.5855 13.4144C10.8933 13.7222 10.8627 14.2218 10.5373 14.511L10.1326 14.8707C9.85584 15.1166 9.43315 15.0904 9.17133 14.8286Z",fill:"currentColor"}),o.jsx("path",{d:"M11.7434 17.1925C11.4172 17.3655 11.022 17.2538 10.8302 16.9382C10.6385 16.6227 10.7031 16.1939 11.0063 15.9831L11.4523 15.6732C11.8098 15.4248 12.3135 15.5278 12.5395 15.8998C12.7656 16.2719 12.6079 16.7341 12.2233 16.938L11.7434 17.1925Z",fill:"currentColor"}),o.jsx("path",{d:"M12.7648 19.8289C12.4069 19.9208 12.0531 19.7361 11.9412 19.3839C11.8293 19.0317 11.9874 18.6136 12.332 18.4802L12.839 18.2839C13.2444 18.1269 13.7156 18.3638 13.8473 18.7782C13.979 19.1926 13.7125 19.5857 13.2913 19.6938L12.7648 19.8289Z",fill:"currentColor"}),o.jsx("path",{d:"M19.829 12.7649C19.9209 12.407 19.7362 12.0532 19.384 11.9413C19.0318 11.8294 18.6137 11.9875 18.4803 12.3321L18.284 12.839C18.127 13.2445 18.3639 13.7157 18.7782 13.8474C19.1926 13.979 19.5858 13.7126 19.6939 13.2914L19.829 12.7649Z",fill:"currentColor"}),o.jsx("path",{d:"M17.1926 11.7435C17.3656 11.4173 17.2539 11.0221 16.9383 10.8303C16.6228 10.6386 16.1939 10.7031 15.9832 11.0064L15.6733 11.4524C15.4249 11.8099 15.5279 12.3136 15.8999 12.5396C16.272 12.7657 16.7342 12.608 16.9381 12.2234L17.1926 11.7435Z",fill:"currentColor"}),o.jsx("path",{d:"M14.8708 10.1327C15.1167 9.85592 15.0905 9.43324 14.8287 9.17142C14.5668 8.9096 14.1442 8.88336 13.8674 9.12932L13.4627 9.489C13.1373 9.77815 13.1067 10.2778 13.4145 10.5856C13.7223 10.8934 14.2219 10.8628 14.5111 10.5374L14.8708 10.1327Z",fill:"currentColor"}),o.jsx("path",{d:"M12.9937 8.01685C13.2969 7.80615 13.3615 7.37733 13.1698 7.06175C12.978 6.74618 12.5828 6.63446 12.2566 6.80746L11.7767 7.06195C11.3921 7.26592 11.2344 7.72812 11.4605 8.10017C11.6865 8.47223 12.1902 8.57523 12.5477 8.32681L12.9937 8.01685Z",fill:"currentColor"}),o.jsx("path",{d:"M11.668 5.51979C12.0126 5.38637 12.1707 4.96829 12.0588 4.61611C11.9469 4.26393 11.5931 4.0792 11.2352 4.17106L10.7087 4.30618C10.2875 4.41426 10.021 4.80745 10.1527 5.22184C10.2844 5.63623 10.7556 5.87306 11.161 5.71606L11.668 5.51979Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22.9999 11.9998C22.9999 18.0749 18.075 22.9998 11.9999 22.9998C5.92478 22.9998 0.999908 18.0749 0.999908 11.9998C0.999908 5.92462 5.92478 0.999756 11.9999 0.999756C18.075 0.999756 22.9999 5.92462 22.9999 11.9998ZM3.00674 11.9998C3.00674 16.9665 7.03312 20.9929 11.9999 20.9929C16.9667 20.9929 20.9931 16.9665 20.9931 11.9998C20.9931 7.03297 16.9667 3.00659 11.9999 3.00659C7.03312 3.00659 3.00674 7.03297 3.00674 11.9998Z",fill:"currentColor"})]}):e===2?o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",className:l,children:[o.jsx("path",{d:"M10.7071 9.70711C11.0976 9.31658 11.0976 8.68342 10.7071 8.29289C10.3166 7.90237 9.68342 7.90237 9.29289 8.29289L8.29289 9.29289C7.90237 9.68342 7.90237 10.3166 8.29289 10.7071C8.68342 11.0976 9.31658 11.0976 9.70711 10.7071L10.7071 9.70711Z",fill:"currentColor"}),o.jsx("path",{d:"M13.2071 10.7929C13.5976 11.1834 13.5976 11.8166 13.2071 12.2071L12.2071 13.2071C11.8166 13.5976 11.1834 13.5976 10.7929 13.2071C10.4024 12.8166 10.4024 12.1834 10.7929 11.7929L11.7929 10.7929C12.1834 10.4024 12.8166 10.4024 13.2071 10.7929Z",fill:"currentColor"}),o.jsx("path",{d:"M15.7071 14.7071C16.0976 14.3166 16.0976 13.6834 15.7071 13.2929C15.3166 12.9024 14.6834 12.9024 14.2929 13.2929L13.2929 14.2929C12.9024 14.6834 12.9024 15.3166 13.2929 15.7071C13.6834 16.0976 14.3166 16.0976 14.7071 15.7071L15.7071 14.7071Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.7071 5.29294C16.5018 3.08765 13.0209 1.78137 9.9144 1.26361C8.34616 1.00223 6.81617 0.931586 5.52031 1.068C4.2792 1.19865 3.04597 1.53983 2.29288 2.29295C1.5398 3.04607 1.19864 4.27929 1.06799 5.52041C0.931588 6.81626 1.00223 8.3462
41626 1.2636 9.9145C1.78136 13.021 3.08762 16.5019 5.2929 18.7072C7.49817 20.9124 10.9791 22.2186 14.0856 22.7364C15.6538 22.9978 17.1838 23.0684 18.4797 22.932C19.7208 22.8014 20.954 22.4602 21.7071 21.7072C22.4602 20.9541 22.8014 19.7208 22.932 18.4797C23.0684 17.1839 22.9978 15.6539 22.7364 14.0857C22.2186 10.9791 20.9124 7.49823 18.7071 5.29294ZM3.70712 3.70714C3.95403 3.46022 4.5958 3.17637 5.72969 3.05701C6.75757 2.9488 8.02665 2.99298 9.38216 3.20363L3.20362 9.38217C2.99298 8.0267 2.94881 6.75765 3.057 5.72977C3.17636 4.59588 3.4602 3.95407 3.70712 3.70714ZM3.71327 11.7009C4.33523 13.876 5.34913 15.935 6.7071 17.2929C8.06506 18.6509 10.124 19.6648 12.2991 20.2867L20.2867 12.2991C19.6647 10.124 18.6508 8.06511 17.2929 6.70715C15.9349 5.34917 13.876 4.33526 11.7009 3.7133L3.71327 11.7009ZM18.2703 20.943C17.2424 21.0512 15.9733 21.007 14.6178 20.7964L20.7964 14.6178C21.007 15.9734 21.0512 17.2425 20.943 18.2704C20.8236 19.4043 20.5398 20.046 20.2929 20.2929C20.046 20.5398 19.4042 20.8237 18.2703 20.943Z",fill:"currentColor"})]}):e===3?o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",className:l,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22.9999 11.9998C22.9999 18.0749 18.075 22.9998 11.9999 22.9998C5.92478 22.9998 0.999908 18.0749 0.999908 11.9998C0.999908 5.92462 5.92478 0.999756 11.9999 0.999756C18.075 0.999756 22.9999 5.92462 22.9999 11.9998ZM3.00674 11.9998C3.00674 14.5875 4.09974 16.92 5.84927 18.5608C6.0769 18.2328 6.34676 17.808 6.61709 17.2997C7.31622 15.9851 8 14.1476 8 12C8 9.85239 7.31622 8.01489 6.61709 6.7003C6.34668 6.19183 6.07674 5.7669 5.84906 5.43891C4.09965 7.07965 3.00674 9.41207 3.00674 11.9998ZM11.9999 20.9929C10.3404 20.9929 8.78593 20.5434 7.45152 19.7596C7.72696 19.3672 8.05519 18.855 8.38291 18.2388C9.18378 16.7329 10 14.5704 10 12C10 9.42961 9.18378 7.26711 8.38291 5.7612C8.0551 5.14481 7.72676 4.6325 7.45127 4.24005C8.78574 3.45612 10.3403 3.00659 11.9999 3.00659C13.6595 3.00659 15.2142 3.45615 16.5487 4.24013C16.2732 4.63257 15.9449 5.14485 15.6171 5.7612C14.8162 7.26711 14 9.42961 14 12C14 14.5704 14.8162 16.7329 15.6171 18.2388C15.9448 18.855 16.273 19.3671 16.5484 19.7595C15.214 20.5434 13.6594 20.9929 11.9999 20.9929ZM18.1507 18.5607C19.9001 16.9199 20.9931 14.5875 20.9931 11.9998C20.9931 9.41213 19.9002 7.07975 18.1509 5.43901C17.9232 5.76699 17.6533 6.19189 17.3829 6.7003C16.6838 8.01489 16 9.85239 16 12C16 14.1476 16.6838 15.9851 17.3829 17.2997C17.6532 17.808 17.923 18.2328 18.1507 18.5607Z",fill:"currentColor"})}):o.jsxs("svg",{viewBox:"0 0 928.6 928.6",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",className:l,children:[o.jsx("path",{d:"M361.2,578.801c4,12.398,15.5,20.699,28.5,20.699h149c13,0,24.5-8.4,28.5-20.699L613.3,437.1c4-12.4-0.4-25.9-10.9-33.5 l-120.5-87.7c-10.5-7.6-24.8-7.6-35.3,0L326,403.5c-10.5,7.601-14.9,21.2-10.9,33.5L361.2,578.801z",fill:"currentColor"}),o.jsx("path",{d:"M136,792.6c42.6,42.6,92.3,76.1,147.6,99.5c57.3,24.201,118.101,36.5,180.7,36.5s123.5-12.299,180.7-36.5 c55.3-23.4,104.899-56.9,147.6-99.5C835.2,750,868.7,700.301,892.1,645c24.2-57.301,36.5-118.1,36.5-180.699 c0-62.701-12.3-123.501-36.5-180.701C868.7,228.3,835.2,178.7,792.6,136C750,93.4,700.3,59.9,645,36.5C587.8,12.3,527,0,464.3,0 S340.8,12.3,283.6,36.5C228.3,59.9,178.6,93.4,136,136c-42.6,42.6-76.1,92.3-99.5,147.6C12.3,340.8,0,401.7,0,464.301 C0,527,12.3,587.801,36.5,645C59.9,700.4,93.4,750,136,792.6z M189,189c40.6-40.6,88.6-71.1,141-90.3l-10.5,22.7 c-6.9,14.7-0.7,32.3,13.8,39.5l116.5,58c8.5,4.2,18.5,4.2,26.9-0.1l116-58.9c14.6-7.4,20.6-25,13.6-39.7l-10.7-22.6 c53.5,19.1,102.601,50,144,91.4c7.9,7.9,15.4,16,22.5,24.4l-24.7-2.2c-16.199-1.4-30.6,10.3-32.399,26.5L690.2,367 c-1.101,9.4,2.399,18.801,9.3,25.301l94.899,89c11.9,11.1,30.4,10.799,41.9-0.801l17.4-17.6c0,0.4,0,0.9,0,1.299 c0,76.102-21.7,149-62.2,211.4l-5.2-24.4c-3.4-15.898-18.8-26.199-34.8-23.199l-128,23.699C614.2,653.4,606.2,659.5,602,668 l-57.3,116.9c-7.2,14.6-1.4,32.199,13,39.799l22.1,11.602c-36.9,11.398-75.8,17.299-115.5,17.299s-78.6-5.9-115.5-17.299 l22.1-11.602c14.4-7.5,20.2-25.199,13-39.799L326.6,668.1c-4.2-8.5-12.1-14.6-21.5-16.299l-128-23.701 c-16-3-31.4,7.301-34.8,23.201l-5.2,24.398C96.6,613.301,74.9,540.5,74.9,464.301c0-0.401,0-0.901,0-1.301l17.4,17.6 c11.4,11.6,30,11.9,41.9,0.801l94.9-89c6.9-6.5,10.4-15.9,9.3-25.3l-14.8-129.3c-1.8-16.2-16.2-27.9-32.4-26.5l-24.7,2.2 C173.6,205.1,181.1,196.9,189,189z",fill:"
4162currentColor"})]})}const Ld={home:AR,tv:wo,movies:Q6,sports:fN,anime:hN};function iX({savedPreferences:n,selectedNavItemIds:e,onToggleNavItem:t,onReset:i,onSubmit:r,isLoading:l,isSaving:u,error:h,success:d}){const p=new Set(e),m=A1.filter(y=>p.has(y.id)),g=e.join("|")!==n.primaryNavItemIds.join("|"),b=e.join("|")===_a.join("|");return o.jsxs("section",{className:"rounded-2xl border border-white/10 bg-zinc-900/65 p-4 shadow-[0_10px_45px_-30px_rgba(0,0,0,0.9)] md:p-6",children:[o.jsxs("div",{className:"flex flex-col gap-2 border-b border-white/10 pb-4 md:flex-row md:items-end md:justify-between",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-white",children:"Preferences"}),o.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Choose which main sections appear in your signed-in navigation. The same layout will follow your account across devices."})]}),o.jsx("p",{className:"text-xs text-zinc-500",children:"This only changes shortcuts, not which pages your account can access."})]}),o.jsxs("div",{className:"mt-4 rounded-xl border border-white/10 bg-black/25 p-4",children:[o.jsx("p",{className:"text-[11px] uppercase tracking-[0.18em] text-zinc-500",children:"Navbar Preview"}),o.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:m.map(y=>{const _=Ld[y.id];return o.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-orange-400/20 bg-orange-500/10 px-3 py-1.5 text-sm font-medium text-orange-100",children:[o.jsx(_,{className:"h-4 w-4"}),y.mobileLabel||y.label]},y.id)})})]}),o.jsxs("form",{onSubmit:r,className:"mt-4 space-y-4",children:[o.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:A1.map(y=>{const _=p.has(y.id),C=_&&e.length===1,w=Ld[y.id];return o.jsx("button",{type:"button",onClick:()=>t(y.id),"aria-pressed":_,disabled:C,className:`rounded-2xl border p-4 text-left transition ${_?"border-orange-400/40 bg-orange-500/10 text-white shadow-[0_16px_45px_-28px_rgba(249,115,22,0.55)]":"border-white/10 bg-zinc-950/70 text-zinc-200 hover:border-white/25 hover:bg-zinc-950"} ${C?"cursor-not-allowed opacity-70":""}`,children:o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:`inline-flex h-10 w-10 items-center justify-center rounded-2xl border ${_?"border-orange-400/25 bg-orange-500/10 text-orange-100":"border-white/10 bg-white/5 text-zinc-300"}`,children:o.jsx(w,{className:"h-5 w-5"})}),o.jsxs("div",{children:[o.jsx("p",{className:"text-base font-semibold",children:y.label}),y.mobileLabel&&o.jsxs("p",{className:"text-xs uppercase tracking-[0.14em] text-zinc-500",children:["Mobile label: ",y.mobileLabel]})]})]}),o.jsx("p",{className:"mt-2 text-sm text-zinc-400",children:y.description})]}),o.jsx("span",{className:`inline-flex rounded-full px-2.5 py-1 text-[11px] font-semibold uppercase tracking-[0.14em] ${_?"bg-orange-400/15 text-orange-100":"bg-white/5 text-zinc-500"}`,children:_?"Shown":"Hidden"})]})},y.id)})}),o.jsx("p",{className:"text-xs text-zinc-500",children:"At least one primary section must stay enabled."}),l&&o.jsx("p",{className:"rounded-xl border border-white/10 bg-zinc-950/60 px-3 py-2 text-sm text-zinc-400",children:"Loading saved preferences..."}),h&&o.jsx("p",{className:"rounded-xl border border-red-500/40 bg-red-500/10 px-3 py-2 text-sm text-red-200",children:h}),d&&o.jsx("p",{className:"rounded-xl border border-emerald-500/40 bg-emerald-500/10 px-3 py-2 text-sm text-emerald-200",children:d}),o.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[o.jsxs("button",{type:"button",onClick:i,disabled:u||b,className:"inline-flex items-center justify-center gap-2 rounded-xl border border-white/15 bg-zinc-950 px-4 py-2.5 text-sm font-bold text-white transition hover:border-white/35 hover:bg-zinc-900 disabled:cursor-not-allowed disabled:opacity-50",children:[o.jsx(JR,{className:"h-4 w-4"}),"Reset to defaults"]}),o.jsx("button",{type:"submit",disabled:u||!g,className:"inline-flex items-center justify-center rounded-xl bg-[#E25E0C] px-4 py-2.5 text-sm font-bold text-white transition hover:bg-[#f76c15] disabled:cursor-not-allowed disabled:opacity-60",children:u?"Saving preferences...":"Save preferences"})]})]})]})}const r6="profile-pictures",_y="https://watch-server-production-c01b.up.railway.app/
4162api";function sX(n){const e=new Date(n);return Number.isNaN(e.getTime())?"Recently":e.toLocaleString()}function rX({walletAddress:n,onClose:e}){return o.jsx("div",{className:"fixed inset-0 z-220 flex items-center justify-center bg-black/80 px-4 py-6 backdrop-blur-md animate-fade-in",onClick:e,children:o.jsxs("div",{className:"relative w-full max-w-sm rounded-4xl border border-white/10 bg-[#0a0a0a] p-6 text-white shadow-[0_20px_80px_-45px_rgba(0,0,0,0.95)]",onClick:t=>t.stopPropagation(),children:[o.jsx("button",{type:"button",onClick:e,className:"absolute right-4 top-4 inline-flex h-9 w-9 items-center justify-center rounded-full border border-white/10 bg-white/5 text-zinc-300 transition hover:border-white/25 hover:text-white","aria-label":"Close wallet QR code",children:o.jsx(Ar,{className:"h-4 w-4"})}),o.jsxs("div",{className:"pr-12",children:[o.jsx("p",{className:"text-[11px] uppercase tracking-[0.18em] text-zinc-500",children:"Receive PYRO"}),o.jsx("h2",{className:"mt-2 text-2xl font-black text-white",children:"Wallet QR Code"}),o.jsx("p",{className:"mt-2 text-sm text-zinc-400",children:"Scan this code to fill the destination wallet when sending tokens."})]}),o.jsx("div",{className:"mt-6 flex justify-center rounded-3xl border border-white/10 bg-white p-4 shadow-inner",children:o.jsx(cN,{value:n,size:220,marginSize:2})}),o.jsxs("div",{className:"mt-4 rounded-2xl border border-white/10 bg-zinc-950/80 px-4 py-3",children:[o.jsx("p",{className:"text-[11px] uppercase tracking-[0.18em] text-zinc-500",children:"Wallet Address"}),o.jsx("p",{className:"mt-2 break-all font-mono text-sm text-zinc-200",children:n})]})]})})}async function aX(n){const e=await fetch(`${_y}/users/referral`,{method:"GET",headers:{Authorization:`Bearer ${n}`}});if(!e.ok){const i=await e.text().catch(()=>"");throw new Error(i||e.statusText||"Failed to load referral summary")}return(await e.json()).referral||{own_referral_code:null,referred_by:null,earnings:{total_earned_pyro:0,unlock_count:0},can_set_own_referral_code:!0,can_set_referred_by:!0}}async function oX(n,e){const t=await fetch(`${_y}/users/referral/code`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({referralCode:e})}),i=await t.json().catch(()=>null);if(!t.ok)throw new Error(i?.error||"Failed to save referral code");if(!i?.referral)throw new Error("Referral code response was incomplete.");return i.referral}async function lX(n,e){const t=await fetch(`${_y}/users/referral/apply`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({referralCode:e})}),i=await t.json().catch(()=>null);if(!t.ok)throw new Error(i?.error||"Failed to apply referral code");if(!i?.referral)throw new Error("Referral application response was incomplete.");return i.referral}function a6({title:n,items:e,emptyMessage:t,onOpen:i,onRemove:r,onClear:l}){return o.jsxs("section",{className:"rounded-2xl border border-white/10 bg-zinc-900/65 p-4 shadow-[0_10px_45px_-30px_rgba(0,0,0,0.9)] md:p-6",children:[o.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3 border-b border-white/10 pb-4",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-white",children:n}),o.jsxs("p",{className:"mt-1 text-xs text-zinc-400",children:[e.length," saved"]})]}),e.length>0&&o.jsxs("button",{type:"button",onClick:l,className:"inline-flex items-center gap-1 rounded-md border border-white/15 px-3 py-1.5 text-xs text-zinc-300 hover:text-white hover:border-white/40 transition",children:[o.jsx(f8,{className:"h-3.5 w-3.5"}),"Clear all"]})]}),e.length===0?o.jsx("p",{className:"rounded-lg border border-dashed border-white/10 bg-zinc-950/50 px-4 py-8 text-center text-sm text-zinc-400",children:t}):o.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-5",children:e.map(u=>o.jsxs("article",{className:"group overflow-hidden rounded-xl border border-white/10 bg-black/40 transition duration-300 hover:-translate-y-1 hover:border-white/30 hover:shadow-[0_12px_35
4162px_-18px_rgba(255,255,255,0.4)]",children:[o.jsxs("button",{type:"button",onClick:()=>i(u),className:"relative block w-full text-left",children:[o.jsx("div",{className:"aspect-2/3 w-full bg-zinc-800",children:u.posterImage||u.image?o.jsx("img",{src:u.posterImage||u.image,alt:u.title,className:"h-full w-full object-cover"}):o.jsx("div",{className:"flex h-full w-full items-center justify-center text-xs text-zinc-500",children:"No image"})}),o.jsx("div",{className:"pointer-events-none absolute inset-0 bg-linear-to-t from-black/90 via-black/30 to-transparent opacity-70 transition group-hover:opacity-90"}),o.jsxs("div",{className:"absolute inset-x-0 bottom-0 p-3",children:[o.jsx("p",{className:"line-clamp-2 text-sm font-semibold text-white",children:u.title}),o.jsxs("p",{className:"mt-1 text-xs text-zinc-300",children:[u.type==="tv"?"TV Show":"Movie",u.year?` ⢠${u.year}`:""]})]})]}),o.jsxs("div",{className:"flex items-center justify-between gap-2 border-t border-white/10 px-3 py-2",children:[o.jsxs("span",{className:"text-[11px] text-zinc-500",children:["Saved ",sX(u.addedAt)]}),o.jsx("button",{type:"button",onClick:()=>r(u.watchParam),className:"rounded-md border border-white/15 px-2 py-1 text-[11px] text-zinc-300 hover:text-white hover:border-white/40 transition",children:"Remove"})]})]},u.watchParam))})]})}function cX({currentEmail:n,pendingEmail:e,onPendingEmailChange:t,isUpdatingEmail:i,emailError:r,emailSuccess:l,onSubmitEmail:u,newPassword:h,confirmPassword:d,onNewPasswordChange:p,onConfirmPasswordChange:m,isUpdatingPassword:g,passwordError:b,passwordSuccess:y,onSubmitPassword:_}){return o.jsxs("section",{className:"rounded-2xl border border-white/10 bg-zinc-900/65 p-4 shadow-[0_10px_45px_-30px_rgba(0,0,0,0.9)] md:p-6",children:[o.jsxs("div",{className:"flex flex-col gap-2 border-b border-white/10 pb-4 md:flex-row md:items-end md:justify-between",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-white",children:"Account Security"}),o.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Update your sign-in email or replace your password without leaving this page."})]}),o.jsx("p",{className:"text-xs text-zinc-500",children:"Some email changes may require inbox confirmation before they take effect."})]}),o.jsxs("div",{className:"mt-4 grid gap-4 xl:grid-cols-2",children:[o.jsxs("form",{onSubmit:u,className:"rounded-xl border border-white/10 bg-black/25 p-4",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:"rounded-lg border border-white/10 bg-zinc-950/80 p-2 text-zinc-200",children:o.jsx(FR,{className:"h-4 w-4"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base font-semibold text-white",children:"Change Email"}),o.jsxs("p",{className:"mt-1 text-sm text-zinc-400",children:["Current email: ",o.jsx("span",{className:"font-medium text-zinc-200",children:n||"No email on file"})]})]})]}),o.jsxs("label",{className:"mt-4 block",children:[o.jsx("span",{className:"mb-1.5 block text-sm font-medium text-zinc-300",children:"New email address"}),o.jsx("input",{type:"email",value:e,onChange:C=>t(C.target.value),className:"w-full rounded-xl border border-white/10 bg-zinc-950/90 px-3.5 py-2.5 text-sm text-white outline-none transition placeholder:text-zinc-500 focus:border-[#E25E0C]",placeholder:"[email protected]",autoComplete:"email",required:!0})]}),r&&o.jsx("p",{className:"mt-4 rounded-xl border border-red-500/40 bg-red-500/10 px-3 py-2 text-sm text-red-200",children:r}),l&&o.jsx("p",{className:"mt-4 rounded-xl border border-emerald-500/40 bg-emerald-500/10 px-3 py-2 text-sm text-emerald-200",children:l}),o.jsx("button",{type:"submit",disabled:i,className:"mt-4 inline-flex items-center justify-center rounded-xl bg-[#E25E0C] px-4 py-2.5 text-sm font-bold text-white transition hover:bg-[#f76c15] disabled:cursor-not-allowed disabled:opacity-60",children:i?"Updating email...":"Save email"})]}),o.jsxs("form",{onSubmit:_,className:"rounded-xl border border-white/10 bg-black/25 p-4",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:"rounded-lg border border-white/10 bg-zinc-950/80 p-2 text-zinc-200",children:o.jsx(LR,{className:"h-4 w-4"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base font-semibold text-white",children:"Change Password"}),o.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Use at least 6 characters. Youâll stay signed in after a successful update."})]})]}),o.jsxs("div",{className:"mt-4 grid gap-4",children:[o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-sm font-medium text-zinc-300",children:"New password"}),o.jsx("input",{type:"password",value:h,onChange:C=>p(C.target.value),className:"w-full rounded-xl border border-white/10 bg-zinc-950/90 px-3.5 py-2.5 text-sm text-white outline-none transition placeholder:text-zinc-500 focus:border-[#
4162E25E0C]",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",autoComplete:"new-password",required:!0})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-sm font-medium text-zinc-300",children:"Confirm new password"}),o.jsx("input",{type:"password",value:d,onChange:C=>m(C.target.value),className:"w-full rounded-xl border border-white/10 bg-zinc-950/90 px-3.5 py-2.5 text-sm text-white outline-none transition placeholder:text-zinc-500 focus:border-[#E25E0C]",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",autoComplete:"new-password",required:!0})]})]}),b&&o.jsx("p",{className:"mt-4 rounded-xl border border-red-500/40 bg-red-500/10 px-3 py-2 text-sm text-red-200",children:b}),y&&o.jsx("p",{className:"mt-4 rounded-xl border border-emerald-500/40 bg-emerald-500/10 px-3 py-2 text-sm text-emerald-200",children:y}),o.jsx("button",{type:"submit",disabled:g,className:"mt-4 inline-flex items-center justify-center rounded-xl bg-[#E25E0C] px-4 py-2.5 text-sm font-bold text-white transition hover:bg-[#f76c15] disabled:cursor-not-allowed disabled:opacity-60",children:g?"Updating password...":"Save password"})]})]})]})}function uX({referralSummary:n,ownReferralCodeInput:e,onOwnReferralCodeChange:t,applyReferralCodeInput:i,onApplyReferralCodeChange:r,onSubmitOwnReferralCode:l,onSubmitApplyReferralCode:u,isLoading:h,isSavingOwnCode:d,isApplyingReferral:p,copiedReferralCode:m,onCopyReferralCode:g,loadError:b,ownCodeError:y,ownCodeSuccess:_,applyCodeError:C,applyCodeSuccess:w}){const S=n?.own_referral_code||null,T=S?uN(S):null,N=n?.referred_by||null,j=Number(n?.earnings?.total_earned_pyro||0),O=Number(n?.earnings?.unlock_count||0);return o.jsxs("section",{className:"rounded-2xl border border-white/10 bg-zinc-900/65 p-4 shadow-[0_10px_45px_-30px_rgba(0,0,0,0.9)] md:p-6",children:[o.jsxs("div",{className:"flex flex-col gap-2 border-b border-white/10 pb-4 md:flex-row md:items-end md:justify-between",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-white",children:"Referral"}),o.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"When a referred user unlocks a movie or series, 10% of the PYRO they spend is routed to the referrer instead of being burned."})]}),o.jsx("p",{className:"text-xs text-zinc-500",children:"Referral codes and referred-by links are permanent once saved."})]}),o.jsxs("div",{className:"mt-4 grid gap-4 xl:grid-cols-[1.15fr_0.85fr]",children:[o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"rounded-xl border border-white/10 bg-black/25 p-4",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-[11px] uppercase tracking-[0.18em] text-zinc-500",children:"Your Referral Code"}),o.jsx("p",{className:"mt-2 text-lg font-black text-white",children:S||"Not set yet"}),T&&o.jsx("p",{className:"mt-2 break-all text-xs text-zinc-400",children:T})]}),o.jsx("button",{type:"button",onClick:g,disabled:!S,className:"inline-flex h-9 w-9 items-center justify-center rounded-lg border border-white/15 bg-zinc-950/80 text-zinc-200 transition hover:border-white/35 hover:text-white disabled:opacity-40","aria-label":"Copy referral link",children:m?o.jsx(zr,{className:"h-4 w-4"}):o.jsx(Wc,{className:"h-4 w-4"})})]}),n?.can_set_own_referral_code?o.jsxs("form",{onSubmit:l,className:"mt-4 space-y-3",children:[o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-sm font-medium text-zinc-300",children:"Create your code"}),o.jsx("input",{type:"text",value:e,onChange:R=>t(R.target.value),className:"w-full rounded-xl border border-white/10 bg-zinc-950/90 px-3.5 py-2.5 text-sm uppercase tracking-[0.08em] text-white outline-none transition placeholder:text-zinc-500 focus:border-[#E25E0C]",placeholder:"PYROFAN",maxLength:24})]}),y&&o.jsx("p",{className:"rounded-xl border border-red-500/40 bg-red-500/10 px-3 py-2 text-sm text-red-200",children:y}),_&&o.jsx("p",{className:"rounded-xl border border-emerald-500/40 bg-emerald-500/10 px-3 py-2 text-sm text-emerald-200",children:_}),o.jsx("button",{type:"submit",disabled:d,className:"inline-flex items-center justify-center rounded-xl bg-[#E25E0C] px-4 py-2.5 text-sm font-bold text-white transition hover:bg-[#f76c15] disabled:cursor-not-allowed disabled:opacity-60",children:d?"Saving code...":"Save referral code"})]}):o.jsx("p",{className:"mt-4 text-sm text-zinc-400",children:"Your referral code is locked in and ready to share."})]}),o.jsxs("div",{className:"rounded-xl border border-white/10 bg-black/25 p-4",children:[o.jsx("p",{className:"text-[11px] uppercase tracking-[0.18em] text-zinc-500",children:"Your Referrer"}),N?o.jsxs("div",{className:"mt-3 space-y-2",children:[o.jsx("p",{className:"text-base font-semibold text-white",children:N.display_name}),o.jsxs("p",{className:"text-sm text-zinc-400",children:["Code: ",o.jsx("span",{className:"font-medium text-zinc-200",children:N.referral_code||"Unavailable"})]}),o.jsx("p",{className:"text-sm text-zinc-500",children:"Future movie and series unlocks from your wallet send 10% to this referrer."})]}):n?.can_set_referred_by?o.jsxs("form",{onSubmit:u,className:"mt-4 space-y-3",children:[o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-sm font-medium text-zinc-300",children:"Apply referral code"}),o.jsx("input",{type:"text",value:i,onChange:R=>r(R.target.value),className:"w-full rounded-xl border border-white/10 bg-zinc-950/90 px-3.5 py-2.5 text-sm uppercase tracking-[0.08em] text-white outline-none transition placeholder:text-zinc-500 focus:border-[#
4162E25E0C]",placeholder:"ENTER CODE",maxLength:24})]}),C&&o.jsx("p",{className:"rounded-xl border border-red-500/40 bg-red-500/10 px-3 py-2 text-sm text-red-200",children:C}),w&&o.jsx("p",{className:"rounded-xl border border-emerald-500/40 bg-emerald-500/10 px-3 py-2 text-sm text-emerald-200",children:w}),o.jsx("button",{type:"submit",disabled:p,className:"inline-flex items-center justify-center rounded-xl border border-white/15 bg-zinc-950 px-4 py-2.5 text-sm font-bold text-white transition hover:border-white/35 hover:bg-zinc-900 disabled:cursor-not-allowed disabled:opacity-60",children:p?"Applying...":"Apply referral code"})]}):o.jsx("p",{className:"mt-3 text-sm text-zinc-400",children:"Your referral source is already locked."})]})]}),o.jsxs("div",{className:"rounded-xl border border-white/10 bg-black/25 p-4",children:[o.jsx("p",{className:"text-[11px] uppercase tracking-[0.18em] text-zinc-500",children:"Referral Earnings"}),o.jsxs("p",{className:"mt-3 text-3xl font-black text-white",children:[j.toLocaleString(void 0,{maximumFractionDigits:3})," ",o.jsx("span",{className:"text-sm font-semibold text-zinc-400",children:"PYRO"})]}),o.jsxs("p",{className:"mt-2 text-sm text-zinc-400",children:["Earned from ",O.toLocaleString()," referred unlock",O===1?"":"s","."]}),o.jsx("div",{className:"mt-4 rounded-xl border border-emerald-400/15 bg-emerald-500/10 px-3 py-2 text-sm text-emerald-100",children:"Referral rewards land in the referrer wallet and are tracked here as total earned PYRO."}),h&&o.jsx("p",{className:"mt-4 text-sm text-zinc-500",children:"Loading referral details..."}),b&&o.jsx("p",{className:"mt-4 rounded-xl border border-red-500/40 bg-red-500/10 px-3 py-2 text-sm text-red-200",children:b})]})]})]})}function dX(){const n=js(),e=ml(),[t,i]=E.useState(null),[r,l]=E.useState(!0),[u,h]=E.useState([]),[d,p]=E.useState([]),[m,g]=E.useState(""),[b,y]=E.useState(""),[_,C]=E.useState(!1),[w,S]=E.useState(!1),[T,N]=E.useState(null),[j,O]=E.useState(!1),[R,z]=E.useState(null),[M,P]=E.useState(""),[G,U]=E.useState(""),[Y,W]=E.useState(null),[J,F]=E.useState(null),[$,V]=E.useState(null),[se,ue]=E.useState(null),[Ce,D]=E.useState(!1),[H,Z]=E.useState(!1),[Ee,je]=E.useState(!1),[le,Se]=E.useState(!1),[de,Me]=E.useState(null),[Le,pe]=E.useState(null),[Be,We]=E.useState(!1),[dt,Ct]=E.useState(""),[ut,kt]=E.useState(null),[K,Nt]=E.useState(null),[Tt,Mt]=E.useState(!1),[nt,I]=E.useState(""),[k,Q]=E.useState(""),[fe,be]=E.useState(null),[xe,Xe]=E.useState(null),[$e,it]=E.useState(!1),[ht,X]=E.useState(Ea),[oe,ke]=E.useState(_a),[Ae,De]=E.useState(null),[st,te]=E.useState(null),[Ie,Pe]=E.useState(!1),[Ze,ze]=E.useState(!1),ge=E.useMemo(()=>n.pathname==="/account"||n.pathname==="/account/security"?"security":n.pathname==="/account/preferences"?"preferences":n.pathname==="/account/referral"?"referral":n.pathname==="/account/history"?"history":n.pathname==="/account/stats"?"stats":"watch-later",[n.pathname]),Ye=t?.user_metadata?.username||t?.email?.split("@")[0]||"Viewer",pt=async()=>{const[L,q]=await Promise.all([N7(),T7()]);h(L),p(q)},Wt=async L=>{if(!Fe)return;const{data:q,error:ne}=await Fe.from("profiles").select("avatar_url, wallet_public, solana_wallet_public_key").eq("id",L).maybeSingle();if(ne){console.warn("Failed to load profile:",ne.message||ne);return}const re=q||null;g(re?.avatar_url||""),y(re?.wallet_public||re?.solana_wallet_public_key||"")},ce=async()=>{if(b)try{navigator?.clipboard?.writeText&&await navigator.clipboard.writeText(b),C(!0),setTimeout(()=>C(!1),1200)}catch{C(!1)}},Ge=E.useCallback(async()=>{if(!Fe||!t?.id){N(null),z(null);return}O(!0),z(null);try{const{data:{session:L}}=await Fe.auth.getSession(),q=L?.access_token;if(!q)return;const ne=await aX(q);N(ne)}catch(L){z(L instanceof Error?L.message:"Failed to load referral summary")}finally{O(!1)}},[t?.id]),vt=async()=>{const L=T?.own_referral_code,q=L?uN(L):null;if(q)try{navigator?.clipboard?.writeText&&await navigator.clipboard.writeText(q),je(!0),setTimeout(()=>je(!1),1200)}catch{je(!1)}},rn=async L=>{if(L.preventDefault(),!(!Fe||!t?.id)){W(null),F(null),D(!0);try{const{data:{session:q}}=await Fe.auth.getSession(),ne=q?.access_token;if(!ne)throw new Error("Please log in again to save your referral code.");const re=await oX(ne,M);N(re),P(""),F("Referral code saved. It cannot be changed now.")}catch(q){W(q instanceof Error?q.message:"Failed to save referral code")}finally{D(!1)}}},On=async L=>{if(L.preventDefault(),!(!Fe||!t?.id)){V(null),ue(null),Z(!0);try{const{data:{session:q}}=await Fe.auth.getSession(),ne=q?.access_token;if(!ne)throw new Error("Please log in again to apply a referral code.");const re=await lX(ne,G);N(re),U(""),ue("Referral code applied. Future unlocks will use this referrer.")}catch(q){V(q instanceof Error?q.message:"Failed to apply referral code")}finally{Z(!1)}}},Dn=async L=>{We(!0),pe(null);try{const q=await fv(L);Me(q.profile)}catch(q){pe(q instanceof Error?q.message:"Failed to load your profile"),Me(null)}finally{We(!1)}},Qn=E.useCallback(async L=>{Pe(!0),De(null);try{const q=await N5(L);X(q),ke(q.primaryNavItemIds)}catch(q){X(Ea),ke([..._a]),De(q instanceof Error?q.message:"Failed to load preferences.")}finally{Pe(!1)}},[]);E.useEffect(()=>{pt()},[]),E.useEffect(()=>{if(!t?.id){g(""),y(""),N(null),z(null),Me(null),pe(null),X(Ea),ke([..._a]),De(null),te(null);return}Wt(t.id),Ge(),Qn(t.id)},[t?.id,Qn,Ge]),E.useEffect(()=>{!t?.id||ge!=="stats"||de||Be||Dn(t.id)},[t?.id,ge,de,Be]),E.useEffect(()=>{Ct(t?.email||"")},[t?.email]),E.useEffect(()=>{if(!w)return;const L=q=>{q.key==="Escape"&&S(!1)};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[w]),E.useEffect(()=>{if(!Fe){l(!1);return}let L=!0;Fe.auth.getUser().then(({data:ne})=>{L&&(i(ne.user??null),l(!1))});const{data:{subscription:q}}=Fe.auth.onAuthStateChange((ne,re)=>{i(re?.user??null),l(!1)});return()=>{L=!1,q.unsubscribe()}},[]);const bi=L=>{const q=new URLSearchParams(n.search);q.set("watch",L.watchParam),e({pathname:n.pathname,search:`?${q.toString()}`})},qn=async L=>{const q=L.target.files?.[0];if(!(!q||!t||!Fe)){if(!q.type.startsWith("image/")){console.warn("Profile upload skipped: file is not an image.");return}Se(!0);try{const ne=(q.name.split(".").pop()||"jpg").toLowerCase(),re=`${t.id}/avatar-${Date.now()}.${ne}`,{error:me}=await Fe.storage.from(r6).upload(re,q,{upsert:!0,contentType:q.type});if(me)throw me;const{data:Je}=Fe.storage.from(r6).getPublicUrl(re),qe=Je?.publicUrl||"";if(!qe)throw new Error("Could not generate public profile image URL.");const{error:Qe}
4162=await Fe.from("profiles").upsert({id:t.id,avatar_url:qe,updated_at:new Date().toISOString()},{onConflict:"id"});if(Qe)throw Qe;g(qe),ge==="stats"&&Dn(t.id),window.dispatchEvent(new CustomEvent("profile:updated",{detail:{avatarUrl:qe}}))}catch(ne){console.error("Failed to upload profile picture:",ne)}finally{L.target.value="",Se(!1)}}},cs=async L=>{if(L.preventDefault(),!Fe||!t)return;const q=dt.trim().toLowerCase();if(kt(null),Nt(null),!q){kt("Enter an email address.");return}if(q===(t.email||"").trim().toLowerCase()){kt("Enter a different email address.");return}Mt(!0);try{const{data:ne,error:re}=await Fe.auth.updateUser({email:q});if(re)throw re;ne.user&&i(ne.user),Nt("Email update requested. Check your inbox to confirm the new address.")}catch(ne){kt(ne instanceof Error?ne.message:"Failed to update email.")}finally{Mt(!1)}},Jn=async L=>{if(L.preventDefault(),!(!Fe||!t)){if(be(null),Xe(null),nt.length<6){be("Password must be at least 6 characters.");return}if(nt!==k){be("Passwords do not match.");return}it(!0);try{const{error:q}=await Fe.auth.updateUser({password:nt});if(q)throw q;I(""),Q(""),Xe("Password updated successfully.")}catch(q){be(q instanceof Error?q.message:"Failed to update password.")}finally{it(!1)}}},xn=L=>{ke(q=>{const ne=q.includes(L)?q.filter(re=>re!==L):[...q,L];return Ip(ne)}),Ae&&De(null),st&&te(null)},Nn=()=>{ke([..._a]),Ae&&De(null),st&&te(null)},Si=async L=>{if(L.preventDefault(),!t?.id)return;const q=Ip(oe);if(De(null),te(null),q.length===0){De("Select at least one navigation item.");return}ze(!0);try{const ne=await o7(t.id,{primaryNavItemIds:q});X(ne),ke(ne.primaryNavItemIds),te("Preferences saved. Your account navigation will use this layout on any signed-in device.")}catch(ne){De(ne instanceof Error?ne.message:"Failed to save preferences.")}finally{ze(!1)}},Fi=ge==="watch-later",Li=ge==="history",vi=ge==="stats",Ks=ge==="security",we=ge==="preferences",He=ge==="referral",rt=b.trim(),Ke=Yc({avatarUrl:m,username:String(t?.user_metadata?.username||""),displayName:Ye,userId:t?.id||"",fallbackSeed:"viewer"}),lt=(L,q,ne)=>{const re=new URLSearchParams(n.search);ne?re.set("watch",ne):re.set("watch",`${L}-${q}`),re.delete("free"),e({pathname:n.pathname,search:`?${re.toString()}`})};if(r)return o.jsx("main",{className:"min-h-screen bg-zinc-950 px-4 pb-12 pt-28 text-white md:px-12",children:o.jsx("div",{className:"mx-auto max-w-5xl rounded-2xl border border-white/10 bg-zinc-900/70 p-6 text-sm text-zinc-300",children:"Loading account..."})});if(!t){const L=encodeURIComponent(`${n.pathname}${n.search}`);return o.jsx("main",{className:"min-h-screen bg-zinc-950 px-4 pb-12 pt-28 text-white md:px-12",children:o.jsxs("div",{className:"mx-auto max-w-3xl rounded-2xl border border-white/10 bg-zinc-900/70 p-6 text-center shadow-xl",children:[o.jsx("h1",{className:"text-2xl font-bold",children:"Account access required"}),o.jsx("p",{className:"mt-2 text-sm text-zinc-300",children:"Please log in to view your account, watch later list, and watch history."}),o.jsx(Ut,{to:`/login?next=${L}`,className:"mt-5 inline-flex rounded-md bg-[#E25E0C] px-4 py-2 text-sm font-bold text-white hover:bg-[#f76c15] transition",children:"Go to login"})]})})}return o.jsxs("main",{className:"relative min-h-screen bg-zinc-950 px-4 pb-12 pt-28 text-white md:px-12",children:[o.jsx("div",{className:"pointer-events-none fixed inset-0 z-0",children:o.jsx(Lm,{className:"h-full w-full"})}),w&&rt&&o.jsx(rX,{walletAddress:rt,onClose:()=>S(!1)}),o.jsx("div",{className:"relative z-10 mx-auto max-w-6xl space-y-5",children:o.jsxs("section",{className:"overflow-hidden rounded-3xl border border-white/20 bg-zinc-950/90 shadow-[0_35px_90px_-45px_rgba(0,0,0,1)]",children:[o.jsxs("div",{className:"relative border-b border-white/15 px-4 py-6 md:px-8",children:[o.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_15%_0%,rgba(249,115,22,0.18),transparent_42%),radial-gradient(circle_at_88%_14%,rgba(59,130,246,0.12),transparent_34%)]"}),o.jsxs("div",{className:"relative flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("div",{className:"relative h-18 w-18 overflow-hidden rounded-3xl border border-white/25 bg-zinc-900 shadow-xl",children:[o.jsx("img",{src:Ke,alt:`${Ye} avatar`,className:"h-full w-full object-cover"}),o.jsxs("label",{className:"absolute inset-0 m-auto inline-flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border border-white/30 bg-zinc-950/75 text-zinc-100 shadow-lg transition hover:border-orange-400 hover:text-orange-300",children:[o.jsx(Y6,{className:"h-4 w-4"}),o.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:qn,disabled:le})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-[11px] uppercase tracking-[0.2em] text-zinc-400",children:"My A
4162ccount"}),o.jsx("h1",{className:"mt-1 text-2xl font-black text-white md:text-3xl",children:Ye}),o.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:t.email}),le&&o.jsx("p",{className:"mt-2 text-xs font-semibold text-orange-300",children:"Uploading profile image..."})]})]}),o.jsx("p",{className:"max-w-xs text-xs text-zinc-400 sm:text-right",children:"Quick view only. Open the Stats tab for full profile metrics and activity."})]}),o.jsx("div",{className:"relative mt-4 rounded-2xl border border-white/10 bg-black/30 p-4",children:o.jsx("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-[11px] uppercase tracking-[0.18em] text-zinc-500",children:"$PYRO Wallet"}),o.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[o.jsx("p",{className:"break-all font-mono text-sm text-zinc-100",children:rt||"Generating wallet..."}),o.jsx("button",{type:"button",onClick:()=>{ce()},disabled:!rt,className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-white/20 bg-zinc-900/80 text-zinc-200 transition hover:border-white/40 hover:text-white disabled:opacity-40","aria-label":"Copy wallet",children:_?o.jsx(zr,{className:"h-4 w-4"}):o.jsx(Wc,{className:"h-4 w-4"})}),o.jsx("button",{type:"button",onClick:()=>S(!0),disabled:!rt,className:"inline-flex rounded-md border border-white/20 bg-zinc-900/80 px-3 py-1.5 text-xs font-semibold text-zinc-200 transition hover:border-white/40 hover:text-white disabled:opacity-40",children:"Show QR"})]}),o.jsxs("div",{className:"mt-2 inline-flex items-center gap-1.5 rounded-md border border-amber-400/20 bg-amber-500/10 px-2 py-1 text-[11px] text-amber-200",children:[o.jsx(ov,{className:"h-3.5 w-3.5"}),"Send only PYRO to this wallet."]})]})})})]}),o.jsx("div",{className:"border-b border-white/15 px-2 pb-3 pt-3 md:px-4",children:o.jsxs("div",{className:"grid grid-cols-2 gap-2 rounded-xl border border-white/10 bg-zinc-900/60 p-1 md:grid-cols-6",children:[o.jsx(Ut,{to:"/account/security",className:`rounded-lg px-3 py-2 text-center text-sm transition ${ge==="security"?"bg-zinc-100 text-zinc-900 font-semibold":"text-zinc-300 hover:bg-zinc-800/80 hover:text-white"}`,children:"Security"}),o.jsx(Ut,{to:"/account/preferences",className:`rounded-lg px-3 py-2 text-center text-sm transition ${ge==="preferences"?"bg-zinc-100 text-zinc-900 font-semibold":"text-zinc-300 hover:bg-zinc-800/80 hover:text-white"}`,children:"Preferences"}),o.jsx(Ut,{to:"/account/referral",className:`rounded-lg px-3 py-2 text-center text-sm transition ${ge==="referral"?"bg-zinc-100 text-zinc-900 font-semibold":"text-zinc-300 hover:bg-zinc-800/80 hover:text-white"}`,children:"Referral"}),o.jsx(Ut,{to:"/account/watch-later",className:`rounded-lg px-3 py-2 text-center text-sm transition ${ge==="watch-later"?"bg-zinc-100 text-zinc-900 font-semibold":"text-zinc-300 hover:bg-zinc-800/80 hover:text-white"}`,children:"Watch Later"}),o.jsx(Ut,{to:"/account/history",className:`rounded-lg px-3 py-2 text-center text-sm transition ${ge==="history"?"bg-zinc-100 text-zinc-900 font-semibold":"text-zinc-300 hover:bg-zinc-800/80 hover:text-white"}`,children:"History"}),o.jsx(Ut,{to:"/account/stats",className:`rounded-lg px-3 py-2 text-center text-sm transition ${ge==="stats"?"bg-zinc-100 text-zinc-900 font-semibold":"text-zinc-300 hover:bg-zinc-800/80 hover:text-white"}`,children:"Stats"})]})}),o.jsxs("div",{className:"space-y-4 p-4 md:p-6",children:[Ks&&o.jsx(cX,{currentEmail:t.email||"",pendingEmail:dt,onPendingEmailChange:L=>{Ct(L),ut&&kt(null),K&&Nt(null)},isUpdatingEmail:Tt,emailError:ut,emailSuccess:K,onSubmitEmail:cs,newPassword:nt,confirmPassword:k,onNewPasswordChange:L=>{I(L),fe&&be(null),xe&&Xe(null)},onConfirmPasswordChange:L=>{Q(L),fe&&be(null),xe&&Xe(null)},isUpdatingPassword:$e,passwordError:fe,passwordSuccess:xe,onSubmitPassword:Jn}),we&&o.jsx(iX,{savedPreferences:ht,selectedNavItemIds:oe,onToggleNavItem:xn,onReset:Nn,onSubmit:Si,isLoading:Ie,isSaving:Ze,error:Ae,success:st}),He&&o.jsx(uX,{referralSummary:T,ownReferralCodeInput:M,onOwnReferralCodeChange:L=>{P(L.toUpperCase()),Y&&W(null),J&&F(null)},applyReferralCodeInput:G,onApplyReferralCodeChange:L=>{U(L.toUpperCase()),$&&V(null),se&&ue(null)},onSubmitOwnReferralCode:rn,onSubmitApplyReferralCode:On,isLoading:j,isSavingOwnCode:Ce,isApplyingReferral:H,copiedReferralCode:Ee,onCopyReferralCode:()=>{vt()},loadError:R,ownCodeError:Y,ownCodeSuccess:J,applyCodeError:$,applyCodeSuccess:se}),Fi&&o.jsx(a6,{title:"Watch Later",emptyMessage:"No titles saved yet. Open a title and tap Watch Later.",items:u,onOpen:bi,onRemove:L=>{(async()=>(await A7(L),await pt()))()},onClear:()=>{(async()=>(await k7(),await pt()))()}}),Li&&o.jsx(a6,{title:"History",emptyMessage:"Your playback history will appear here once you start watching titles.",items:d,onOpen:bi,onRemove:L=>{(async()=>(await R7(L),await pt()))()},onClear:()=>{(async()=>(await j7(),await pt()))()}}),vi&&o.jsx(tX,{profile:de,isLoading:Be,error:Le,onRefresh:()=>{t?.id&&Dn(t.id)},onOpenWatch:lt})]})]})})]})}
4162const pp=60*1e3,o6={overall:{label:"Overall Heat",subtitle:"Total watch time across everything",icon:e5},movies:{label:"Movie Titans",subtitle:"Highest movie watch time",icon:cv},series:{label:"Series Grinders",subtitle:"Most TV episode watch time",icon:wo},anime:{label:"Anime Legends",subtitle:"Highest anime watch time",icon:pr},unlocks:{label:"Unlock Legends",subtitle:"Most titles unlocked for the community",icon:x1},season:{label:"Season Rank",subtitle:"Most season points earned",icon:_o}};function mp(n){return`${(Math.max(0,Number(n||0))/3600).toFixed(1)}h`}function l6(n,e){return n==="movies"?mp(e.movie_watch_seconds):n==="series"?mp(e.series_watch_seconds):n==="anime"?mp(e.anime_watch_seconds):n==="unlocks"?`${Math.max(0,Number(e.unlocks_count||0)).toLocaleString()}`:n==="season"?`${Math.max(0,Number(e.season_points||0)).toLocaleString()} SP`:mp(e.total_watch_seconds)}function c6(n){return n==="unlocks"?"Unlocks":n==="season"?"Season Points":"Watch Time"}function u6(n){return n.username?`@${n.username}`:n.display_name?n.display_name:"Unknown Viewer"}function d6(n){return Yc({avatarUrl:n.avatar_url,username:n.username,displayName:n.display_name,userId:n.user_id,fallbackSeed:"viewer"})}function hX(n){return{...n,ranks:{overall:null,movies:null,series:null,anime:null,unlocks:null}}}function fX(n){const e=Math.max(0,Math.floor(n/1e3)),t=Math.floor(e/60),i=e%60;return`${String(t).padStart(2,"0")}:${String(i).padStart(2,"0")}`}function pX(){const[n,e]=E.useState("all"),t=E.useMemo(()=>j1(50,pp,"all"),[]),[i,r]=E.useState("overall"),[l,u]=E.useState(t?.leaderboards||null),[h,d]=E.useState([]),[p,m]=E.useState(t?.generated_at||null),[g,b]=E.useState(t?.starts_at||null),[y,_]=E.useState(t?.ends_at||null),[C,w]=E.useState(t?.season?.name||null),[S,T]=E.useState(null),[N,j]=E.useState(!1),[O,R]=E.useState(()=>Date.now()),[z,M]=E.useState(null),[P,G]=E.useState(null),[U,Y]=E.useState(!1),W=async D=>{D?.showSpinner&&j(!0),T(null);try{const[H,Z]=await Promise.all([Z7(50,{maxAgeMs:pp,forceRefresh:D?.forceRefresh,period:n}),Q7().catch(()=>[])]);u(H.leaderboards),d(Z),m(H.generated_at||null),b(H.starts_at||null),_(H.ends_at||null),w(H.season?.name||null)}catch(H){T(H instanceof Error?H.message:"Failed to load leaderboard")}finally{D?.showSpinner&&j(!1)}},J=async D=>{G(null),M(H=>H?.user_id===D.user_id?H:hX(D)),Y(!0);try{const H=await fv(D.user_id);M(H.profile)}catch(H){G(H instanceof Error?H.message:"Failed to load profile")}finally{Y(!1)}};E.useEffect(()=>{const D=j1(50,pp,n);D&&(u(D.leaderboards),m(D.generated_at)),W({showSpinner:!D})},[n]),E.useEffect(()=>{n==="season"?r("season"):i==="season"&&r("overall")},[n]),E.useEffect(()=>{const D=window.setInterval(()=>{R(Date.now())},1e3);return()=>window.clearInterval(D)},[]);const F=E.useMemo(()=>{const D=p?new Date(p).getTime():Number.NaN;return Number.isFinite(D)?D+pp:null},[p]),$=E.useMemo(()=>F?Math.max(0,F-O):null,[F,O]);E.useEffect(()=>{!F||N||O<F||W({forceRefresh:!0})},[O,F,N]);const V=E.useMemo(()=>l?.[i]||[],[l,i]),se=V.slice(0,3),ue=[se[1],se[0],se[2]].filter(Boolean),Ce=V.slice(3);return o.jsxs("main",{className:"relative min-h-screen bg-zinc-950 px-4 pb-20 pt-24 text-zinc-100 md:px-8",children:[o.jsxs("div",{className:"pointer-events-none absolute inset-0 overflow-hidden",children:[o.jsx("div",{className:"absolute -top-[20%] left-[50%] h-125 w-200 -translate-x-1/2 rounded-full bg-orange-600/10 blur-[120px]"}),o.jsx("div",{className:"absolute top-[40%] right-[-10%] h-100 w-100 rounded-full bg-purple-600/10 blur-[100px]"})]}),o.jsxs("div",{className:"relative mx-auto max-w-5xl",children:[o.jsxs("section",{className:`mb-10 mt-14 4163 flex flex-col items-center text-center animate-slide-up`,children:[o.jsxs("div",{className:"mb-4 inline-flex items-center gap-2 rounded-full border border-orange-500/20 bg-orange-500/10 px-3 py-1 text-xs font-medium text-orange-400",children:[o.jsx(HR,{className:"h-4 w-4"}),"Seasonal Arena"]}),o.jsxs("h1",{className:"mb-4 text-4xl font-extrabold tracking-tight text-white md:text-6xl",children:["Leaderboard ",o.jsx("span",{className:"bg-linear-to-r from-orange-400 to-amber-600 bg-clip-text text-transparent",children:"Rankings"})]}),o.jsx("p",{className:"max-w-xl text-zinc-400 md:text-lg",children:"Discover the top viewers in the PyroPlay community. Track your watch time, earn XP, and climb the ranks."}),o.jsx("div",{className:"mt-8 flex flex-wrap justify-center gap-2 rounded-2xl border border-white/8 bg-black/30 p-1.5",children:["all","day","week","month","season"].map(D=>o.jsx("button",{type:"button",onClick:()=>e(D),className:`rounded-xl px-4 py-2 text-sm font-bold capitalize transition ${n===D?"bg-orange-500 text-white shadow-lg shadow-orange-950/40":"text-zinc-400 hover:bg-white/8 hover:text-white"}`,children:D==="season"?C||"Season":D==="all"?"All Time":D},D))}),g&&o.jsxs("p",{className:"mt-3 text-xs text-zinc-500",children:["UTC period: ",new Date(g).toLocaleStr
4163ing()," ",y?`â ${new Date(y).toLocaleString()}`:""]}),h.length>0&&o.jsxs("section",{className:"mt-8 w-full rounded-3xl border border-amber-400/20 bg-amber-500/5 p-4 text-left md:p-5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-[10px] font-black tracking-[0.22em] text-amber-300",children:"SOL PRIZE WINNERS"}),o.jsx("h2",{className:"mt-1 text-lg font-black text-white",children:"Paid movie prize drops"})]}),o.jsx(_o,{className:"h-6 w-6 text-amber-300"})]}),o.jsx("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:h.map(D=>o.jsxs("article",{className:"flex min-w-0 items-center gap-3 rounded-2xl border border-white/8 bg-black/30 p-3",children:[o.jsx("div",{className:"h-11 w-11 shrink-0 overflow-hidden rounded-lg bg-zinc-800",children:D.movie_poster_url?o.jsx("img",{src:D.movie_poster_url,alt:"",className:"h-full w-full object-cover"}):o.jsx("div",{className:"grid h-full place-items-center",children:o.jsx(_o,{className:"h-4 w-4 text-amber-300"})})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"truncate text-sm font-black text-white",children:D.movie_title}),o.jsxs("div",{className:"mt-1 flex items-center gap-1.5",children:[o.jsx("img",{src:Yc({avatarUrl:D.user.avatar_url,username:D.user.username,displayName:D.user.display_name,userId:D.user.id,fallbackSeed:"winner"}),alt:"",className:"h-4 w-4 rounded-full"}),o.jsx("span",{className:"truncate text-xs text-zinc-400",children:D.user.username?`@${D.user.username}`:D.user.display_name})]})]}),o.jsxs("div",{className:"text-right",children:[o.jsxs("p",{className:"text-sm font-black text-amber-300",children:[D.prize_sol," SOL"]}),o.jsx("p",{className:"mt-1 text-[10px] text-zinc-500",children:"PAID"})]})]},D.quest_id))})]}),o.jsxs("div",{className:"mt-14 mb-10 flex w-full flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[o.jsx("div",{className:"flex flex-wrap justify-center gap-2 rounded-2xl border border-white/5 bg-white/5 p-1 backdrop-blur-md",children:Object.keys(o6).filter(D=>n==="season"?D==="season":D!=="season").map(D=>{const H=o6[D],Z=H.icon,Ee=i===D;return o.jsxs("button",{type:"button",onClick:()=>r(D),className:`flex items-center gap-2 rounded-xl px-4 py-2 text-sm font-medium transition-all ${Ee?"bg-zinc-800 text-white shadow-sm":"text-zinc-400 hover:bg-white/5 hover:text-zinc-200"}`,children:[o.jsx(Z,{className:"h-4 w-4"}),H.label]},D)})}),o.jsx("div",{className:"flex items-center justify-center gap-4",children:o.jsxs("span",{className:"rounded-xl border border-white/10 bg-white/5 px-3 py-1.5 text-xs font-semibold text-zinc-300",children:["Next refresh in ",$===null?"--:--":fX($)]})})]})]}),N?o.jsxs("div",{className:"flex min-h-100 flex-col items-center justify-center rounded-3xl border border-white/5 bg-white/5 backdrop-blur-sm px-5 py-14 text-zinc-400 animate-fade-in",children:[o.jsx(Dd,{className:"mb-4 h-8 w-8 animate-spin text-orange-500"}),o.jsx("p",{children:"Loading the latest rankings..."})]}):S?o.jsxs("div",{className:"mt-5 rounded-2xl border border-red-500/20 bg-red-500/10 px-5 py-8 text-center text-red-400 animate-fade-in",children:[o.jsx(ov,{className:"mx-auto mb-2 h-6 w-6"}),S]}):o.jsxs("div",{className:"flex flex-col gap-8",children:[ue.length>0&&o.jsx("section",{className:"flex flex-row items-end justify-center gap-2 sm:gap-6 md:gap-8",children:ue.map((D,H)=>{const Z=H===1,Ee=D.rank,je=Ee===1?"from-amber-300 to-orange-500 text-amber-950":Ee===2?"from-zinc-300 to-zinc-500 text-zinc-900":"from-amber-700 to-amber-900 text-amber-100";return o.jsxs("button",{type:"button",onClick:()=>{J(D)},className:`group relative flex flex-1 flex-col items-center rounded-3xl border p-3 transition-all animate-slide-up sm:p-6 sm:w-64 max-w-35 sm:max-w-none ${Z?"border-orange-500/30 bg-linear-to-b from-white/10 to-transparent shadow-[0_0_30px_rgba(249,115,22,0.15)] order-2 -translate-y-4 sm:-translate-y-8":"border-white/5 bg-white/5 hover:bg-white/10 order-1 nth-3:order-3"}`,style:{animationDelay:`${H*75}ms`},children:[o.jsx("div",{className:`absolute -top-3 flex items-center justify-center rounded-full bg-linear-to-r px-2 py-0.5 font-bold shadow-lg sm:-top-4 sm:px-3 sm:py-1 ${je}`,children:o.jsxs("span",{className:"text-xs sm:text-sm",children:["#",Ee]})}),o.jsx("div",{className:`relative mb-2 mt-2 overflow-hidden rounded-full border-2 sm:mb-4 ${Z?"border-orange-400 h-16 w-16 sm:h-28 sm:w-28":"border-white/20 h-12 w-12 sm:h-20 sm:w-20"}`,children:o.jsx("img",{src:d6(D),alt:"",className:"h-full w-full object-cover"})}),o.jsx("h3",{className:"w-full truncate text-center text-sm font-bold text-white group-hover:text-orange-400 transition-colors sm:text-lg",children:u6(D)}),o.jsxs("p",{className:"mt-1 text-[10px] sm:text-sm text-zinc-400",children:["Level ",D.level]}),o.jsxs("div",{className:"mt-3 w-full rounded-xl bg-black/40 p-2 sm:p-3 sm:mt-4 text-center",children:[o.jsx("p",{className:"text-sm sm:text-xl font-black text-orange-400",children:l6(i,D)}),o.jsx("p",{className:"text-[9px] sm:text-xs text-zinc-500",children:c6(i)})]})]},`podium-${D.user_id}`)})},`podium-sec-${i}`),Ce.length>0&&o.jsxs("section",{className:"rounded-3xl border border-white/5 bg-white/5 overflow-hidden backdrop-blur-md animate-fade-in",style:{animationDelay:"150ms"},children:[o.jsx("div",{className:"border-b border-white/5 bg-white/5 px-6 py-4",children:o.jsx("h2",{className:"text-lg font-semibold text-white",children:"Full Rankings"})}),o.jsx("div",{className:"divide-y divide-white/5",children:Ce.map((D,H)=>o.jsxs("button",{type:"button",onClick:()=>{J(D)},className:"group flex w-full items-center gap-4 px-6 py-4 transition-colors hover:bg-white/5 animate-slide-up",style:{animationDelay:`${200+H*50}ms`},children:[o.jsx("span",{className:"w-8 text-left text-lg font-bold text-zinc-500 group-hover:text-white transition-colors",children:D.rank}
4163),o.jsx("div",{className:"h-12 w-12 shrink-0 overflow-hidden rounded-full border border-white/10 bg-zinc-800",children:o.jsx("img",{src:d6(D),alt:"",className:"h-full w-full object-cover"})}),o.jsxs("div",{className:"flex flex-1 flex-col text-left",children:[o.jsx("h4",{className:"font-semibold text-zinc-200 group-hover:text-white transition-colors",children:u6(D)}),o.jsxs("span",{className:"text-xs text-zinc-500",children:["Level ",D.level," ⢠",D.total_xp.toLocaleString()," XP"]})]}),o.jsxs("div",{className:"flex flex-col text-right",children:[o.jsx("span",{className:"font-bold text-orange-400",children:l6(i,D)}),o.jsx("span",{className:"text-xs text-zinc-500",children:c6(i)})]})]},`row-${D.user_id}`))})]},`rest-sec-${i}`),V.length===0&&o.jsx("div",{className:"py-12 text-center text-zinc-500 animate-slide-up",style:{animationDelay:"100ms"},children:"No users ranked in this category yet."},`empty-${i}`)]})]}),o.jsx(R5,{profile:z,isLoading:U,error:P,onClose:()=>{M(null),G(null),Y(!1)}})]})}const mX=["http://pyroplay.pro","http://pyroplay.xyz","http://pyroplay.lol"];function gX(){return o.jsx("main",{className:"min-h-screen bg-zinc-950 text-white animate-fade-in",children:o.jsxs("section",{className:"relative overflow-hidden border-b border-white/10 pt-20 md:pt-20",children:[o.jsx(Lm,{className:"absolute inset-0 h-full w-full"}),o.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[linear-gradient(180deg,rgba(4,4,5,0.68)_0%,rgba(9,9,11,0.82)_60%,rgba(17,17,19,0.96)_100%)]"}),o.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_18%_12%,rgba(226,94,12,0.36),transparent_34%),radial-gradient(circle_at_82%_14%,rgba(250,204,21,0.17),transparent_30%),radial-gradient(circle_at_52%_82%,rgba(249,115,22,0.14),transparent_36%)]"}),o.jsx("div",{className:"pointer-events-none absolute -left-24 top-20 h-72 w-72 rounded-full bg-[#E25E0C]/15 blur-3xl motion-safe:animate-token-float"}),o.jsx("div",{className:"pointer-events-none absolute right-0 top-24 h-64 w-64 rounded-full bg-amber-400/10 blur-3xl motion-safe:animate-token-pulse"}),o.jsxs("div",{className:"relative mx-auto max-w-5xl px-4 pb-20 pt-12 md:px-12 md:pb-24 md:pt-16 motion-safe:animate-token-reveal",children:[o.jsx("p",{className:"inline-flex rounded-full border border-orange-300/40 bg-orange-400/10 px-3 py-1 text-[11px] font-semibold uppercase tracking-[0.2em] text-orange-200",children:"Legal Stuff"}),o.jsx("h1",{className:"mt-5 text-4xl font-black leading-[0.94] tracking-tight md:text-7xl",children:"DMCA"}),o.jsxs("div",{className:"mt-8 space-y-5 rounded-2xl border border-white/10 bg-black/45 p-6 text-sm leading-relaxed text-zinc-200 backdrop-blur-sm md:text-base",children:[o.jsx("p",{children:"This statement addresses frequently asked questions regarding copyright concerns and service availability."}),o.jsx("p",{className:"font-semibold text-white",children:"At this time, there is no basis for concern regarding unlawful hosting."}),o.jsx("p",{children:"PyroPlay does not host copyrighted media on its own servers. Content references are aggregated from third-party sources. Any copyright-related claims should be submitted directly to the relevant third-party hosting provider."}),o.jsx("p",{children:"Service interruptions are not expected to occur without prior notice. In standard compliance processes, providers are generally notified and given an opportunity to respond before any enforcement action is taken."}),o.jsx("p",{children:"As an additional continuity measure, backup domain infrastructure has been prepared."}),o.jsx("p",{children:"Mirror domains have been secured for http://pyroplay.tv to maintain availability if any single domain becomes inaccessible."}),o.jsxs("div",{className:"rounded-xl border border-white/10 bg-zinc-900/70 p-4",children:[o.jsx("p",{className:"mb-3 text-xs uppercase tracking-[0.14em] text-zinc-400",children:"Mirrors"}),o.jsx("ul",{className:"space-y-2",children:mX.map(n=>o.jsx("li",{children:o.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:"text-orange-300 underline decoration-orange-400/70 underline-offset-4 transition hover:text-orange-200",children:n})},n))})]}),o.jsx("p",{children:"Accordingly, if one domain becomes unavailable, the platform is expected to remain accessible through the mirror domains listed above."}),o.jsxs("div",{className:"rounded-xl border border-white/10 bg-zinc-900/70 p-4",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.14em] text-zinc-400",children:"DMCA Contact"}),o.jsxs("p",{className:"mt-2 text-zinc-200",children:["For DMCA requests and related copyright notices, please contact:"," ",o.jsx("a",{href:"mailto:[email protected]",className:"text-orange-300 underline decoration-orange-400/70 underline-offset-4 transition hover:text-orange-200",children:"[email protected]"}),"."]})]})]})]})]})})}function xX(){return o.jsx("main",{className:"min-h-screen bg-zinc-950 text-white animate-fade-in",children:o.jsxs("section",{className:"relative overflow-hidden border-b border-white/10 pt-20 md:pt-20",children:[o.jsx(Lm,{className:"absolute inset-0 h-full w-full"}),o.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[linear-gradient(180deg,rgba(4,4,5,0.68)_0%,rgba(9,9,11,0.82)_60%,rgba(17,17,19,0.9
41636)_100%)]"}),o.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_18%_12%,rgba(226,94,12,0.36),transparent_34%),radial-gradient(circle_at_82%_14%,rgba(250,204,21,0.17),transparent_30%),radial-gradient(circle_at_52%_82%,rgba(249,115,22,0.14),transparent_36%)]"}),o.jsx("div",{className:"pointer-events-none absolute -left-24 top-20 h-72 w-72 rounded-full bg-[#E25E0C]/15 blur-3xl motion-safe:animate-token-float"}),o.jsx("div",{className:"pointer-events-none absolute right-0 top-24 h-64 w-64 rounded-full bg-amber-400/10 blur-3xl motion-safe:animate-token-pulse"}),o.jsxs("div",{className:"relative mx-auto max-w-5xl px-4 pb-20 pt-12 md:px-12 md:pb-24 md:pt-16 motion-safe:animate-token-reveal",children:[o.jsx("p",{className:"inline-flex rounded-full border border-orange-300/40 bg-orange-400/10 px-3 py-1 text-[11px] font-semibold uppercase tracking-[0.2em] text-orange-200",children:"Legal Stuff"}),o.jsx("h1",{className:"mt-5 text-4xl font-black leading-[0.94] tracking-tight md:text-7xl",children:"Privacy Policy"}),o.jsxs("div",{className:"mt-8 space-y-5 rounded-2xl border border-white/10 bg-black/45 p-6 text-sm leading-relaxed text-zinc-200 backdrop-blur-sm md:text-base",children:[o.jsx("p",{className:"font-semibold text-white",children:"Effective date: March 20, 2026"}),o.jsx("p",{children:"This Privacy Policy explains what information PyroPlay may collect, how that information is used, and the choices available to users."}),o.jsxs("div",{className:"rounded-xl border border-white/10 bg-zinc-900/70 p-4",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.14em] text-zinc-400",children:"What We Collect"}),o.jsx("p",{className:"mt-2 text-zinc-200",children:"We may collect account details (such as username or email), basic usage activity, and technical information needed to operate and secure the service."})]}),o.jsxs("div",{className:"rounded-xl border border-white/10 bg-zinc-900/70 p-4",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.14em] text-zinc-400",children:"How Information Is Used"}),o.jsx("p",{className:"mt-2 text-zinc-200",children:"Information is used to provide core platform features, improve reliability, maintain account security, and communicate service updates when necessary."})]}),o.jsxs("div",{className:"rounded-xl border border-white/10 bg-zinc-900/70 p-4",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.14em] text-zinc-400",children:"Data Sharing"}),o.jsx("p",{className:"mt-2 text-zinc-200",children:"PyroPlay does not sell personal information. Data may be shared only with service providers required to run the platform or where required by law."})]}),o.jsxs("div",{className:"rounded-xl border border-white/10 bg-zinc-900/70 p-4",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.14em] text-zinc-400",children:"Cookies and Local Storage"}),o.jsx("p",{className:"mt-2 text-zinc-200",children:"The site may use cookies and local storage for authentication, preferences, and performance. Users can control these through browser settings."})]}),o.jsxs("div",{className:"rounded-xl border border-white/10 bg-zinc-900/70 p-4",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.14em] text-zinc-400",children:"Your Choices"}),o.jsx("p",{className:"mt-2 text-zinc-200",children:"Users can request account updates or deletion by contacting the team. Reasonable verification may be required before fulfilling requests."})]}),o.jsxs("div",{className:"rounded-xl border border-white/10 bg-zinc-900/70 p-4",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.14em] text-zinc-400",children:"Contact"}),o.jsxs("p",{className:"mt-2 text-zinc-200",children:["For privacy questions or requests, contact"," ",o.jsx("a",{href:"mailto:[email protected]",className:"text-orange-300 underline decoration-orange-400/70 underline-offset-4 transition hover:text-orange-200",children:"[email protected]"}),"."]})]})]})]})]})})}const bX="https://watch-server-production-c01b.up.railway.app/api";function vX(){return o.jsxs("div",{className:"flex flex-col items-center justify-center py-24 text-white",children:[o.jsx("div",{className:"mb-4 h-14 w-14 animate-spin rounded-full border-b-4 border-t-4 border-orange-400"}),o.jsx("p",{className:"text-sm font-semibold uppercase tracking-[0.2em] text-zinc-300",children:"Loading Chuck Norris page"})]})}function yX(){const[n,e]=Ki(),[t,i]=E.useState(null),[r,l]=E.useState(!0),[u,h]=E.useState(null);E.useEffect(()=>{(async()=>
4163{l(!0),h(null);try{const g=await fetch(`${bX}/people/chuck-norris`);if(!g.ok){const y=await g.text().catch(()=>"Failed to load page data");throw new Error(y||"Failed to load page data")}const b=await g.json();i(b)}catch(g){console.error("Failed to fetch Chuck Norris page data:",g),h(g instanceof Error?g.message:"Failed to load page data.")}finally{l(!1)}})()},[]);const d=E.useMemo(()=>{if(!t)return"Chuck Norris Tribute";const m=t.highlights.career_start_year,g=t.highlights.latest_release_year;return m&&g?`${t.person.name} ⢠Film Career`:`${t.person.name} ⢠Action Cinema Icon`},[t]),p=m=>{const g=new URLSearchParams(n);g.set("watch",`movie-${m}`),g.set("free","1"),e(g)};return o.jsxs("main",{className:"relative min-h-screen bg-zinc-950 text-white selection:bg-orange-500/30",children:[o.jsxs("div",{className:"pointer-events-none absolute inset-0",children:[o.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-zinc-900/20 via-zinc-950/80 to-zinc-950"}),t?.person?.profile_path&&o.jsx("img",{src:t.person.profile_path,alt:"Backdrop",className:"h-[60vh] w-full object-cover opacity-20 blur-3xl saturate-150 mix-blend-screen mask-image:linear-gradient(to_bottom,white,transparent)"})]}),o.jsxs("div",{className:"relative pt-24 pb-12 mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8",children:[r&&o.jsx(vX,{}),!r&&u&&o.jsxs("div",{className:"mx-auto mt-12 max-w-2xl rounded-2xl border border-red-500/30 bg-red-500/10 p-6 text-center backdrop-blur-sm",children:[o.jsx("p",{className:"text-lg font-bold text-red-200",children:"Could not load Chuck Norris data"}),o.jsx("p",{className:"mt-2 text-sm text-red-200/80",children:u})]}),!r&&!u&&t&&o.jsxs("div",{className:"flex flex-col gap-12 lg:gap-16",children:[o.jsxs("div",{className:"flex flex-col items-center gap-8 md:flex-row md:items-stretch lg:gap-12",children:[o.jsx("div",{className:"shrink-0 overflow-hidden rounded-2xl border border-white/10 bg-zinc-900/80 shadow-2xl shadow-orange-900/20 ring-1 ring-white/10 w-[240px] h-[360px] md:w-[300px] md:h-[450px]",children:t.person.profile_path?o.jsx("img",{src:t.person.profile_path,alt:t.person.name,className:"h-full w-full object-cover transition-transform duration-700 hover:scale-105",loading:"lazy"}):o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-zinc-500",children:"No portrait available"})}),o.jsxs("div",{className:"flex flex-col justify-center text-center md:text-left pt-4",children:[o.jsxs("div",{className:"inline-flex items-center justify-center md:justify-start gap-2 mb-4",children:[o.jsx("span",{className:"rounded-full bg-orange-500/10 px-3 py-1 text-xs font-bold uppercase tracking-widest text-orange-400 ring-1 ring-orange-500/20",children:"Action Legend"}),o.jsx("span",{className:"rounded-full bg-white/5 px-3 py-1 text-xs font-bold uppercase tracking-widest text-zinc-400 ring-1 ring-white/10",children:"Dedicated Page"})]}),o.jsx("h1",{className:"text-5xl font-black tracking-tight sm:text-6xl lg:text-7xl bg-gradient-to-br from-white via-zinc-200 to-zinc-500 bg-clip-text text-transparent",children:d}),o.jsx("p",{className:"mt-6 max-w-2xl text-base leading-relaxed text-zinc-300 md:text-lg line-clamp-3",children:t.person.biography||"This page celebrates Chuck Norris with career details, film highlights, and fan-favorite titles."}),o.jsxs("div",{className:"mt-8 grid grid-cols-2 gap-4 sm:grid-cols-4",children:[o.jsxs("article",{className:"flex flex-col justify-center rounded-2xl border border-white/5 bg-white/5 p-4 backdrop-blur-sm transition-colors hover:bg-white/10",children:[o.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-zinc-500",children:"Known For"}),o.jsx("p",{className:"mt-1 font-bold text-zinc-100",children:t.person.known_for_department||"Acting"})]}),o.jsxs("article",{className:"flex flex-col justify-center rounded-2xl border border-white/5 bg-white/5 p-4 backdrop-blur-sm transition-colors hover:bg-white/10",children:[o.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-zinc-500",children:"Total Movies"}),o.jsx("p",{className:"mt-1 font-bold text-zinc-100",children:t.highlights.total_mov
4163ies})]}),o.jsxs("article",{className:"flex flex-col justify-center rounded-2xl border border-white/5 bg-white/5 p-4 backdrop-blur-sm transition-colors hover:bg-white/10",children:[o.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-zinc-500",children:"Birthplace"}),o.jsx("p",{className:"mt-1 font-bold text-zinc-100 truncate",title:t.person.place_of_birth||"N/A",children:t.person.place_of_birth||"N/A"})]}),o.jsxs("article",{className:"flex flex-col justify-center rounded-2xl border border-white/5 bg-white/5 p-4 backdrop-blur-sm transition-colors hover:bg-white/10",children:[o.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-zinc-500",children:"Latest Release"}),o.jsx("p",{className:"mt-1 font-bold text-zinc-100",children:t.highlights.latest_release_year||"N/A"})]})]}),o.jsx("div",{className:"mt-8 flex flex-wrap items-center justify-center gap-4 md:justify-start",children:o.jsxs(Ut,{to:"/movies",className:"inline-flex items-center gap-2 rounded-xl bg-orange-600 px-6 py-3 text-sm font-bold text-white shadow-lg shadow-orange-900/20 transition-all hover:bg-orange-500 hover:scale-105 active:scale-95",children:[o.jsx("span",{children:"Browse All Movies"}),o.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})})]})})]})]}),t.sections.timeline_movies.length>0&&o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-2xl font-black tracking-tight text-white sm:text-3xl",children:"Career Timeline"}),o.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"The historical record of legendary action."})]}),o.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6",children:t.sections.timeline_movies.map(m=>o.jsxs("button",{type:"button",onClick:()=>p(m.id),className:"group relative flex flex-col overflow-hidden rounded-xl border border-zinc-800 bg-zinc-900/50 text-left backdrop-blur-sm transition-all hover:border-orange-500/50 hover:bg-zinc-800/80 hover:shadow-xl hover:shadow-orange-900/20 focus:outline-none focus:ring-2 focus:ring-orange-500 focus:ring-offset-2 focus:ring-offset-zinc-950",children:[o.jsxs("div",{className:"relative aspect-[2/3] w-full overflow-hidden bg-zinc-950",children:[m.poster_path?o.jsx("img",{src:m.poster_path,alt:m.title,className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-110",loading:"lazy"}):o.jsx("div",{className:"flex h-full items-center justify-center p-4 text-center text-xs text-zinc-600",children:"No poster"}),o.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-zinc-950 via-zinc-950/20 to-transparent opacity-60 transition-opacity group-hover:opacity-80"}),o.jsx("div",{className:"absolute bottom-2 left-2 right-2 flex items-end justify-between gap-2",children:o.jsx("span",{className:"inline-flex rounded-md bg-black/60 px-1.5 py-0.5 text-[10px] font-bold text-white backdrop-blur-md",children:m.release_date?.slice(0,4)||"TBA"})})]}),o.jsxs("div",{className:"flex flex-1 flex-col justify-between p-3",children:[o.jsx("p",{className:"line-clamp-2 text-xs font-bold leading-tight text-zinc-100 group-hover:text-orange-400 transition-colors",children:m.title}),m.character&&o.jsxs("p",{className:"mt-1 line-clamp-1 text-[10px] uppercase tracking-wider text-zinc-500",children:["as ",m.character]})]})]},m.id))})]}),o.jsxs("div",{className:"flex flex-col gap-12 pt-8",children:[t.sections.popular_movies.length>0&&o.jsx(ur,{title:"Most Popular Works",movies:t.sections.popular_movies,showViewAll:!1,onMovieClick:m=>p(m.id)}),t.sections.top_rated_movies.length>0&&o.jsx(ur,{title:"Critically Acclaimed",movies:t.sections.top_rated_movies,showViewAll:!1,onMovieClick:m=>p(m.id)})]})]})]})]})}function h6({platform:n}){const e="https://apps.microsoft.com/detail/9NHH68W8QMJR?hl=en&gl=NI&ocid=pdpshare";return E.useEffect(()=>{if(n==="android"){h7();return}n==="windows"&&e&&window.location.assign(e)},[e,n]),n==="android"?o.jsx("main",{className:"min-h-screen bg-zinc-950 px-4 pb-12 pt-28 text-white md:px-12",children:o.jsxs("div",{className:"mx-auto max-w-3xl rounded-3xl border border-white/10 bg-zinc-900/80 p-6 shadow-xl md:p-8",children:[o.jsx("div",{className:"inline-flex rounded-2xl border border-orange-400/20 bg-orange-500/10 p-3 text-orange-200",children:o.jsx(m1,{className:"h-6 w-6"})}),o.jsx("h1",{className:"mt-4 text-3xl font-black text-white",children:"Downloading PyroPlay for Android"}),o.jsx("p",{className:"mt-3 text-sm leading-relaxed text-zinc-300",children:"Your APK download should begin automatically. If it does not, use the button below."}),o.jsxs("div",{className:"mt-6 flex flex-col gap-3 sm:flex-row",children:[o.jsxs("a",{href:T5,download:"PyroPlay.apk",className:"inline-flex items-center justify-center gap-2 rounded-xl bg-[#E25E0C] px-4 py-2.5 text-sm font-bold text-white transition hover:bg-[#f76c15]",children:[o.jsx(m1,{className:"h-4 w-4"}),"Download APK"]}),o.jsx(Ut,{to:"/",className:"inline-flex items-center justify-center rounded-xl border border-white/15 bg-zinc-950 px-4 py-2.5 text-sm font-bold text-white transition hover:border-white/35 hover:bg-zinc-900",children:"Back to PyroPlay"})]}),o.jsx("p",{className:"mt-6 text-xs text-zinc-500",children:"On some Android devices you may
4163need to allow app installs from this source before opening the APK."})]})}):o.jsx("main",{className:"min-h-screen bg-zinc-950 px-4 pb-12 pt-28 text-white md:px-12",children:o.jsxs("div",{className:"mx-auto max-w-3xl rounded-3xl border border-white/10 bg-zinc-900/80 p-6 shadow-xl md:p-8",children:[o.jsx("div",{className:"inline-flex rounded-2xl border border-cyan-400/20 bg-cyan-500/10 p-3 text-cyan-200",children:o.jsx(Lp,{className:"h-6 w-6"})}),o.jsx("h1",{className:"mt-4 text-3xl font-black text-white",children:"Install PyroPlay from Microsoft Store"}),o.jsx("p",{className:"mt-3 text-sm leading-relaxed text-zinc-300",children:"Your Microsoft Store install page should open automatically."}),o.jsxs("div",{className:"mt-6 flex flex-col gap-3 sm:flex-row",children:[o.jsxs("a",{href:e,target:"_blank",rel:"noreferrer",className:"inline-flex items-center justify-center gap-2 rounded-xl bg-[#E25E0C] px-4 py-2.5 text-sm font-bold text-white transition hover:bg-[#f76c15]",children:[o.jsx(Lp,{className:"h-4 w-4"}),"Open Microsoft Store"]}),o.jsx(Ut,{to:"/",className:"inline-flex items-center justify-center rounded-xl border border-white/15 bg-zinc-950 px-4 py-2.5 text-sm font-bold text-white transition hover:border-white/35 hover:bg-zinc-900",children:"Back to PyroPlay"})]}),!e]})})}const lu="https://watch-server-production-c01b.up.railway.app/api",_X={pricing:{discovery:{label:"In-row + search promoted card",weeklyRateSol:.5,description:"Appears inside media rows and also surfaces in search results."},sidebar:{label:"Movie details sidebar",weeklyRateSol:.5,description:"Premium sponsor module on movie and TV detail pages."},player_gate:{label:"Player gate takeover",weeklyRateSol:1,description:"Runs under server selection with a timed unlock plus optional pause overlays."},bundles:[{placements:["discovery","sidebar"],label:"Discovery + sidebar bundle",weeklyRateSol:.75}]},audience:{monthly_impressions_estimate:6e4,active_watchers_range:"12-25"},constraints:{pause_overlay_chance:.2,player_gate_seconds:5,max_campaign_weeks:12}},f6=["discovery","sidebar","player_gate"],Qb={contact_name:"",company_name:"",website_url:"",notes:""},p6={campaign_name:"",brand_name:"",headline:"",description:"",cta_label:"Learn more",click_url:"",image_url:"",accent_hex:"#F97316",requested_weeks:1,placements:["discovery"]};function uo(n){return`${new Intl.NumberFormat("en-US",{minimumFractionDigits:n%1===0?0:2,maximumFractionDigits:6}).format(n)} SOL`}function a1(n){if(!n)return"Not yet";const e=new Date(n);return Number.isNaN(e.getTime())?"Not yet":e.toLocaleString()}function wX(n){return n==="active"?"border-emerald-400/30 bg-emerald-500/12 text-emerald-200":n==="completed"?"border-cyan-400/30 bg-cyan-500/12 text-cyan-100":n==="paused"?"border-amber-400/30 bg-amber-500/12 text-amber-100":n==="rejected"?"border-rose-400/30 bg-rose-500/12 text-rose-100":"border-white/15 bg-white/8 text-zinc-200"}function m6(n){return n?{contact_name:n.contact_name||"",company_name:n.company_name||"",website_url:n.website_url||"",notes:n.notes||""}:Qb}async function cu(n,e){const t=await n.json().catch(()=>null);if(!n.ok)throw new Error(t?.error||e);if(!t)throw new Error(e);return t}async function SX(n){const e=await fetch(`${lu}/ads/public/catalog`,{signal:n});return cu(e,"Failed to load ad pricing.")}async function EX(n){const e=await fetch(`${lu}/ads/advertiser/profile`,{headers:{Authorization:`Bearer ${n}`}});return cu(e,"Failed to load advertiser profile.")}async function CX(n,e){const t=await fetch(`${lu}/ads/advertiser/profile`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(e)});return cu(t,"Failed to save advertiser profile.")}async function NX(n){const e=await fetch(`${lu}/ads/advertiser/campaigns`,{headers:{Authorization:`Bearer ${n}`}}),t=await cu(e,"Failed to load advertiser campaigns.");return Array.isArray(t.campaigns)?t.campaigns:[]}async function TX(n,e){const t=await fetch(`${lu}/ads/advertiser/campaigns`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(e)});return(await cu(t,"Failed to create campaign.")).campaign}async function MX(n,e){const t=await fetch(`${lu}/ads/advertiser/campaigns/${e}/refresh-funding`,{method:"POST",headers:{Authorization:`Bearer ${n}`}});return(await cu(t,"Failed to refresh campaign funding.")).campaign}function AX(n,e){const t=Array.from(new Set(e)),i=n.pricing.bundles.find(r=>r.placements.length!==t.length?!1:r.placements.every(l=>t.includes(l)));return i?i.weeklyRateSol:t.reduce((r,l)=>r+Number(n.pricing[l]?.weeklyRateSol||0),0)}function RX(n,e){return n.pricing[e]?.label||e}function kX({checked:n,label:e,description:t,onToggle:i}){return o.jsx("button",{type:"button",onClick:i,className:`rounded-2xl border p-4 text-left transition ${n?"border-orange-400/60 bg-orange-500/12 shadow-[0_18px_40px_-28px_rgba(249,115,22,0.75)]":"border-white/10 bg-black/20 hover:border-white/25 hover:bg-white/6"}`,children:o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-white",children:e}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-zinc-400",children:t})]}),o.jsx("span",{className:`mt-0.5 inline-flex h-5 w-5 items-center justify-center rounded-full border text-[10px] ${n?"border-orange-300 bg-orange-400 text-black":"border-white/15 text-transparent"}`,children:o.jsx(zr,{className:"h-3 w-3"})})]})})}function jX(){const[n,e]=E.useState(_X),[t,i]=E.useState(null),[r,l]=E.useState(!0),[u,h]=E.useState(null),[d,p]=E.useState(!0),[m,g]=E.useState(null),[b,y]=E.useState(Qb),[_,C]=E.useState(!1),[w,S]=E.useState(!1),[T,N]=E.useState(null),[j,O]=E.useState(!1),[R,z]=E.useState(null),[M,P]=E.useState([]),[G,U]=E.useState(p6),[Y,W]=E.useState(null),[J,F]=E.useState(null),[$,V]=E.useState(!1),[se,ue]=E.useState(null),[Ce,D]=E.useState(null);E.useEffect(()=>{const pe=new AbortController;return(async()=>
4163{l(!0),i(null);try{const We=await SX(pe.signal);e(We)}catch(We){if(We instanceof DOMException&&We.name==="AbortError")return;i(We instanceof Error?We.message:"Failed to load ad pricing.")}finally{l(!1)}})(),()=>pe.abort()},[]),E.useEffect(()=>{if(!Fe){p(!1);return}let pe=!0;Fe.auth.getSession().then(({data:We})=>{pe&&(h(We.session),p(!1))});const{data:{subscription:Be}}=Fe.auth.onAuthStateChange((We,dt)=>{pe&&(h(dt),N(null),z(null),F(null))});return()=>{pe=!1,Be.unsubscribe()}},[]),E.useEffect(()=>{if(!u?.access_token){g(null),y(Qb),P([]),C(!1);return}let pe=!1;return(async()=>{S(!0),N(null);try{const[We,dt]=await Promise.all([EX(u.access_token),NX(u.access_token)]);if(pe)return;g(We.profile),y(m6(We.profile)),C(!!We.email_verified),P(dt)}catch(We){if(pe)return;N(We instanceof Error?We.message:"Failed to load advertiser manager.")}finally{pe||S(!1)}})(),()=>{pe=!0}},[u?.access_token]),E.useEffect(()=>{if(!Ce)return;const pe=window.setTimeout(()=>{D(null)},1800);return()=>window.clearTimeout(pe)},[Ce]);const H=E.useMemo(()=>AX(n,G.placements),[n,G.placements]),Z=E.useMemo(()=>Number((H*G.requested_weeks).toFixed(6)),[G.requested_weeks,H]),Ee=u?.access_token||null,je=pe=>{F(null),W(null),U(Be=>{const We=Be.placements.includes(pe)?Be.placements.filter(dt=>dt!==pe):[...Be.placements,pe];return{...Be,placements:We}})},le=async pe=>{if(pe.preventDefault(),!!Ee){O(!0),N(null),z(null);try{const Be=await CX(Ee,b);g(Be.profile),y(m6(Be.profile)),C(!!Be.email_verified),z("Advertiser profile saved.")}catch(Be){N(Be instanceof Error?Be.message:"Failed to save advertiser profile.")}finally{O(!1)}}},Se=async pe=>{if(pe.preventDefault(),!!Ee){V(!0),W(null),F(null);try{const Be=await TX(Ee,G);P(We=>[Be,...We]),U(p6),F("Campaign created. Fund the deposit wallet to activate delivery.")}catch(Be){W(Be instanceof Error?Be.message:"Failed to create campaign.")}finally{V(!1)}}},de=async pe=>{if(Ee){ue(pe),W(null);try{const Be=await MX(Ee,pe);P(We=>We.map(dt=>dt.id===pe?Be:dt))}catch(Be){W(Be instanceof Error?Be.message:"Failed to refresh campaign funding.")}finally{ue(null)}}},Me=async(pe,Be)=>{if(Be)try{await navigator.clipboard.writeText(Be),D(pe)}catch(We){W(We instanceof Error?We.message:"Failed to copy deposit wallet address.")}},Le=async()=>{Fe&&await Fe.auth.signOut()};return o.jsx("main",{className:"min-h-screen bg-[radial-gradient(circle_at_top,rgba(249,115,22,0.18),transparent_30%),linear-gradient(180deg,#060606_0%,#0b0b0b_100%)] px-4 pb-16 pt-24 text-white sm:px-6 lg:px-8",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-7xl flex-col gap-8",children:[o.jsxs("section",{className:"overflow-hidden rounded-4xl border border-white/10 bg-black/35 shadow-[0_30px_120px_-50px_rgba(249,115,22,0.55)] backdrop-blur",children:[o.jsxs("div",{className:"grid gap-8 px-6 py-8 lg:grid-cols-[1.4fr_0.9fr] lg:px-10 lg:py-10",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-orange-400/25 bg-orange-500/10 px-3 py-1 text-[11px] font-semibold uppercase tracking-[0.22em] text-orange-200",children:[o.jsx(pr,{className:"h-3.5 w-3.5"}),"PyroPlay Ads"]}),o.jsx("h1",{className:"mt-5 max-w-3xl text-4xl font-black tracking-tight text-white sm:text-5xl",children:"Launch sponsorships that sit inside the actual PyroPlay watch flow."}),o.jsx("p",{className:"mt-4 max-w-2xl text-sm leading-7 text-zinc-300 sm:text-base",children:"Discovery cards blend into browse rows and search, sidebar ads frame the detail page, and player gate placements own the decision moment before streaming starts."}),o.jsx("div",{className:"mt-6 flex flex-wrap gap-3",children:u?o.jsxs(o.Fragment,{children:[o.jsx("a",{href:"#advertiser-manager",className:"rounded-full bg-orange-500 px-5 py-3 text-sm font-semibold text-white transition hover:bg-orange-400",children:"Open manager"}),o.jsx("button",{type:"button",onClick:()=>{Le()},className:"rounded-full border border-white/15 px-5 py-3 text-sm font-semibold text-zinc-200 transition hover:border-white/30 hover:text-white",children:"Sign out"})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ut,{to:"/login?next=/advertise",className:"rounded-full bg-orange-500 px-5 py-3 text-sm font-semibold text-white transition hover:bg-orange-400",children:"Log in to advertise"}),o.jsx(Ut,{to:"/login?next=/advertise",className:"rounded-full border border-white/15 px-5 py-3 text-sm font-semibold text-zinc-200 transition hover:border-white/30 hover:text-white",children:"Create advertiser account"})]})}),o.jsxs("div",{className:"mt-8 grid gap-3 sm:grid-cols-3",children:[o.jsxs("div",{className:"rounded-2xl border border-white/10 bg-white/5 p-4",children:[o.jsx("p",{className:"text-[11px] uppercase tracking-[0.18em] text-zinc-500",children:"Monthly impressions"}),o.jsxs("p",{className:"mt-2 text-2xl font-black text-white",children:[new Intl.NumberFormat("en-US").format(n.audience.monthly_impressions_estimate),"+"]})]}),o.jsxs("div",{className:"rounded-2xl border border-white/10 bg-white/5 p-4",children:[o.jsx("p",{className:"text-[11px] uppercase tracking-[0.18em] text-zinc-500",children:"Active viewers"}),o.jsx("p",{className:"mt-2 text-2xl font-black text-white",children:n.audience.active_watchers_range})]}),o.jsxs("div",{className:"rounded-2xl border border-white/10 bg-white/5 p-4",children:[o.jsx("p",{className:"text-[11px] uppercase tracking-[0.18em] text-zinc-500",children:"Player gate"}),o.jsxs("p",{className:"mt-2 text-2xl font-black text-white",children:[n.constraints.player_gate_seconds,"s"]})]})]})]}),o.jsxs("div",{className:"rounded-[28px] border border-white/10 bg-zinc-950/75 p-5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-zinc-500",children:"Launch kit"}),o.jsx("h2",{className:"mt-2 text-xl font-black text-white",children:"Placement pricing"})]}),r&&o.jsx(fr,{className:"h-5 w-5 animate-spin text-zinc-500"})]}),o.jsx("div",{className:"mt-5 space-y-3",children:f6.map(pe=>o.jsx("article",{className:"rounded-2xl border border-white/10 bg-white/5 p-4",children:o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-white",children:n.pricing[pe].label}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-zinc-400",children:n.pricing[pe].description})]}),o.jsxs("span",{className:"rounded-full border border-orange-400/30 bg-
4163orange-500/12 px-3 py-1 text-xs font-semibold text-orange-100",children:[uo(n.pricing[pe].weeklyRateSol),"/wk"]})]})},pe))}),o.jsxs("div",{className:"mt-4 rounded-2xl border border-cyan-400/20 bg-cyan-500/10 p-4",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.16em] text-cyan-200",children:"Bundle offer"}),o.jsx("p",{className:"mt-2 text-sm font-semibold text-white",children:n.pricing.bundles[0]?.label||"Discovery + sidebar bundle"}),o.jsxs("p",{className:"mt-1 text-xs text-zinc-300",children:["Bundle both high-frequency discovery surfaces for ",uo(n.pricing.bundles[0]?.weeklyRateSol||.75)," per week."]})]})]})]}),t&&o.jsx("div",{className:"border-t border-rose-400/20 bg-rose-500/10 px-6 py-3 text-sm text-rose-100 lg:px-10",children:t})]}),o.jsxs("section",{id:"advertiser-manager",className:"grid gap-6 lg:grid-cols-[1.15fr_0.85fr]",children:[o.jsxs("div",{className:"space-y-6",children:[o.jsxs("section",{className:"rounded-[28px] border border-white/10 bg-zinc-900/70 p-6 shadow-[0_24px_90px_-50px_rgba(0,0,0,0.85)] backdrop-blur",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-zinc-500",children:"Advertiser manager"}),o.jsx("h2",{className:"mt-2 text-2xl font-black text-white",children:"Profile and campaign control"})]}),u?.user?.email&&o.jsx("span",{className:"rounded-full border border-white/10 bg-white/5 px-3 py-1 text-xs text-zinc-300",children:u.user.email})]}),Fe?d||w?o.jsxs("div",{className:"mt-6 flex items-center gap-3 rounded-2xl border border-white/10 bg-black/20 px-4 py-5 text-sm text-zinc-300",children:[o.jsx(fr,{className:"h-5 w-5 animate-spin text-orange-300"}),"Loading advertiser manager..."]}):u?o.jsxs("div",{className:"mt-6 space-y-4",children:[!_&&o.jsx("div",{className:"rounded-2xl border border-amber-400/20 bg-amber-500/10 p-4 text-sm text-amber-100",children:"Verify your email before creating campaigns. You can still save your advertiser profile now."}),T&&o.jsx("div",{className:"rounded-2xl border border-rose-400/20 bg-rose-500/10 p-4 text-sm text-rose-100",children:T}),R&&o.jsx("div",{className:"rounded-2xl border border-emerald-400/20 bg-emerald-500/10 p-4 text-sm text-emerald-100",children:R}),o.jsxs("form",{onSubmit:le,className:"grid gap-4 rounded-3xl border border-white/10 bg-black/20 p-5 sm:grid-cols-2",children:[o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-xs uppercase tracking-[0.14em] text-zinc-500",children:"Contact name"}),o.jsx("input",{value:b.contact_name,onChange:pe=>y(Be=>({...Be,contact_name:pe.target.value})),className:"w-full rounded-xl border border-white/10 bg-zinc-950 px-3 py-2.5 text-sm text-white outline-none transition focus:border-orange-400/70",placeholder:"Jane Doe"})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-xs uppercase tracking-[0.14em] text-zinc-500",children:"Company name"}),o.jsx("input",{value:b.company_name,onChange:pe=>y(Be=>({...Be,company_name:pe.target.value})),className:"w-full rounded-xl border border-white/10 bg-zinc-950 px-3 py-2.5 text-sm text-white outline-none transition focus:border-orange-400/70",placeholder:"Studio, app, brand"})]}),o.jsxs("label",{className:"block sm:col-span-2",children:[o.jsx("span",{className:"mb-1.5 block text-xs uppercase tracking-[0.14em] text-zinc-500",children:"Website URL"}),o.jsx("input",{value:b.website_url,onChange:pe=>y(Be=>({...Be,website_url:pe.target.value})),className:"w-full rounded-xl border border-white/10 bg-zinc-950 px-3 py-2.5 text-sm text-white outline-none transition focus:border-orange-400/70",placeholder:"https://example.com"})]}),o.jsxs("label",{className:"block sm:col-span-2",children:[o.jsx("span",{className:"mb-1.5 block text-xs uppercase tracking-[0.14em] text-zinc-500",children:"Notes"}),o.jsx("textarea",{value:b.notes,onChange:pe=>y(Be=>({...Be,notes:pe.target.value})),className:"min-h-28 w-full rounded-xl border border-white/10 bg-zinc-950 px-3 py-2.5 text-sm text-white outline-none transition focus:border-orange-400/70",placeholder:"Target audience, preferred launch dates, internal notes."})]}),o.jsxs("div",{className:"sm:col-span-2 flex items-center justify-between gap-3 border-t border-white/10 pt-4",children:[o.jsxs("div",{className:"text-xs text-zinc-500",children:["Profile email: ",o.jsx("span",{className:"text-zinc-300",children:m?.email||u.user.email})]}),o.jsx("button",{type:"submit",disabled:j,className:"rounded-full bg-white px-4 py-2 text-sm font-semibold text-black transition hover:bg-zinc-200 disabled:cursor-not-allowed disabled:opacity-60",children:j?"Saving...":"Save advertiser profile"})]})]})]}):o.jsxs("div",{className:"mt-6 rounded-3xl border border-white/10 bg-black/25 p-5",children:[o.jsx("p",{className:"text-sm leading-7 text-zinc-300",children:"Sign in with your normal PyroPlay account to create an advertiser profile, generate campaign deposit wallets, and refresh funding status."}),o.jsxs("div",{className:"mt-5 flex flex-wrap gap-3",children:[o.jsx(Ut,{to:"/login?next=/advertise",className:"rounded-full bg-orange-500 px-4 py-2.5 text-sm font-semibold text-white transition hover:bg-orange-400",children:"Log in"}),o.jsx(Ut,{to:"/login?next=/advertise",className:"rounded-full border border-white/15 px-4 py-2.5 text-sm font-semibold text-zinc-200 transition hover:border-white/30 hover:text-white",children:"Register first"})]})]}):o.jsx("div",{className:"mt-5 rounded-2xl border border-amber-400/20 bg-amber-500/10 p-4 text-sm text-amber-100",children:"Supabase auth is not configured in the frontend, so the advertiser manager cannot sign you in yet."})]}),o.jsxs("section",{className:"rounded-[28px] border border-white/10 bg-zinc-900/70 p-6 shadow-[0_24px_90px_-50px_rgba(0,0,0,0.85)] backdrop-blur",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-zinc-500",children:"Campaigns"}),o.jsx("h2",{className:"mt-2 text-2xl font-black text-white",children:"Existing placements"})]}),o.jsxs("span",{className:"rounded-full border border-white/10 bg-white/5 px-3 py-1 text-xs text-zinc-300",children:[M.length," total"]})]}),Y&&o.jsx("div",{className:"mt-5 rounded-2xl border border-rose-400/20 bg-rose-500/10 p-4 text-sm text-rose-100",children:Y}),J&&o.jsx("div",{className:"mt-5 rounded-2xl border border-emerald-400/20 bg-emerald-500/10 p-4 text-sm text-emerald-100",children:J}),o.jsx("div",{className:"mt-5 space-y-4",children:M.length===0?o.jsx("div",{className:"rounded-2xl border border-dashed border-white/10 bg-black/20 px-4 py-10 text-center text-sm text-zinc-400",children:"No campaigns yet. Create one from the form to generate a funding wallet."}):M.map(pe=>{const Be=pe.budget_sol>0?Math.min(100,Math.max(0,pe.funded_sol/pe.budget_sol*100)):0;return o.jsxs("article",{className:"rounded-3xl border border-white/10 bg-black/20 p-5",children:[o.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("h3",{className:"text-lg font-semibold text-white",children:pe.campaign_name}),o.jsx("span",{className:`rounded-full border px-2.5 py-1 text-[11px] font-semibold uppercase tracking-[0.16em] ${wX(pe.status)}`,children:pe.status})]}),o.jsxs("p",{className:"mt-1 text-sm text-zinc-400",children:[pe.brand_name||"Brand"," ⢠",pe.placements.map(We=>RX(n,We)).join(" + ")]})]}),o.jsxs("button",{type:"button",onClick:()=>{de(pe.id)},disabled:se===pe.id,className:"inline-flex items-center gap-2 rounded-full border border-white/15 px-3 py-2 text-xs font-semibold text-zinc-200 transition hover:border-white/30 hover:text-white disabled:cursor-not-allowed disabled:opacity-60",children:[o.jsx(Dd,{className:`h-3.5 w-3.5 ${se===pe.id?"animate-spin":""}`}),"Refresh funding"]})]}),o.jsxs("div",{className:"mt-4 grid gap-4 lg:grid-cols-[1.1fr_0.9fr]",children:[o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs uppercase tracking-[0.12em] text-zinc-500",children:[o.jsx("span",{children:"Funding progress"}),o.jsxs("span",{children:[uo(pe.funded_sol)," / ",uo(pe.budget_sol)]})]}),o.jsx("div",{className:"mt-2 h-2 overflow-hidden rounded-full bg-white/10",children:o.jsx("div",{className:"h-full rounded-full bg-linear-to-r from-orange-400 via-amber-300 to-cyan-300",style:{width:`${Be}%`}})}),o.jsxs("p",{className:"mt-2 text-xs text-zinc-400",children:["Remaining: ",uo(pe.remaining_sol)]})]}),o.jsx("div",{className:"rounded-2xl border border-white/10 bg-zinc-950/80 p-4",children:o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.14em] text-zinc-500",children:"Deposit wallet"}),o.jsx("p",{className:"mt-2 break-all text-sm text-zinc-200",children:pe.deposit_wallet_address||"Unavailable"})]}),o.jsxs("button",{type:"button",onClick:()=>{Me(pe.id,pe.deposit_wallet_address)},disabled:!pe.deposit_wallet_address,className:"inline-flex items-center gap-2 rounded-full border border-white/15 px-3 py-2 text-xs font-semibold text-zinc-200 transition hover:border-white/30 hover:text-white disabled:cursor-not-allowed disabled:opacity-60",children:[o.jsx(Wc,{className:"h-3.5 w-3.5"}),Ce===pe.id?"Copied":"Copy"]})]})})]}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-1",children:[o.jsxs("div",{className:"rounded-2xl border border-white/10 bg-white/5 p-4 text-sm text-zinc-300",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.14em] text-zinc-500",children:"Schedule"}),o.jsxs("p",{className:"mt-2",children:["Start: ",a1(pe.start_at)]}),o.jsxs("p",{className:"mt-1",children:["End: ",a1(pe.end_at)]})]}),o.jsxs("div",{className:"rounded-2xl border border-white/10 bg-white/5 p-4 text-sm text-zinc-300",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.14em] text-zinc-500",children:"Last balance check"}),o.jsx("p",{className:"mt-2",children:a1(pe.last_balance_check_at)}),pe.click_url&&o.jsxs("a",{href:pe.click_url,target:"_blank",rel:"noreferrer",className:"mt-3 inline-flex items-center gap-2 text-xs font-semibold text-orange-200 transition hover:text-orange-100",children:["View destination",o.jsx(Lp,{className:"h-3.5 w-3.5"})]})]})]})]})]},pe.id)})})]})]}),o.jsxs("aside",{className:"space-y-6",children:[o.jsxs("section",{className:"rounded-[28px] border border-white/10 bg-zinc-900/70 p-6 shadow-[0_24px_90px_-50px_rgba(0,0,0,0.85)] backdrop-blur",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-zinc-500",children:"Create campaign"}),o.jsx("h2",{className:"mt-2 text-2xl font-black text-white",children:"Draft your creative"}),o.jsx("p",{className:"mt-3 text-sm leading-7 text-zinc-300",children:"Pick placements, set the run length, and the manager will generate a unique Solana wallet for funding."}),u?o.jsxs("form",{onSubmit:Se,className:"mt-5 space-y-4",children:[o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-xs uppercase tracking-[0.14em] text-zinc-500",children:"Campaign name"}),o.jsx("input",{value:G.campaign_name,onChange:pe=>U(Be=>({...Be,campaign_name:pe.target.value})),className:"w-full rounded-xl border border-white/10 bg-zinc-950 px-3 py-2.5 text-sm text-white outline-none transition focus:border-orange-400/70",placeholder:"Summer launch push",required:!0})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-xs uppercase tracking-[0.14em] text-zinc-500",children:"Brand name"}),o.jsx("input",{value:G.brand_name,onChange:pe=>U(Be=>({...Be,brand_name:pe.target.value})),className:"w-full rounded-xl border border-white/10 bg-zinc-950 px-3 py-2.5 text-sm text-white outline-none transition focus:border-orange-400/70",placeholder:"Brand or product",required:!0})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-xs uppercase tracking-[0.14em] text-zinc-500",children:"Headline"}),o.jsx("input",{value:G.headline,onChange:pe=>U(Be=>({...Be,headline:pe.target.value})),className:"w-full rounded-xl border border-white/10 bg-zinc-950 px-3 py-2.5 text-sm text-white outline-none transition focus:border-orange-400/70",placeholder:"Short pitch users see first",required:!0})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-xs uppercase tracking-[0.14em] text-zinc-500",children:"Destination URL"}),o.jsx("input",{value:G.click_url,onChange:pe=>U(Be=>({...Be,click_url:pe.target.value})),className:"w-full rounded-xl border border-white/10 bg-zinc-950 px-3 py-2.5 text-sm text-white outline-none transition focus:border-orange-400/70",placeholder:"https://example.com",required:!0})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-xs uppercase tracking-[0.14em] text-zinc-500",children:"Image URL"}),o.jsx("input",{value:G.image_url,onChange:pe=>U(Be=>({...Be,image_url:pe.target.value})),className:"w-full rounded-xl border border-white/10 bg-zinc-950 px-3 py-2.5 text-sm text-white outline-none transition focus:border-orange-400/70",placeholder:"https://cdn.example.com/creative.jpg"})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-[1fr_110px]",children:[o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-xs uppercase tracking-[0.14em] text-zinc-500",children:"CTA label"}),o.jsx("input",{value:G.cta_label,onChange:pe=>U(Be=>({...Be,cta_label:pe.target.value})),className:"w-full rounded-xl border border-white/10 bg-zinc-950 px-3 py-2.5 text-sm text-white outline-none transition focus:border-orange-400/70",placeholder:"Learn more"})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-xs uppercase tracking-[0.14em] text-zinc-500",children:"Accent"}),o.jsx("input",{value:G.accent_hex,onChange:pe=>U(Be=>({...Be,accent_hex:pe.target.value})),className:"w-full rounded-xl border border-white/10 bg-zinc-950 px-3 py-2.5 text-sm text-white outline-none transition focus:border-orange-400/70",placeholder:"#F97316"})]})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-xs uppercase tracking-[0.14em] text-zinc-500",children:"Description"}),o.jsx("textarea",{value:G.description,onChange:pe=>U(Be=>({...Be,description:pe.target.value})),className:"min-h-28 w-full rounded-xl border border-white/10 bg-zinc-950 px-3 py-2.5 text-sm text-white outline-none transition focus:border-orange-400/70",placeholder:"Short supporting copy for the ad creative."})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[o.jsx("span",{className:"text-xs uppercase tracking-[0.14em] text-zinc-500",children:"Placements"}),o.jsx("span",{className:"text-xs text-zinc-500",children:"Bundle auto-applies"})]}),o.jsx("div",{className:"space-y-3",children:f6.map(pe=>o.jsx(kX,{checked:G.placements.includes(pe),label:`${n.pricing[pe].label} ⢠${uo(n.pricing[pe].weeklyRateSol)}/wk`,description:n.pricing[pe].description,onToggle:()=>je(pe)},pe))})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-xs uppercase tracking-[0.14em] text-zinc-500",children:"Duration in weeks"}),o.jsx("input",{type:"number",min:1,max:n.constraints.max_campaign_weeks,value:G.requested_weeks,onChange:pe=>{const Be=Math.max(1,Math.min(n.constraints.max_campaign_weeks,Number(pe.target.value||1)));U(We=>({...We,requested_weeks:Be}))},className:"w-full rounded-xl border border-white/10 bg-zinc-950 px-3 py-2.5 text-sm text-white outline-none transition focus:border-orange-400/70"})]}),o.jsxs("div",{className:"rounded-3xl border border-orange-400/20 bg-orange-500/10 p-4",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.16em] text-orange-200",children:"Budget preview"}),o.jsx("p",{className:"mt-2 text-3xl font-black text-white",children:uo(Z)}),o.jsxs("p",{className:"mt-2 text-sm text-zinc-200",children:[uo(H)," per week for ",G.requested_weeks," week",G.requested_weeks===1?"":"s","."]})]}),o.jsx("button",{type:"submit",disabled:$||!_,className:"w-full round
4163ed-full bg-orange-500 px-4 py-3 text-sm font-semibold text-white transition hover:bg-orange-400 disabled:cursor-not-allowed disabled:opacity-60",children:$?"Creating campaign...":_?"Create campaign and funding wallet":"Verify email to create campaigns"})]}):o.jsx("div",{className:"mt-5 rounded-2xl border border-white/10 bg-black/20 p-4 text-sm text-zinc-300",children:"Sign in first to create campaigns."})]}),o.jsxs("section",{className:"rounded-[28px] border border-white/10 bg-zinc-900/70 p-6 shadow-[0_24px_90px_-50px_rgba(0,0,0,0.85)] backdrop-blur",children:[o.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-zinc-500",children:"Delivery notes"}),o.jsxs("ul",{className:"mt-4 space-y-3 text-sm leading-6 text-zinc-300",children:[o.jsx("li",{className:"rounded-2xl border border-white/10 bg-black/20 px-4 py-3",children:"Discovery ads can surface in rows and search results with a sponsored badge."}),o.jsxs("li",{className:"rounded-2xl border border-white/10 bg-black/20 px-4 py-3",children:["Player gate ads hold server selection for ",n.constraints.player_gate_seconds," seconds before unlock."]}),o.jsxs("li",{className:"rounded-2xl border border-white/10 bg-black/20 px-4 py-3",children:["Pause overlays appear about ",Math.round(n.constraints.pause_overlay_chance*100),"% of the time and dismiss automatically."]})]}),o.jsx("div",{className:"mt-5 rounded-2xl border border-white/10 bg-white/5 p-4 text-sm text-zinc-300",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(ov,{className:"mt-0.5 h-4 w-4 text-orange-300"}),o.jsx("p",{children:"Campaigns only activate after the deposit wallet balance reaches the required SOL budget. Use the refresh button after you fund a wallet."})]})})]})]})]})]})})}function g6(n){const e=Math.max(0,new Date(n||0).getTime()-Date.now()),t=Math.floor(e/1e3),i=Math.floor(t/86400),r=Math.floor(t%86400/3600),l=Math.floor(t%3600/60),u=t%60;return`${i?`${i}d `:""}${String(r).padStart(2,"0")}:${String(l).padStart(2,"0")}:${String(u).padStart(2,"0")}`}function LX(n){return n==="movie_watch_minutes"||n==="movies_completed"||n==="distinct_movies"?{Icon:Pc,accent:"orange",label:"MOVIE MISSION"}:n==="tv_watch_minutes"||n==="tv_episodes_completed"||n==="distinct_tv"?{Icon:wo,accent:"violet",label:"SERIES MISSION"}:n==="anime_watch_minutes"||n==="anime_episodes_completed"||n==="distinct_anime"?{Icon:pr,accent:"cyan",label:"ANIME MISSION"}:{Icon:cv,accent:"amber",label:"WATCH MISSION"}}const PX={orange:{border:"border-l-orange-500",bar:"bg-orange-500",icon:"bg-orange-500 text-black",text:"text-orange-400"},violet:{border:"border-l-violet-500",bar:"bg-violet-500",icon:"bg-violet-500 text-white",text:"text-violet-400"},cyan:{border:"border-l-cyan-500",bar:"bg-cyan-500",icon:"bg-cyan-500 text-black",text:"text-cyan-400"},amber:{border:"border-l-amber-500",bar:"bg-amber-500",icon:"bg-amber-500 text-black",text:"text-amber-400"}};function o1({quest:n,index:e,claiming:t,onClaim:i}){const r=Math.min(n.target,Math.max(0,n.progress)),l=Math.min(100,Math.round(r/Math.max(1,n.target)*100)),u=!!n.completed_at,h=!!n.claimed_at,d=n.condition_type==="watch_minutes"||n.condition_type.endsWith("_watch_minutes"),p=LX(n.condition_type),m=PX[p.accent];return o.jsxs("article",{className:`quest-card-enter relative overflow-hidden rounded-xl border border-zinc-800 border-l-4 bg-[#111214] p-5 transition-colors duration-200 hover:border-zinc-700 ${u?"border-l-emerald-500":m.border}`,style:{animationDelay:`${e*90}ms`},children:[o.jsxs("div",{className:"relative flex items-start gap-4",children:[o.jsx("div",{className:`grid h-11 w-11 shrink-0 place-items-center rounded-lg ${u?"bg-emerald-500 text-black":m.icon}`,children:u?o.jsx(zr,{className:"h-6 w-6 text-emerald-300"}):o.jsx(p.Icon,{className:"h-6 w-6"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("p",{className:`text-[10px] font-black tracking-[0.2em] ${u?"text-emerald-300":m.text}`,children:u?"MISSION COMPLETE":p.label}),o.jsxs("span",{className:"font-mono text-[10px] text-zinc-600",children:["#",String(e+1).padStart(2,"0")]})]}),o.jsx("h3",{className:"mt-1 truncate text-xl font-black text-white",children:n.title}),o.jsx("p",{className:"mt-1 min-h-10 text-sm leading-5 text-zinc-400",children:n.description})]})]}),o.jsxs("div",{className:"relative mt-6",children:[o.jsxs("div",{className:"mb-2 flex items-end justify-between",children:[o.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-zinc-500",children:"Progress"}),o.jsxs("span",{className:"font-mono text-sm font-black text-white",children:[r.toLocaleStr
4163ing()," ",o.jsx("span",{className:"text-zinc-600",children:"/"})," ",n.target.toLocaleString(),d?" MIN":""]})]}),o.jsx("div",{className:"h-2.5 overflow-hidden rounded-sm bg-black",children:o.jsx("div",{className:`quest-progress-fill h-full ${u?"bg-emerald-500":m.bar}`,style:{width:`${l}%`}})}),o.jsxs("div",{className:"mt-2 flex justify-between text-[11px] font-bold",children:[o.jsxs("span",{className:u?"text-emerald-300":m.text,children:[l,"% SYNCED"]}),!u&&o.jsxs("span",{className:"text-zinc-600",children:[Math.max(0,n.target-r),d?" MIN":""," LEFT"]})]})]}),o.jsxs("div",{className:"relative mt-5 flex items-center justify-between gap-3 border-t border-white/8 pt-4",children:[o.jsxs("div",{className:"flex flex-wrap gap-2 text-xs font-black",children:[o.jsxs("span",{className:"inline-flex items-center gap-1 rounded-lg border border-orange-400/15 bg-orange-500/10 px-2.5 py-1.5 text-orange-200",children:[o.jsx(i5,{className:"h-3.5 w-3.5 fill-orange-300"})," +",n.xp_reward," XP"]}),n.season_points_reward>0&&o.jsxs("span",{className:"inline-flex items-center gap-1 rounded-lg border border-violet-400/15 bg-violet-500/10 px-2.5 py-1.5 text-violet-200",children:[o.jsx(dl,{className:"h-3.5 w-3.5 fill-violet-300"})," +",n.season_points_reward," SP"]})]}),u&&!h?o.jsxs("button",{type:"button",onClick:i,disabled:t,className:"inline-flex items-center gap-2 rounded-lg bg-emerald-500 px-4 py-2.5 text-xs font-black text-black transition-colors hover:bg-emerald-400 disabled:opacity-60",children:[t?o.jsx(fr,{className:"h-4 w-4 animate-spin"}):o.jsx(g1,{className:"h-4 w-4"})," CLAIM"]}):h?o.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-black text-emerald-300",children:[o.jsx(zr,{className:"h-4 w-4"})," CLAIMED"]}):o.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[10px] font-bold text-zinc-600",children:[o.jsx(IR,{className:"h-3.5 w-3.5"})," LOCKED"]})]})]})}function OX({reward:n,onClose:e}){return o.jsx("div",{className:"fixed inset-0 z-200 grid place-items-center bg-black/80 px-4",role:"dialog","aria-modal":"true","aria-label":"Quest rewards claimed",onClick:e,children:o.jsxs("div",{className:"quest-reward-pop w-full max-w-md rounded-xl border border-zinc-700 bg-[#111214] p-8 text-center",onClick:t=>t.stopPropagation(),children:[o.jsx("div",{className:"mx-auto grid h-20 w-20 place-items-center rounded-lg bg-orange-500",children:o.jsx(_o,{className:"h-10 w-10 text-black"})}),o.jsx("p",{className:"mt-6 text-xs font-black tracking-[0.28em] text-orange-300",children:"QUEST REWARD"}),o.jsx("h2",{className:"mt-2 text-4xl font-black text-white",children:"Loot claimed!"}),o.jsxs("p",{className:"mt-2 text-sm text-zinc-400",children:[n.count," ",n.count===1?"mission":"missions"," completed"]}),o.jsxs("div",{className:"mt-7 grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"rounded-2xl border border-orange-400/20 bg-orange-500/10 p-4",children:[o.jsx(i5,{className:"mx-auto h-5 w-5 fill-orange-300 text-orange-300"}),o.jsxs("p",{className:"mt-2 text-2xl font-black text-orange-200",children:["+",n.xp]}),o.jsx("p",{className:"text-[10px] font-bold tracking-widest text-orange-300/60",children:"XP"})]}),o.jsxs("div",{className:"rounded-2xl border border-violet-400/20 bg-violet-500/10 p-4",children:[o.jsx(dl,{className:"mx-auto h-5 w-5 fill-violet-300 text-violet-300"}),o.jsxs("p",{className:"mt-2 text-2xl font-black text-violet-200",children:["+",n.sp]}),o.jsx("p",{className:"text-[10px] font-bold tracking-widest text-violet-300/60",children:"SEASON POINTS"})]})]}),o.jsxs("button",{type:"button",onClick:e,className:"mt-7 w-full rounded-lg bg-white py-3 text-sm font-black text-black transition-colors hover:bg-zinc-200",children:["CONTINUE ",o.jsx(im,{className:"ml-1 inline h-4 w-4"})]})]})})}function DX(){const[n,e]=E.useState(null),[t,i]=E.useState([]),[r,l]=E.useState({}),[u,h]=E.useState(!0),[d,p]=E.useState(null),[m,g]=E.useState(null),[b,y]=E.useState(null),[_,C]=E.useState(null),[,w]=E.useState(0),S=E.useCallback(async(U=!1)=>{U||h(!0);try{const[Y,W]=await Promise.all([dN(),zW()]);e(Y),i(W.quests),p(null)}catch(Y){p(Y instanceof Error?Y.message:"Failed to load quests.")}finally{U||h(!1)}},[]);E.useEffect(()=>{S()},[S]),E.useEffect(()=>{const U=window.setInterval(()=>w(W=>W+1),1e3),Y=()=>{S(!0)};return window.addEventListener("focus",Y),window.addEventListener(k1,Y),()=>{window.clearInterval(U),window.removeEventListener("focus",Y),window.removeEventListener(k1,Y)}},[S]),E.useEffect(()=>{if(!_)return;const U=window.setTimeout(()=>C(null),3500);return()=>window.clearTimeout(U)},[_]);const T=E.useMemo(()=>n?[...n.daily,...n.seasonal]:[],[n]),N=E.useMemo(()=>[...T,...n?.outstanding||[]].filter(U=>U.completed_at&&!U.claimed_at),[T,n]),j=n?.daily.filter(U=>U.completed_at).length||0,O=n?.daily.length?Math.round(j/n.daily.length*100):0,R=n?.season?Math.min(100,Math.max(0,Math.round((Date.now()-new Date(n.season.starts_at).getTime())/(new Date(n.season.ends_at).getTime()-new Date(n.season.starts_at).getTime())*100))):0,z=U=>C({xp:U.reduce((Y,W)=>Y+W.xp_reward,0),sp:U.reduce((Y,W)=>Y+W.season_points_reward,0),count:U.length}),M=async U=>{y(U.id);try{const Y=await DW(U.id);e(Y.dashboard),p(null),z([U])}catch(Y){p(Y instanceof Error?Y.message:"Claim failed.")}finally{y(null)}},P=async()=>{const U=[...N];y("all");try{const Y=await UW();e(Y.dashboard),p(null),U.length&&z(U)}catch(Y){p(Y instanceof Error?Y.message:"Claim failed.")}finally{y(null)}},G=async U=>{const Y=String(r[U.id]||"").trim();
4163if(!Y){p("Enter the Solana wallet address where you want to receive this prize.");return}y(`movie-prize-${U.id}`);try{const W=await $W(U.id,Y);i(J=>J.map(F=>F.id===U.id?W.quest:F)),g(`Sent ${W.quest.prize_sol} SOL to ${W.recipient_wallet}.`)}catch(W){p(W instanceof Error?W.message:"Movie prize claim failed.")}finally{y(null)}};return o.jsxs("main",{className:"min-h-screen bg-[#090a0c] px-4 pb-24 pt-28 text-white md:px-8",children:[o.jsxs("div",{className:"mx-auto max-w-7xl",children:[o.jsx("header",{className:"quest-card-enter rounded-xl border border-zinc-800 bg-[#111214] p-6 md:p-8",children:o.jsxs("div",{className:"flex flex-col justify-between gap-8 lg:flex-row lg:items-end",children:[o.jsxs("div",{className:"max-w-3xl",children:[o.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-orange-400/25 bg-orange-500/10 px-3 py-1.5 text-[10px] font-black tracking-[0.2em] text-orange-300",children:[o.jsx(d8,{className:"h-4 w-4"})," MISSION CONTROL"]}),o.jsxs("h1",{className:"mt-5 text-4xl font-black tracking-tight sm:text-6xl",children:["Play. Progress. ",o.jsx("span",{className:"text-orange-500",children:"Conquer."})]}),o.jsx("p",{className:"mt-3 max-w-2xl text-sm leading-6 text-zinc-400 md:text-base",children:"Watch what you love, complete missions, collect XP, and climb the seasonal ranks."})]}),o.jsxs("div",{className:"flex flex-wrap gap-3",children:[o.jsx("button",{type:"button",onClick:()=>{S()},className:"rounded-xl border border-white/10 bg-white/5 p-3 text-zinc-300 transition hover:rotate-45 hover:bg-white/10","aria-label":"Refresh quests",children:o.jsx(Dd,{className:"h-5 w-5"})}),N.length>0&&o.jsxs("button",{type:"button",onClick:()=>{P()},disabled:b!==null,className:"inline-flex items-center gap-2 rounded-lg bg-orange-500 px-5 py-3 text-sm font-black text-black transition-colors hover:bg-orange-400 disabled:opacity-50",children:[b==="all"?o.jsx(fr,{className:"h-4 w-4 animate-spin"}):o.jsx(g1,{className:"h-4 w-4"})," CLAIM LOOT (",N.length,")"]})]})]})}),d&&o.jsxs("div",{className:"mt-6 rounded-2xl border border-red-500/30 bg-red-500/10 p-4 text-sm text-red-200",children:[d," ",d.toLowerCase().includes("log in")&&o.jsx(Ut,{className:"font-bold underline",to:"/login?next=/quests",children:"Log in"})]}),m&&o.jsx("div",{className:"mt-6 rounded-2xl border border-emerald-500/30 bg-emerald-500/10 p-4 text-sm text-emerald-200",children:m}),u?o.jsx("div",{className:"flex min-h-96 items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx(fr,{className:"mx-auto h-10 w-10 animate-spin text-orange-400"}),o.jsx("p",{className:"mt-3 text-xs font-black tracking-widest text-zinc-600",children:"LOADING MISSIONS"})]})}):n&&o.jsxs(o.Fragment,{children:[o.jsxs("section",{className:"mt-6 grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[o.jsxs("div",{className:"quest-card-enter rounded-lg border border-zinc-800 bg-[#111214] p-5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(J9,{className:"h-5 w-5 text-orange-400"}),o.jsx("span",{className:"text-[10px] font-black tracking-widest text-zinc-600",children:"RESET"})]}),o.jsx("p",{className:"mt-4 font-mono text-2xl font-black",children:g6(n.daily_resets_at)}),o.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Until new daily missions"})]}),o.jsxs("div",{className:"quest-card-enter rounded-lg border border-zinc-800 bg-[#111214] p-5",style:{animationDelay:"70ms"},children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(_o,{className:"h-5 w-5 text-emerald-400"}),o.jsx("span",{className:"text-[10px] font-black tracking-widest text-zinc-600",children:"DAILY CLEAR"})]}),o.jsxs("p",{className:"mt-4 text-2xl font-black",children:[j," ",o.jsxs("span",{className:"text-zinc-600",children:["/ ",n.daily.length]})]}),o.jsx("div",{className:"mt-2 h-1.5 overflow-hidden rounded-sm bg-black",children:o.jsx("div",{className:"h-full bg-emerald-500 transition-all duration-700",style:{width:`${O}%`}})})]}),o.jsxs("div",{className:"quest-card-enter rounded-lg border border-zinc-800 bg-[#111214] p-5",style:{animationDelay:"140ms"},children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(e5,{className:"h-5 w-5 text-violet-400"}),o.jsx("span",{className:"text-[10px] font-black tracking-widest text-zinc-600",children:"SEASON RANK"})]}),o.jsxs("p",{className:"mt-4 text-2xl font-black",children:["#",n.season?.rank||"â"," ",o.jsxs("span",{className:"text-sm text-violet-400",children:[n.season?.points||0," SP"]})]}),o.jsx("p",{className:"mt-1 truncate text-xs text-zinc-500",children:n.season?.name||"No active season"})]}),o.jsxs("div",{className:"quest-card-enter rounded-lg border border-zinc-800 bg-[#111214] p-5",style:{animationDelay:"210ms"},children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(cv,{className:"h-5 w-5 text-cyan-400"}),o.jsxs("span",{className:"text-[10px] font-black tracking-widest text-zinc-600",children:["WAVE ",n.wave?.wave_number||"â"]})]}),o.jsx("p",{className:"mt-4 font-mono text-2xl font-black",children:n.wave?g6(n.wave.ends_at):"--:--:--"}),o.jsx("div",{className:"mt-2 h-1.5 overflow-hidden rounded-sm bg-black",children:o.jsx("div",{className:"h-full bg-violet-500",style:{width:`${R}%`}})})]})]}),o.jsxs("section",{className:"mt-12",children:[o.jsxs("div",{className:"flex items-end justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-[10px] font-black tracking-[0.22em] text-orange-300",children:"DAILY LOADOUT"}),o.jsx("h2",{className:"mt-1 text-3xl font-black",children:"Todayâs missions"}),o.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Three objectives. One day. Keep the streak alive."})]}),o.jsxs("span",{className:"hidden rounded-full border border-white/10 bg-white/5 px-3 py-1 text-xs font-bold text-zinc-400 sm:block",children:[O,"% COMPLETE"]})]}),o.jsxs("div",{className:"mt-6 grid gap-4 lg:grid-cols-3",children:[n.daily.map((U,Y)=>o.jsx(o1,{quest:U,index:Y,claiming:b===U.id,onClaim:()=>{M(U)}},U.id)),n.daily.length===0&&o.jsx("p",{className:"text-zinc-500",children:"No daily missions are enabled."})]})]}),o.jsxs("section",{className:"mt-16",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-[10px] font-black tracking-[0.22em] text-violet-300",children:"WEEKLY RAID"}),o.jsx("h2",{className:"mt-1 text-3xl font-black",children:"Season missions"}),o.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Five shared objectives for the entire PyroPlay community."})]}),o.jsxs("div",{className:"mt-6 grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:[n.seasonal.map((U,Y)=>o.jsx(o1,{quest:U,index:Y,claiming:b===U.id,onClaim:()=>{M(U)}},U.id)),n.seasonal.length===0&&o.jsxs("div",{className:"rounded-3xl border border-dashed border-white/10 p-10 text-center text-zinc-500",children:[o.jsx(Q6,{className:"mx-auto mb-3 h-8 w-8"}),"No active season raid."]})]})]}),t.length>0&&o.jsxs("section",{className:"mt-16",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-[10px] font-black tracking-[0.22em] text-amber-300",children:"FIRST TO FINISH"}),o.jsx("h2",{className:"mt-1 text-3xl font-black",children:"Movie prize drops"}),o.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Reach 80% of a listed movie first. Once reserved, only the winner can claim the SOL prize."})]}),o.jsx("div",{className:"mt-6 grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:t.map(U=>o.jsxs("article",{className:`overflow-hidden rounded-xl border p-5 ${U.is_winner?"border-emerald-400/40 bg-emerald-500/8":"border-amber-400/20 bg-[#111214]"}`,children:[o.jsxs("div",{className:"flex items-start gap-4",children:[U.movie_poster_url?o.jsx("img",{src:U.movie_poster_url,alt:"",className:"h-16 w-11 rounded-lg object-cover"}):o.jsx("div",{className:"grid h-16 w-11 place-items-center rounded-lg bg-amber-400 text-black",children:o.jsx(Pc,{className:"h-5 w-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-[10px] font-black tracking-[0.18em] text-amber-300",children:"MOVIE PRIZE"}),o.jsx("h3",{className:"mt-1 truncate text-xl font-black",children:U.movie_title}),o.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"First verified viewer to reach 80%"})]})]}),o.jsxs("div",{className:"mt-5 border-t border-white/8 pt-4",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("span",{className:"inline-flex items-center gap-1 rounded-lg bg-amber-400/15 px-3 py-2 text-sm font-black text-amber-200",children:[o.jsx(_o,{className:"h-4 w-4"})," ",U.prize_sol," SOL"]}),U.is_winner&&U.payout_status==="paid"?o.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-black text-emerald-300",children:[o.jsx(zr,{className:"h-4 w-4"})," PAID"]}):U.is_winner&&U.payout_status!=="ready_to_claim"?o.jsx("span",{className:"text-xs font-bold text-zinc-400",children:"CLAIM PROCESSING"}):U.is_winner?null:o.jsx("span",{className:"text-xs font-bold text-amber-300",children:"LIVE"})]}),U.is_winner&&U.payout_status==="ready_to_claim"&&o.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[o.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-emerald-200",children:["Claim to Solana wallet",o.jsx("input",{value:r[U.id]||"",onChange:Y=>l(W=>({...W,[U.id]:Y.target.value})),placeholder:"Your Phantom or Solana wallet address",autoComplete:"off",spellCheck:!1,className:"mt-1 w-full rounded-lg border border-white/10 bg-black/30 px-3 py-2.5 text-sm text-white placeholder:text-zinc-600"})]}),o.jsxs("button",{type:"button",disabled:b===`movie-prize-${U.id}`,onClick:()=>{G(U)},className:"inline-flex items-center justify-center gap-2 rounded-lg bg-emerald-500 px-4 py-2.5 text-xs font-black text-black hover:bg-emerald-400 disabled:opacity-60",children:[b===`movie-prize-${U.id}`?o.jsx(fr,{className:"h-4 w-4 animate-spin"}):o.jsx(g1,{className:"h-4 w-4"})," CLAIM ",U.prize_sol," SOL"]})]}),U.is_winner&&U.payout_status==="paid"&&U.payout_wallet_address&&o.jsxs("p",{className:"mt-3 break-all text-xs text-zinc-400",children:["Paid to ",U.payout_wallet_address]})]})]},U.id))})]}),n.outstanding.length>0&&o.jsxs("section",{className:"mt-16",children:[o.jsx("p",{className:"text-[10px] font-black tracking-[0.22em] text-emerald-300",children:"LOST LOOT"}),o.jsx("h2",{className:"mt-1 text-3xl font-black",children:"Unclaimed rewards"}),o.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Rewards you earned earlier remain safely stored here."}),o.jsx("div",{className:"mt-6 grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:n.outstanding.map((U,Y)=>o.jsx(o1,{quest:U,index:Y,claiming:b===U.id,onClaim:()=>{M(U)}},U.id))})]})]})]}),_&&o.jsx(OX,{reward:_,onClose:()=>C(null)})]})}const x6=[{value:"movie_watch_minutes",label:"Movie minutes"},{value:"tv_watch_minutes",label:"Series minutes"},{value:"anime_watch_minutes",label:"Anime minutes"},{value:"watch_minutes",label:"Any watch minutes"}],b6=()=>
4163({cadence:"daily",condition_type:"movie_watch_minutes",title:"",description:"",target:60,xp_reward:50,season_points_reward:20,rotation_weight:1,enabled:!0});function UX(){const[n,e]=E.useState(null),[t,i]=E.useState([]),[r,l]=E.useState([]),[u,h]=E.useState([]),[d,p]=E.useState({daily:0,seasonal:0,required_daily:3,required_seasonal:5}),[m,g]=E.useState(b6()),[b,y]=E.useState({name:"",description:"",artwork_url:"",starts_at:""}),[_,C]=E.useState({movie_id:"",movie_title:"",movie_poster_url:"",prize_sol:"0.1"}),[w,S]=E.useState(null),[T,N]=E.useState(null),[j,O]=E.useState(null),R=E.useCallback(async()=>{try{const F=await IW();if(e(F.allowed),!F.allowed)return;const[$,V,se]=await Promise.all([VW(),XW(),FW()]);i($.templates),l(V.seasons),p(V.pool),h(se.quests)}catch(F){e(!1),N(F instanceof Error?F.message:"Could not load admin data.")}},[]);E.useEffect(()=>{R()},[R]);const z=async()=>{S("new-template");try{await GW(m),g(b6()),N("Quest template created."),await R()}catch(F){N(F instanceof Error?F.message:"Create failed.")}finally{S(null)}},M=async(F,$)=>{S(F.id);try{await qW(F.id,$),N("Template saved."),await R()}catch(V){N(V instanceof Error?V.message:"Save failed.")}finally{S(null)}},P=(F,$)=>{i(V=>V.map(se=>se.id===F?{...se,...$}:se))},G=async()=>{S("new-season");try{await YW({...b,starts_at:new Date(b.starts_at).toISOString()}),y({name:"",description:"",artwork_url:"",starts_at:""}),N("Eight-week season created as a draft."),await R()}catch(F){N(F instanceof Error?F.message:"Season creation failed.")}finally{S(null)}},U=async F=>{S(F.id);try{await i6(F.id,!1),N("Season published and will activate automatically."),await R()}catch($){const V=$ instanceof Error?$.message:"Publish failed.";V.includes("below the recommended size")&&window.confirm(`${V} Publish anyway?`)?(await i6(F.id,!0),await R()):N(V)}finally{S(null)}},Y=async F=>{S(`preview-${F.id}`);try{const $=await KW(F.id);O({seasonId:F.id,waves:$.waves})}catch($){N($ instanceof Error?$.message:"Preview failed.")}finally{S(null)}},W=async()=>{S("new-movie-prize");try{const F=await BW({movie_id:_.movie_id,movie_title:_.movie_title,movie_poster_url:_.movie_poster_url||void 0,prize_sol:Number(_.prize_sol)});C({movie_id:"",movie_title:"",movie_poster_url:"",prize_sol:"0.1"}),N(`Prize wallet created. Send ${F.quest.prize_sol} SOL to it, then activate the quest.`),await R()}catch(F){N(F instanceof Error?F.message:"Movie prize quest creation failed.")}finally{S(null)}},J=async F=>{S(`activate-${F.id}`);try{await HW(F.id),N("Movie prize quest is live. The first viewer to reach 80% can claim it."),await R()}catch($){N($ instanceof Error?$.message:"Could not activate this prize quest.")}finally{S(null)}};return n===null?o.jsx("main",{className:"flex min-h-screen items-center justify-center bg-zinc-950",children:o.jsx(fr,{className:"h-8 w-8 animate-spin text-orange-400"})}):n?o.jsx("main",{className:"min-h-screen bg-zinc-950 px-4 pb-20 pt-28 text-white md:px-8",children:o.jsxs("div",{className:"mx-auto max-w-7xl",children:[o.jsxs("header",{children:[o.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.18em] text-orange-300",children:"Protected administration"}),o.jsx("h1",{className:"mt-2 text-4xl font-black",children:"Gamification Control Room"}),o.jsx("p",{className:"mt-2 text-zinc-400",children:"Manage daily pools, weekly season quests, and eight-week seasons."})]}),T&&o.jsx("div",{className:"mt-6 rounded-xl border border-white/10 bg-white/5 p-4 text-sm text-zinc-200",children:T}),o.jsxs("section",{className:"mt-8 grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{className:`rounded-2xl border p-5 ${d.daily>=d.required_daily?"border-emerald-500/20 bg-emerald-500/8":"border-amber-500/30 bg-amber-500/8"}`,children:[o.jsx("p",{className:"text-sm text-zinc-400",children:"Enabled daily pool"}),o.jsxs("p",{className:"mt-2 text-3xl font-black",children:[d.daily," ",o.jsxs("span",{className:"text-sm text-zinc-500",children:["/ ",d.required_daily," required"]})]})]}),o.jsxs("div",{className:`rounded-2xl border p-5 ${d.seasonal>=d.required_seasonal?"border-violet-500/20 bg-violet-500/8":"border-amber-500/30 bg-amber-500/8"}`,children:[o.jsx("p",{className:"text-sm text-zinc-400",children:"Enabled seasonal pool"}),o.jsxs("p",{className:"mt-2 text-3xl font-black",children:[d.seasonal," ",o.jsxs("span",{className:"text-sm text-zinc-500",children:["/ ",d.required_seasonal," required"]})]})]})]}),o.jsxs("section",{className:"mt-10 rounded-3xl border border-amber-400/20 bg-amber-500/5 p-6",children:[o.jsxs("h2",{className:"flex items-center gap-2 text-xl font-black",children:[o.jsx(_o,{className:"h-5 w-5 text-amber-300"})," First-to-watch SOL prize"]}),o.jsx("p",{className:"mt-2 text-sm text-zinc-400",children:"Create a dedicated prize wallet, fund it yourself, then activate it. The first verified viewer to reach 80% of that movie becomes the only account able to claim the SOL."}),o.jsxs("div",{className:"mt-5 grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[o.jsx("input",{value:_.movie_id,onChange:F=>C({..._,movie_id:F.target.value}),placeholder:"TMDB movie ID",inputMode:"numeric",className:"rounded-xl border border-white/10 bg-zinc-900 p-3"}),o.jsx("input",{value:_.movie_title,onChange:F=>C({..._,movie_title:F.target.value}),placeholder:"Movie title",className:"rounded-xl border border-white/10 bg-zinc-900 p-3"}),o.jsx("input",{value:_.movie_poster_url,onChange:F=>C({..._,movie_poster_url:F.target.value}),placeholder:"Poster URL (optional)",className:"rounded-xl border border-white/10 bg-zinc-900 p-3"}),o.jsxs("label",{className:"text-xs text-zinc-500",children:["Prize (SOL)",o.jsx("input",{type:"number",min:"0.000000001",step:"0.001",value:_.prize_sol,onChange:F=>C({..._,prize_sol:F.target.value}),className:"mt-1 w-full rounded-xl border border-white/10 bg-zinc-900 p-3 text-white"})]})]}),o.jsxs("button",{type:"button",onClick:()=>{W()},disabled:!_.movie_id||!_.movie_title||!Number(_.prize_sol)||w!==null,className:"mt-5 inline-flex items-center gap-2 rounded-xl bg-amber-400 px-5 py-3 text-sm font-black text-black hover:bg-amber-300 disabled:opacity-50",children:[w==="new-movie-prize"?o.jsx(fr,{className:"h-4 w-4 animate-spin"}):o.jsx(Od,{className:"h-4 w-4"})," Create prize wallet"]}),o.jsxs("div",{className:"mt-6 space-y-3",children:[u.map(F=>o.jsx("article",{className:"rounded-2xl border border-white/10 bg-black/25 p-4",children:o.jsxs("div",{className:"flex flex-col justify-between gap-4 lg:flex-row lg:items-center",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-black uppercase tracking-wider text-amber-300",children:F.status.replaceAll("_"," ")}),o.jsxs("h3",{className:"mt-1 text-lg font-black",children:[F.movie_title," ",o.jsxs("span",{className:"text-amber-300",children:["⢠",F.prize_sol," SOL"]})]}),o.jsxs("p",{className:"mt-2 break-all font-mono text-xs text-zinc-400",children:["Fund wallet: ",F.prize_wallet_address]}),o.jsxs("p",{className:"mt-1 text-xs text-zinc-500",children:["Detected balance: ",F.funded_sol===null?"Unavailable":`${F.funded_sol} SOL`,F.is_winner?" ⢠Winner reserved":""]})]}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard?.writeText(F.prize_wallet_address)},className:"inline-flex items-center gap-2 rounded-xl border border-white/10 px-3 py-2 text-xs font-bold hover:bg-white/5",children:[o.jsx(Wc,{className:"h-3.5 w-3.5"})," Copy wallet"]}),F.status==="funding_pending"&&o.jsx("button",{type:"button",disabled:w===`activate-${F.id}`,onClick:()=>{J(F)},className:"rounded-xl bg-emerald-500 px-4 py-2 text-xs font-black text-black hover:bg-emerald-400 disabled:opacity-50",children:w===`activate-${F.id}`?"Checkingâ¦":"Verify & activate"})]})]})},F.id)),u.length===0&&o.jsx("p",{className:"text-sm text-zinc-500",children:"No movie prizes created yet."})]})]}),o.jsxs("section",{className:"mt-10 rounded-3xl border border-white/10 bg-white/4 p-6",children:[o.jsxs("h2",{className:"flex items-center gap-2 text-xl font-black",children:[o.jsx(Od,{className:"h-5 w-5 text-orange-300"})," New quest template"]}),o.jsxs("div",{className:"mt-5 grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[o.jsxs("select",{value:m.cadence,onChange:F=>g({...m,cadence:F.target.value}),className:"rounded-xl border border-white/10 bg-zinc-900 p-3",children:[o.jsx("option",{value:"daily",children:"Daily"}),o.jsx("option",{value:"seasonal",children:"Seasonal"})]}
4163),o.jsx("select",{value:m.condition_type,onChange:F=>g({...m,condition_type:F.target.value}),className:"rounded-xl border border-white/10 bg-zinc-900 p-3",children:x6.map(F=>o.jsx("option",{value:F.value,children:F.label},F.value))}),o.jsx("input",{value:m.title,onChange:F=>g({...m,title:F.target.value}),placeholder:"Quest title",className:"rounded-xl border border-white/10 bg-zinc-900 p-3"}),o.jsx("input",{value:m.description,onChange:F=>g({...m,description:F.target.value}),placeholder:"Description",className:"rounded-xl border border-white/10 bg-zinc-900 p-3"}),[["Target","target"],["XP reward","xp_reward"],["Season points","season_points_reward"],["Rotation weight","rotation_weight"]].map(([F,$])=>o.jsxs("label",{className:"text-xs text-zinc-500",children:[F,o.jsx("input",{type:"number",min:$==="season_points_reward"?0:1,value:m[$],onChange:V=>g({...m,[$]:Number(V.target.value)}),className:"mt-1 w-full rounded-xl border border-white/10 bg-zinc-900 p-3 text-white"})]},$))]}),o.jsxs("button",{type:"button",onClick:()=>{z()},disabled:!m.title||w!==null,className:"mt-5 inline-flex items-center gap-2 rounded-xl bg-orange-500 px-5 py-3 text-sm font-black hover:bg-orange-400 disabled:opacity-50",children:[w==="new-template"?o.jsx(fr,{className:"h-4 w-4 animate-spin"}):o.jsx(N3,{className:"h-4 w-4"})," Create template"]})]}),o.jsxs("section",{className:"mt-10",children:[o.jsx("h2",{className:"text-2xl font-black",children:"Quest templates"}),o.jsx("div",{className:"mt-4 grid gap-4 lg:grid-cols-2",children:t.filter(F=>!F.archived_at).map(F=>o.jsxs("article",{className:"rounded-2xl border border-white/10 bg-white/4 p-5",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("p",{className:"text-xs font-bold uppercase tracking-wider text-orange-300",children:[F.cadence," ⢠",x6.find($=>$.value===F.condition_type)?.label]}),o.jsx("input",{value:F.title,onChange:$=>P(F.id,{title:$.target.value}),className:"mt-2 w-full rounded-lg border border-transparent bg-transparent text-lg font-black focus:border-white/10 focus:bg-zinc-900"}),o.jsx("input",{value:F.description,onChange:$=>P(F.id,{description:$.target.value}),className:"mt-1 w-full rounded-lg border border-transparent bg-transparent text-sm text-zinc-500 focus:border-white/10 focus:bg-zinc-900"})]}),o.jsx("button",{type:"button",onClick:()=>{M(F,{enabled:!F.enabled})},className:`rounded-full px-3 py-1 text-xs font-bold ${F.enabled?"bg-emerald-500/20 text-emerald-300":"bg-zinc-800 text-zinc-400"}`,children:F.enabled?"Enabled":"Disabled"})]}),o.jsx("div",{className:"mt-4 grid grid-cols-4 gap-2",children:[["Target","target"],["XP","xp_reward"],["SP","season_points_reward"],["Weight","rotation_weight"]].map(([$,V])=>o.jsxs("label",{className:"text-[10px] uppercase text-zinc-500",children:[$,o.jsx("input",{type:"number",min:V==="season_points_reward"?0:1,value:F[V],onChange:se=>P(F.id,{[V]:Number(se.target.value)}),className:"mt-1 w-full rounded-lg border border-white/10 bg-zinc-900 p-2 text-sm text-white"})]},V))}),o.jsxs("div",{className:"mt-5 flex gap-2",children:[o.jsxs("button",{type:"button",disabled:w===F.id,onClick:()=>{M(F,F)},className:"inline-flex items-center gap-2 rounded-lg border border-white/10 px-3 py-2 text-xs font-bold hover:bg-white/5",children:[o.jsx(N3,{className:"h-3.5 w-3.5"})," Save"]}),o.jsxs("button",{type:"button",disabled:w===F.id,onClick:()=>{WW(F.id).then(R)},className:"inline-flex items-center gap-2 rounded-lg border border-red-500/20 px-3 py-2 text-xs font-bold text-red-300 hover:bg-red-500/10",children:[o.jsx(Y9,{className:"h-3.5 w-3.5"})," Archive"]})]})]},F.id))})]}),o.jsxs("section",{className:"mt-12 rounded-3xl border border-violet-500/20 bg-violet-500/5 p-6",children:[o.jsxs("h2",{className:"flex items-center gap-2 text-xl font-black",children:[o.jsx(nR,{className:"h-5 w-5 text-violet-300"})," Create an eight-week season"]}),o.jsxs("div",{className:"mt-5 grid gap-3 md:grid-cols-2",children:[o.jsx("input",{value:b.name,onChange:F=>y({...b,name:F.target.value}),placeholder:"Season name",className:"rounded-xl border border-white/10 bg-zinc-900 p-3"}),o.jsx("input",{type:"datetime-local",value:b.starts_at,onChange:F=>y({...b,starts_at:F.target.value}),className:"rounded-xl border border-white/10 bg-zinc-900 p-3"}),o.jsx("input",{value:b.description,onChange:F=>y({...b,description:F.target.value}),placeholder:"Description",className:"rounded-xl border border-white/10 bg-zinc-900 p-3 md:col-span-2"})]}),o.jsx("button",{type:"button",disabled:!b.name||!b.starts_at||w!==null,onClick:()=>{G()},className:"mt-5 rounded-xl bg-violet-500 px-5 py-3 text-sm font-black hover:bg-violet-400 disabled:opacity-50",children:"Create draft season"})]}),o.jsxs("section",{className:"mt-10",children:[o.jsx("h2",{className:"text-2xl font-black",children:"Seasons"}),o.jsx("div",{className:"mt-4 space-y-3",children:r.map(F=>o.jsxs("article",{className:"rounded-2xl border border-white/10 bg-white/4 p-5",children:[o.jsxs("div",{className:"flex flex-col justify-between gap-4 md:flex-row md:items-center",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"text-xs font-bold uppercase tracking-wider text-violet-300",children:["Season ",F.season_number]}),o.jsx("h3",{className:"mt-1 text-lg font-black",children:F.name}),o.jsxs("p",{className:"mt-1 text-xs text-zinc-500",children:[new Date(F.starts_at).toLocaleStr
4163ing()," â ",new Date(F.ends_at).toLocaleString()]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{type:"button",onClick:()=>{Y(F)},className:"rounded-xl border border-white/10 px-4 py-2 text-xs font-bold hover:bg-white/5",children:"Preview 8 waves"}),F.published?o.jsxs("span",{className:"inline-flex items-center gap-2 text-sm font-bold text-emerald-300",children:[o.jsx(uR,{className:"h-4 w-4"})," Published"]}):o.jsx("button",{type:"button",disabled:w===F.id,onClick:()=>{U(F)},className:"rounded-xl bg-emerald-500 px-4 py-2 text-sm font-black text-black hover:bg-emerald-400",children:"Publish"})]})]}),j?.seasonId===F.id&&o.jsx("div",{className:"mt-5 grid gap-2 border-t border-white/8 pt-4 md:grid-cols-2",children:j.waves.map($=>o.jsxs("div",{className:"rounded-xl bg-black/25 p-3",children:[o.jsxs("p",{className:"text-xs font-black text-violet-300",children:["Week ",$.wave_number]}),o.jsx("p",{className:"mt-1 text-xs text-zinc-400",children:$.templates.map(V=>V.title).join(" ⢠")||"No enabled templates"})]},$.wave_number))})]},F.id))})]})]})}):o.jsx("main",{className:"flex min-h-screen items-center justify-center bg-zinc-950 px-4 text-white",children:o.jsxs("div",{className:"max-w-md rounded-2xl border border-red-500/30 bg-red-500/10 p-8 text-center",children:[o.jsx(r8,{className:"mx-auto h-10 w-10 text-red-300"}),o.jsx("h1",{className:"mt-4 text-2xl font-black",children:"Admin access required"}),o.jsx("p",{className:"mt-2 text-sm text-zinc-400",children:"Log in with a Supabase user listed in the serverâs ADMIN_USER_IDS setting."}),T&&o.jsx("p",{className:"mt-4 text-xs text-red-200",children:T})]})})}const yd="PyroPlay",l1="https://watch-server-production-c01b.up.railway.app/api",v6="a418d58c-24aa-49b8-ae62-4dbe05c06340",pN="watchpump:announcement-ack:v1";function mN(){try{const n=window.localStorage.getItem(pN);if(!n)return[];const e=JSON.parse(n);return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}catch{return[]}}function IX(n){const e=new Set(mN());e.add(n),window.localStorage.setItem(pN,JSON.stringify(Array.from(e)))}function zX(n,e){const t=n.starts_at?new Date(n.starts_at).getTime():Number.NEGATIVE_INFINITY,i=n.ends_at?new Date(n.ends_at).getTime():Number.POSITIVE_INFINITY;return t<=e&&i>=e}function $X(n){return n.trim().toLowerCase().replace(/[^a-z0-9_.-]/g,"")}function FX(n){return`${n}@pyroplay.tv`}const BX=[{label:"X Community",href:"https://x.com/i/communities/2032160643374072281",icon:"https://img.freepik.com/free-vector/new-2023-twitter-logo-x-icon-design_1017-45418.jpg?semt=ais_hybrid&w=740&q=80",iconAlt:"X logo"},{label:"X",href:"https://x.com/pyroplaytv",icon:"https://img.freepik.com/free-vector/new-2023-twitter-logo-x-icon-design_1017-45418.jpg?semt=ais_hybrid&w=740&q=80",iconAlt:"X logo"},{label:"Telegram",href:"https://t.me/pyroplaytv",icon:"https://static.vecteezy.com/system/resources/previews/023/986/562/non_2x/telegram-logo-telegram-logo-transparent-telegram-icon-transparent-free-free-png.png",iconAlt:"Telegram logo"},{label:"Instagram",href:"https://www.instagram.com/pyroplaytv/",icon:"https://upload.wikimedia.org/wikipedia/commons/archive/a/a5/20200512141345%21Instagram_icon.png",iconAlt:"Instagram logo"},{label:"TikTok",href:"https://www.tiktok.com/@pyroplaytv",icon:"https://img.freepik.com/premium-vector/tik-tok-logo_578229-290.jpg?semt=ais_hybrid&w=740&q=80",iconAlt:"TikTok logo"}],HX=[{label:"Anime",to:"/anime"},{label:"Movies",to:"/movies"},{label:"Family",to:"/family"},{label:"TV Shows",to:"/tv"},{label:"Sports",to:"/sports"},{label:"Leaderboard",to:"/leaderboard"},{label:"Quests",to:"/quests"},{label:"Token",to:"/token"},{label:"Unlocked",to:"/unlocked"},{label:"Cinema",to:"/cinema"}],VX=[{label:"Advertise",to:"/advertise"},{label:"DMCA",to:"/dmca"},{label:"Privacy Policy",to:"/privacy"},{label:"Login",to:"/login"},{label:"Account",to:"/account"}],GX=[{label:"Anime",to:"/anime",icon:hN,preferenceId:"anime",match:n=>n.startsWith("/anime")},{label:"TV",to:"/tv",icon:Ld.tv,preferenceId:"tv",match:n=>n.startsWith("/tv")},{label:"Movies",to:"/movies",icon:Ld.movies,preferenceId:"movies",match:n=>n.startsWith("/movies")}
4163,{label:"Family",to:"/family",icon:Ld.movies,match:n=>n.startsWith("/family")},{label:"Sports",to:"/sports",icon:fN,preferenceId:"sports",match:n=>n==="/sports"||n.startsWith("/sports/")}];function qX(n){return n==="/"?"Home":n==="/anime"?"Anime":n==="/tv"?"TV Shows":n==="/movies"?"Movies":n==="/family"?"Family":n==="/sports"?"Live Sports":n==="/sportsv2"?"Live Sports v2":n==="/channels"?"Channels":n.startsWith("/channels/")?"Channel":n.startsWith("/sports/")?"Match Center":n==="/universes"?"Universes":n==="/unlocked"?"Unlocked":n==="/unlock-more"?"Unlock More":n==="/token"?"Token":n==="/advertise"?"Advertise":n==="/dmca"?"DMCA":n==="/privacy"?"Privacy Policy":n==="/chuck-norris"?"Chuck Norris":n==="/pwa"?"Pyro Clicker":n==="/leaderboard"?"Leaderboard":n==="/quests"?"Daily & Season Quests":n==="/admin/gamification"?"Gamification Admin":n==="/account"?"Account":n==="/account/preferences"?"Preferences":n==="/account/security"?"Security":n==="/account/referral"?"Referral":n==="/account/watch-later"?"Watch Later":n==="/account/history"?"History":n==="/account/leaderboard"||n==="/account/stats"?"Stats":n==="/cinema"?"Cinema Mode":n==="/cinema/admin"?"Cinema Admin":n.startsWith("/cinema/room/")?"Cinema Room":yd}function WX(){const[n,e]=E.useState(!1),[t,i]=E.useState(null),[r,l]=E.useState([]),[u,h]=E.useState(!0),[d,p]=E.useState(!1),[m,g]=E.useState(null),[b,y]=E.useState(Ea),[_,C]=E.useState(!1),[w,S]=E.useState(null),[T,N]=E.useState("login"),[j,O]=E.useState(""),[R,z]=E.useState(""),[M,P]=E.useState(""),[G,U]=E.useState(null),[Y,W]=E.useState(null),[J,F]=E.useState(!1),[$,V]=E.useState(""),[se,ue]=E.useState(!1),[Ce,D]=E.useState(0),[H,Z]=E.useState(null),[Ee,je]=E.useState(null),[le,Se]=E.useState(!1),[de,Me]=E.useState(null),[Le,pe]=E.useState(!1),Be=E.useRef(new Set),We=js(),dt=ml(),Ct=We.pathname.startsWith("/cinema/room/"),ut=We.pathname==="/pwa",kt=/^\/channels\/[^/]+/.test(We.pathname),[K,Nt]=Ki(),Tt=K.get("profile")?.trim()||"",Mt=K.get("watch")?.trim()||"",nt=K.has("server"),I=Mt.startsWith("anime-")&&K.has("episode"),k=!!Mt&&nt||I,Q=K.get("search")==="true"||K.has("q");E.useEffect(()=>{if(!LW(K))return;const Ge=new URLSearchParams(K);Ge.delete(RW()),Nt(Ge,{replace:!0})},[K,Nt]);const fe=!Ct&&!ut&&!t&&!k&&!kt,be=!Ct&&!ut&&!t&&!k&&!kt,xe=GX.filter(ce=>!ce.preferenceId||C5(b,ce.preferenceId));E.useEffect(()=>{const ce=K.get("server"),Ge=K.get("watch")?.trim();if(!ce||Ge)return;const vt=new URLSearchParams(K);vt.delete("server"),Nt(vt,{replace:!0})},[K,Nt]);const Xe=ce=>{ce?(K.set("search","true"),Nt(K)):(K.delete("search"),K.delete("q"),K.delete("mode"),Nt(K))};E.useEffect(()=>{const ce=K.get("watch"),Ge=K.get("q")?.trim();if(ce){document.title=`Watching | ${yd}`;return}if(Q){document.title=Ge?`Search: ${Ge} | ${yd}`:`Search | ${yd}`;return}document.title=`${qX(We.pathname)} | ${yd}`},[We.pathname,K,Q]),E.useEffect(()=>{if(!Tt){Z(null),je(null),Se(!1);return}let ce=!0;return Se(!0),je(null),fv(Tt).then(Ge=>{ce&&Z(Ge.profile||null)}).catch(Ge=>{ce&&(Z(null),je(Ge instanceof Error?Ge.message:"Failed to load profile"))}).finally(()=>{ce&&Se(!1)}),()=>{ce=!1}},[Tt]);const $e=()=>{const ce=new URLSearchParams(K);ce.delete("profile"),Nt(ce)};E.useEffect(()=>{const ce=()=>{window.scrollY>0?e(!0):e(!1)};return window.addEventListener("scroll",ce),()=>window.removeEventListener("scroll",ce)},[]),E.useEffect(()=>{if(!Fe){h(!1),p(!1),g(null);return}let ce=!0;Fe.auth.getSession().then(({data:vt})=>{ce&&(vt.session?.access_token&&n6(vt.session.access_token,l1).catch(rn=>{console.warn("Stored referral code application failed:",rn)}),g(vt.session?.user?.id||null),p(!!vt.session?.user),h(!1))});const{data:{subscription:Ge}}=Fe.auth.onAuthStateChange((vt,rn)=>{rn?.access_token&&n6(rn.access_token,l1).catch(On=>{console.warn("Stored referral code application failed:",On)}),g(rn?.user?.id||null),p(!!rn?.user),h(!1)});return()=>{ce=!1,Ge.unsubscribe()}},[]),E.useEffect(()=>{let ce=!0;return m?(N5(m).then(Ge=>{ce&&y(Ge)}).catch(Ge=>{console.warn("Failed to load app preferences:",Ge),ce&&y(Ea)}),()=>{ce=!1}):(y(Ea),()=>{ce=!1})},[m]),E.useEffect(()=>{const ce=Ge=>{y(E5(Ge.detail))};return window.addEventListener(M1,ce),()=>{window.removeEventListener(M1,ce)}},[]);const it=E.useCallback(async()=>
4163{if(!Fe){Me(null),pe(!1);return}const{data:ce,error:Ge}=await Fe.from("app_announcements").select("id, title, message, image_url, cta_label, action_label, action_url, starts_at, ends_at, is_active, created_at").eq("is_active",!0).order("starts_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1}).limit(10);if(Ge){console.warn("Failed to load active announcement:",Ge.message);return}if(!ce?.length){Me(null),pe(!1);return}const vt=Date.now(),rn=new Set(mN()),On=ce.find(Dn=>rn.has(Dn.id)?!1:zX(Dn,vt))??null;Me(On),pe(!!On)},[]);E.useEffect(()=>{it()},[it]);const ht=ce=>{const Ge=new URLSearchParams(K);ce.type==="tv"?(Ge.set("season",String(ce.season||1)),Ge.set("episode",String(ce.episode||1))):ce.type==="anime"?(Ge.delete("season"),Ge.set("episode",String(ce.episode||1))):(Ge.delete("season"),Ge.delete("episode")),Nt(Ge)},X=ce=>{if(!u){if(!d&&!ce.isFree){S(ce),N("login"),U(null),W(null),C(!0);return}eS({id:String(ce.id),type:ce.type,title:ce.title||"Untitled",image:ce.image,watchParam:`${ce.type}-${ce.id}`}),ht(ce),i(ce)}},oe=()=>{if(!t){i(null);return}const ce=new URLSearchParams;ce.set("watch",`${t.type}-${t.id}`),t.type==="tv"&&(ce.set("season",String(t.season||1)),ce.set("episode",String(t.episode||1)));const Ge=t.type==="anime"?"/anime":t.type==="tv"?"/tv":"/movies";dt({pathname:Ge,search:`?${ce.toString()}`},{replace:!0}),i(null)},ke=ce=>{l(Ge=>Ge.filter(vt=>vt.id!==ce))},Ae=ce=>{l(Ge=>Ge.filter(vt=>vt.movieId!==ce))},De=(ce,Ge,vt,rn,On)=>{const Dn=crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random()}`;l(Qn=>[...Qn.slice(-2),{id:Dn,title:ce,message:Ge,movieId:vt,imageUrl:rn,watchParam:On}]),setTimeout(()=>{ke(Dn)},8e3)},st=async ce=>{const Ge=ce.movie_title||`Movie #${ce.movie_id}`,vt=ce.watch_param||`movie-${ce.movie_id}`;let rn=ce.backdrop_url||null;if(!rn&&Fe){const{data:On}=await Fe.from("movie_wallets_public").select("backdrop_url").eq("movie_id",ce.movie_id).maybeSingle();rn=On?.backdrop_url||null}De("Unlocked",`${Ge} is now unlocked for everyone.`,ce.movie_id,rn,vt)};E.useEffect(()=>{if(!Fe)return;const ce=Fe.channel("movie-wallets-broadcast").on("postgres_changes",{event:"UPDATE",schema:"public",table:"movie_wallets_public"},Ge=>{const vt=Ge.new;if(!vt?.is_paid)return;const rn=`${vt.movie_id}-${vt.paid_at||vt.updated_at||"paid"}`;Be.current.has(rn)||(Be.current.add(rn),st(vt))}).subscribe();return()=>{Fe&&Fe.removeChannel(ce)}},[]);const te=ce=>{Ae(ce)},Ie=ce=>{const Ge=ce.watchParam||`movie-${ce.movieId}`,vt=new URLSearchParams(K);vt.set("watch",Ge),Nt(vt),ke(ce.id)},Pe=()=>{V(""),ue(!1),D(ce=>ce+1)};E.useEffect(()=>{if(!_||!v6){V(""),ue(!1);return}Pe()},[T,_]);const Ze=()=>{C(!1),U(null),W(null),z(""),P(""),V(""),ue(!1)},ze=E.useCallback(()=>{de&&(IX(de.id),pe(!1))},[de]),ge=async ce=>{if(ce)try{const Ge=await fetch(`${l1}/users/wallet/provision`,{method:"POST",headers:{Authorization:`Bearer ${ce}`}});if(!Ge.ok){const vt=await Ge.text().catch(()=>"");console.warn("Wallet provisioning request failed:",vt||Ge.statusText)}}catch(Ge){console.warn("Wallet provisioning request failed:",Ge)}},Ye=ce=>{if(!ce){Ze();return}eS({id:String(ce.id),type:ce.type,title:ce.title||"Untitled",image:ce.image,watchParam:`${ce.type}-${ce.id}`}),i(ce),Ze()},pt=ce=>{Ye(ce)},Wt=async ce=>{ce.preventDefault(),U(null),W(null);const Ge=j.trim(),vt=Ge.toLowerCase(),rn=$X(Ge);if(!Fe){U("Authentication is unavailable. Add Supabase env variables first.");return}if(T==="login"){if(!vt||!vt.includes("@")){U("Please enter a valid email address.");return}}else if(!rn){U("Please enter a valid username using letters, numbers, ., _, or -.");return}if(R.length<6){U("Password must be at least 6 characters.");return}if(T==="register"&&R!==M){U("Passwords do not match.");return}if(!$){U(T==="login"?"Complete the captcha before logging in.":"Complete the captcha before creating your account.");return}F(!0);try{const On=T==="login"?vt:FX(rn);if(T==="login"){const{data:bi,error:qn}=await Fe.auth.signInWithPassword({email:On,password:R,options:{...$?{captchaToken:$}:{}}});if(qn){$&&Pe(),U(qn.message);return}await ge(bi.session?.access_token),$&&Pe(),pt(w);return}const{data:Dn,error:Qn}=await Fe.auth.signUp({email:On,password:R,options:{data:{username:rn},...$?{captchaToken:$}:{}}});if(Qn){$&&Pe(),U(Qn.message);return}if(await ge(Dn.session?.access_token),$&&Pe(),Dn.session){pt(w);return}W("Account created. Log in to continue playback."),N("login"),z(""),P("")}finally{F(!1)}};return E.useEffect(()=>{if(!_)return;const ce=Ge=>{Ge.key==="Escape"&&Ze()};return window.addEventListener("keydown",ce),()=>{window.removeEventListener("keydown",ce)}},[_]),Fe?o.jsxs("div",{className:`${Ct?"h-screen overflow-hidden":"min-h-screen overflow-x-hidden"} bg-zinc-950 text-white font-sans`,children:[!Ct&&!ut&&!k&&!kt&&o.jsx(m7,{appPreferences:b,isScrolled:n,onSearchClick:()=>Xe(!0)}),!k&&o.jsx("main",{className:be?"pb-[calc(5.75rem+env(safe-area-inset-bottom))] md:pb-0":void 0,children:o.jsxs(NA,{children:[o.jsx(on,{path:"/",element:o.jsx(EL,{onPlay:X,isPlayerOpen:!!t})}),o.jsx(on,{path:"/anime",element:o.jsx(RL,{onPlay:X})}),o.jsx(on,{path:"/tv",element:o.jsx(LL,{onPlay:X,isPlayerOpen:!!t})}),o.jsx(on,{path:"/movies",element:o.jsx(DL,{onPlay:X,isPlayerOpen:!!t})}),o.jsx(on,{path:"/family",element:o.jsx($L,{onPlay:X,isPlayerOpen:!!t})}),o.jsx(on,{path:"/sports",element:o.jsx(gP,{})}),o.jsx(on,{path:"/sports/:slug",element:o.jsx(xP,{})}),o.jsx(on,{path:"/channels",element:o.jsx(wS,{})}),o.jsx(on,{path:"/sportsv2",element:o.jsx(wS,{})}),o.jsx(on,{path:"/channels/:id",element:o.jsx(XS,{})}),o.jsx(on,{path:"/sportsv2/:id",element:o.jsx(XS,{})}),o.jsx(on,{path:"/universes",element:o.jsx(Yz,{onPlay:X,isPlayerOpen:!!t})}),o.jsx(on,{path:"/unlocked",element:o.jsx(Kz,{onPlay:X})}),o.jsx(on,{path:"/unlock-more",element:o.jsx(mq,{})}),o.jsx(on,{path:"/token",element:o.jsx(pq,{})}),o.jsx(on,{path:"/advertise",element:o.jsx(jX,{})}),o.jsx(on,{path:"/dmca",element:o.jsx(gX,{})}),o.jsx(on,{path:"/privacy",element:o.jsx(xX,{})}),o.jsx(on,{path:"/chuck-norris",element:o.jsx(yX,{})}),o.jsx(on,{path:"/pwa",element:o.jsx(pd,{to:"/"})}),o.jsx(on,{path:"/leaderboard",element:o.jsx(pX,{})}),o.jsx(on,{path:"/quests",element:o.jsx(DX,{})}),o.jsx(on,{path:"/admin/gamification",element:o.jsx(UX,{})}),o.jsx(on,{path:"/login",element:o.jsx(yW,{})}),o.jsx(on,{path:"/download/android",element:o.jsx(h6,{platform:"android"})}),o.jsx(on,{path:"/install/windows",element:o.jsx(h6,{platform:"windows"})}),o.jsx(on,{path:"/account/leaderboard",element:o.jsx(pd,{to:"/account/stats",replace:!0})}),o.jsx(on,{path:"/account/access",element:o.jsx(pd,{to:"/account/stats",replace:!0})}),o.jsx(on,{path:"/account/*",element:o.jsx(dX,{})}),o.jsx(on,{path:"/cinema",element:o.jsx(gW,{})}),o.jsx(on,{path:"/cinema/admin",element:o.jsx(xW,{})}),o.jsx(on,{path:"/cinema/room/:id",element:o.jsx(bW,{})}),o.jsx(on,{path:"*",element:o.jsx(pd,{to:"/",replace:!0})})]})}),be&&o.jsx("nav",{className:"fixed inset-x-0 bottom-0 z-120 border-t border-white/15 bg-zinc-950/95 px-2 pb-[calc(0.4rem+env(safe-area-inset-bottom))] pt-2 backdrop-blur-lg md:hidden",children:o.jsx("ul",{className:"mx-auto grid max-w-xl gap-1",style:{gridTemplateColumns:`repeat(${xe.length}, minmax(0, 1fr))`},children:xe.map(ce=>{const Ge=ce.icon,vt=ce.match(We.pathname);return o.jsx("li",{children:o.jsxs(U6,{to:ce.to,className:`flex flex-col items-center justify-center rounded-xl px-1 py-2 text-[0.68rem] font-semibold transition ${vt?"bg-orange-500/18 text-orange-200":"text-zinc-400 hover:bg-white/8 hover:text-zinc-100"} ${ce.label==="Anime"?vt?"bg-cyan-500/16 text-cyan-200":"text-cyan-400 hover:bg-cyan-500/10 hover:text-cyan-200":""}`,children:[o.jsx(Ge,{className:"mb-1 h-4.5 w-4.5"}),ce.label]})},ce.label)})})}),fe&&o.jsxs("footer",{className:"relative hidden border-t border-white/10 bg-zinc-950/95 px-4 pb-8 pt-10 text-zinc-300 md:block md:px-12 md:pt-12",children:[o.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_20%_0%,rgba(226,94,12,0.15),transparent_32%),radial-gradient(circle_at_85%_10%,rgba(250,204,21,0.1),transparent_28%)]"}),o.jsxs("div",{className:"relative mx-auto max-w-6xl",children:[o.jsxs("div",{className:"grid grid-cols-1 gap-8 border-b border-white/10 pb-8 sm:grid-cols-2 lg:grid-cols-4 lg:gap-10",children:[o.jsxs("section",{children:[o.jsx("p",{className:"text-xl font-black tracking-tight text-white",children:"PyroPlay"}),o.jsx("p",{className:"mt-3 max-w-xs text-sm leading-relaxed text-zinc-400",children:"Community-powered unlocks where users fund titles, everyone gets access, and spent tokens are burned."}),o.jsx("a",{href:"https://orynth.dev/projects/pyroplay",target:"_blank",rel:"noopener",children:o.jsx("img",{src:"https://orynth.dev/api/badge/pyroplay?theme=dark&style=minimal",alt:"Featured on Orynth",width:"152",height:"48"})})]}),o.jsxs("section",{children:[o.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-zinc-400",children:"Explore"}),o.jsx("nav",{className:"mt-3 space-y-2 text-sm",children:HX.map(ce=>o.jsx(Ut,{to:ce.to,className:"block text-zinc-200 transition hover:text-orange-300",children:ce.label},ce.label))})]}),o.jsxs("section",{children:[o.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-zinc-400",children:"Legal"}),o.jsx("nav",{className:"mt-3 space-y-2 text-sm",children:VX.map(ce=>o.jsx(Ut,{to:ce.to,className:"block text-zinc-200 transition hover:text-orange-300",children:ce.label},ce.label))})]}),o.jsxs("section",{children:[o.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-zinc-400",children:"Community"}),o.jsx("div",{className:"mt-3 flex flex-col gap-2",children:BX.map(ce=>o.jsxs("a",{href:ce.href,target:"_blank",rel:"noreferrer",className:"inline-flex w-fit items-center gap-2 rounded-md border border-white/20 bg-zinc-900/65 px-3 py-1.5 text-xs font-semibold text-zinc-100 transition hover:bg-zinc-800",children:[o.jsx("img",{src:ce.icon,alt:ce.iconAlt,className:"h-3.5 w-3.5 rounded-sm object-cover",loading:"lazy"}),ce.label]},ce.label))})]})]}),o.jsx("div",{className:"pt-5 text-xs text-zinc-500",children:o.jsxs("p",{children:["© ",new Date().getFullYear()," PyroPlay. All rights reserved."]})})]})]}),!ut&&o.jsxs(o.Fragment,{children:[o.jsx(z7,{onPlay:X,onUnlockSeen:te,isPlayerOpen:!!t}),o.jsx(H7,{onPlay:X}),!k&&o.jsx(uL,{isOpen:Q,onClose:()=>Xe(!1),onPlay:X}),o.jsx(lL,{config:t,onClose:oe}),o.jsx(R5,{profile:H,isLoading:le,error:Ee,onClose:$e}),o.jsx(gL,{announcement:de,isOpen:Le,onConfirm:ze})]}),!ut&&!Q&&r.length>0&&o.jsx("div",{className:"fixed bottom-4 right-4 z-180 flex flex-col gap-3",children:r.map(ce=>o.jsx("div",{className:"w-80 rounded-xl border border-white/10 bg-black/80 backdrop-blur shadow-xl p-4 hover:border-white/30 transition",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:"mt-0.5 h-8 w-8 rounded-full bg-emerald-500/20 border border-emerald-400/40 flex items-center justify-center text-emerald-300 text-base font-bold",children:"â"}),o.jsxs("div",{className:"flex-1 flex gap-3",children:[ce.imageUrl&&o.jsx("img",{src:ce.imageUrl,alt:ce.title,className:"w-16 h-24 rounded-lg object-cover border border-white/10 shadow"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"text-sm font-semibold text-white",children:ce.title}),o.jsx("p",{className:"text-xs text-zinc-300 mt-1 leading-relaxed",children:ce.message}),o.jsx("button",{type:"button",onClick:()=>Ie(ce),className:"mt-2 inline-flex items-center gap-1 text-xs font-semibold text-emerald-300 hover:text-white transition",children:"Open"})]})]}),o.jsx("button",{type:"button",onClick:()=>ke(ce.id),className:"text-zinc-400 hover:text-white text-xs","aria-label":"Dismiss",children:"Ã"})]})},ce.id))}),!ut&&_&&o.jsx("div",{className:"fixed inset-0 z-220 bg-black/90 backdrop-blur-sm max-h-screen",onClick:Ze,children:o.jsxs("div",{className:"relative grid h-full w-full grid-cols-1 overflow-hidden border-white/10 bg-zinc-950 shadow-2xl lg:grid-cols-2",onClick:ce=>ce.stopPropagation(),children:[o.jsx("button",{type:"button","aria-label":"Close",onClick:Ze,className:"absolute right-4 top-4 z-20 inline-flex h-9 w-9 items-center justify-center rounded-full border border-white/25 bg-black/45 text-lg text-white transition hover:border-white/60 hover:bg-black/70",children:"Ã"}),o.jsxs("div",{className:"relative flex h-full min-h-[55vh] items-center justify-center px-6 py-10 md:px-10 lg:min-h-screen",children:[o.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_15%_8%,rgba(226,94,12,0.2),transparent_36%),radial-gradient(circle_at_82%_92%,rgba(250,204,21,0.12),transparent_34%)]"}),o.jsxs("div",{className:"relative w-full max-w-lg rounded-3xl border border-white/15 bg-zinc-900/80 p-5 shadow-[0_25px_80px_rgba(0,0,0,0.55)] backdrop-blur md:p-7",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.2em] text-zinc-400",children:"Account"}),o.jsx("h2",{className:"mt-2 text-3xl font-black leading-tight text-white md:text-4xl",children:"Log in and keep watching."}),o.jsx("p",{className:"mt-3 text-sm text-zinc-300",children:"Create your account to unlock movies, series, and anime with your PyroPlay profile."}),o.jsxs("div",{className:"mt-6 grid grid-cols-2 rounded-xl bg-zinc-800/90 p-1 text-sm",children:[o.jsx("button",{type:"button",onClick:()=>N("login"),className:`rounded-lg px-3 py-2 font-semibold transition ${T==="login"?"bg-zinc-100 text-zinc-900 shadow-sm":"text-zinc-300 hover:text-white"}`,children:"Log in"}),o.jsx("button",{type:"button",onClick:()=>N("register"),className:`rounded-lg px-3 py-2 font-semibold transition ${T==="register"?"bg-zinc-100 text-zinc-900 shadow-sm":"text-zinc-300 hover:text-white"}`,children:"Register"})]}),o.jsxs("form",{onSubmit:Wt,className:"mt-5 space-y-4",children:[o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-sm font-medium text-zinc-300",children:T==="login"?"Email":"Username"}),o.jsx("input",{type:T==="login"?"email":"text",value:j,onChange:ce=>O(ce.target.value),className:"w-full rounded-xl border border-white/10 bg-zinc-950/90 px-3.5 py-2.5 text-sm text-white outline-none transition placeholder:text-zinc-500 focus:border-[#
4163E25E0C]",placeholder:T==="login"?"[email protected]":"yourname",autoComplete:T==="login"?"email":"username",required:!0})]}),o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-sm font-medium text-zinc-300",children:"Password"}),o.jsx("input",{type:"password",value:R,onChange:ce=>z(ce.target.value),className:"w-full rounded-xl border border-white/10 bg-zinc-950/90 px-3.5 py-2.5 text-sm text-white outline-none transition placeholder:text-zinc-500 focus:border-[#E25E0C]",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",autoComplete:T==="login"?"current-password":"new-password",required:!0})]}),T==="register"&&o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"mb-1.5 block text-sm font-medium text-zinc-300",children:"Confirm password"}),o.jsx("input",{type:"password",value:M,onChange:ce=>P(ce.target.value),className:"w-full rounded-xl border border-white/10 bg-zinc-950/90 px-3.5 py-2.5 text-sm text-white outline-none transition placeholder:text-zinc-500 focus:border-[#E25E0C]",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",autoComplete:"new-password",required:!0})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"min-h-19.5 overflow-hidden rounded-md border border-white/10 bg-zinc-950 p-1",children:o.jsx(q6,{sitekey:v6,theme:"dark",onLoad:()=>ue(!0),onVerify:ce=>{V(ce),U(Ge=>Ge==="Complete the captcha before creating your account."||Ge==="Complete the captcha before logging in."?null:Ge)},onExpire:()=>V(""),onError:()=>{V(""),U("Captcha failed to load. Refresh and try again.")}},Ce)}),o.jsx("p",{className:"text-xs text-zinc-400",children:se?T==="login"?"Complete the captcha before logging in.":"Complete the captcha before creating your account.":"Loading captcha protection..."})]}),G&&o.jsx("p",{className:"rounded-xl border border-red-500/40 bg-red-500/10 px-3 py-2 text-sm text-red-200",children:G}),Y&&o.jsx("p",{className:"rounded-xl border border-emerald-500/40 bg-emerald-500/10 px-3 py-2 text-sm text-emerald-200",children:Y}),o.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[o.jsx("button",{type:"submit",disabled:J,className:"inline-flex items-center justify-center rounded-xl bg-[#E25E0C] px-5 py-2.5 text-sm font-bold text-white transition hover:bg-[#f76c15] disabled:cursor-not-allowed disabled:opacity-60",children:J?"Please wait...":T==="login"?"Log in and Play":"Create account"}),o.jsx("button",{type:"button",onClick:Ze,className:"inline-flex items-center justify-center rounded-xl border border-white/25 bg-black/35 px-5 py-2.5 text-sm font-semibold text-white transition hover:border-white/60 hover:bg-black/55",children:"Not now"})]})]})]})]}),o.jsxs("div",{className:"relative hidden h-screen lg:block",children:[o.jsx("img",{src:w?.image||"/play-auth-overlay.jpg",alt:w?.title||"Selected title preview",className:"h-full w-full object-cover"}),o.jsx("div",{className:"absolute inset-0 bg-linear-to-t from-black via-black/45 to-transparent"}),o.jsx("div",{className:"absolute inset-0 bg-linear-to-l from-transparent via-zinc-950/35 to-zinc-950/90"}),o.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-8",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.2em] text-orange-300",children:"Up Next"}),o.jsx("h3",{className:"mt-2 text-3xl font-black leading-tight text-white",children:w?.title||"Your selected title"}),o.jsx("p",{className:"mt-3 max-w-md text-sm leading-relaxed text-zinc-200",children:"Sign in to continue instantly with your watch history, unlocked access, and personalized recommendations."}),o.jsxs("div",{className:"mt-5 inline-flex items-center rounded-full border border-white/20 bg-black/40 px-4 py-1.5 text-xs font-semibold uppercase tracking-[0.14em] text-zinc-100",children:[w?.type==="tv"?"Series":w?.type==="anime"?"Anime":"Movie"," ⢠Ready to play"]})]})]})]})})]}):o.jsx("main",{className:"min-h-screen bg-zinc-950 px-4 pb-12 pt-28 text-white md:px-12",children:o.jsxs("div",{className:"mx-auto max-w-3xl rounded-2xl border border-white/10 bg-zinc-900/70 p-6 text-center shadow-xl",children:[o.jsx("h1",{className:"text-2xl font-bold",children:"Authentication required"}),o.jsx("p",{className:"mt-2 text-sm text-zinc-300",children:"PyroPlay now requires account login. Configure Supabase client env variables to continue."})]})})}l9({immediate:!0,onOfflineReady(){console.info("PyroPlay is ready to work offline.")},onNeedRefresh(){console.info("New PyroPlay content is available. Refresh to update.")}});AM.createRoot(document.getElementById("root")).render(o.jsx(E.StrictMode,{children:o.jsx(ZA,{children:o.jsx(WX,{})})}));export{sD as A,w4 as B,_O as C,Hn as D,mx as E,gU as F,kP as G,B1 as H,YX as I,Xt as J,XX as K,hx as L,ED as P,If as S,G1 as T,P4 as V,xr as _,L4 as a,k4 as b,SD as c,Fr as d,zf as e,as as f,IO as g,$v as h,Xs as i,gt as j,ya as k,QX as l,qo as m,rD as n,_r as o,Gd as p,Rt as q,KX as r,ZX as s,PO as t,tt as u,V1 as v,Hp as w,Dc as x,Av as y,uO as z};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.